diff --git a/Makefile b/Makefile index bfb50de..b2be4fa 100644 --- a/Makefile +++ b/Makefile @@ -3,29 +3,29 @@ CCFLAGS = -Wall -std=c99 -pedantic -g CLIENT=client SERVER=server -ERROR=errors.o -CHALLENGE=challenges.o +ERRORS=errors.o +CHALLENGES=challenges.o RANDOM=random.o SOCKETS=sockets.o TMP := $(shell mktemp) -all: $(ERROR) $(CHALLENGE) $(RANDOM) $(SOCKETS) $(CLIENT) $(SERVER) +all: $(ERRORS) $(CHALLENGES) $(RANDOM) $(SOCKETS) $(CLIENT) $(SERVER) -$(SERVER): server.c challenges.c errors.c sockets.c include/errors.h include/challenges.h include/server.h include/challengesLib.h include/sockets.h - $(CC) $(CCFLAGS) server.c -o server challenges.o errors.o random.o sockets.o -lm +$(SERVER): src/server.c src/challenges.c src/errors.c src/sockets.c include/errors.h include/challenges.h include/server.h include/challengesLib.h include/sockets.h + $(CC) $(CCFLAGS) src/server.c -o server $(CHALLENGES) $(ERRORS) $(RANDOM) $(SOCKETS) -lm objcopy --add-section .RUN_ME="$(TMP)" --set-section-flags .mydata=noload,readonly server strip --strip-debug server rm "$(TMP)" -$(CLIENT): client.c errors.c sockets.c include/errors.h include/client.h include/sockets.h - $(CC) $(CCFLAGS) client.c -o client errors.o sockets.o +$(CLIENT): src/client.c src/errors.c src/sockets.c include/errors.h include/client.h include/sockets.h + $(CC) $(CCFLAGS) src/client.c -o client $(ERRORS) $(SOCKETS) -%.o: %.c +%.o: src/%.c $(CC) $(CCFLAGS) -I./include -c $< clean: - rm -rf $(ERROR) $(CHALLENGE) $(CLIENT) $(SERVER) $(RANDOM) $(SOCKETS) + rm -f $(ERRORS) $(CHALLENGES) $(CLIENT) $(SERVER) $(RANDOM) $(SOCKETS) test: pvs-studio-analyzer trace -- make diff --git a/challenges.c b/src/challenges.c similarity index 98% rename from challenges.c rename to src/challenges.c index f2ad9e8..bf12ab6 100644 --- a/challenges.c +++ b/src/challenges.c @@ -1,6 +1,6 @@ // This is a personal academic project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -#include "include/challenges.h" +#include "../include/challenges.h" char genChallenge(FILE * stream, char ** output, challenge_t challenge) { printf("------------- DESAFIO -------------\n"); diff --git a/client.c b/src/client.c similarity index 96% rename from client.c rename to src/client.c index 58be3df..46a5a59 100644 --- a/client.c +++ b/src/client.c @@ -1,6 +1,6 @@ // This is a personal academic project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -#include "include/client.h" +#include "../include/client.h" int main(int argc, char *argv[]) { int fd = createSocket(); diff --git a/errors.c b/src/errors.c similarity index 91% rename from errors.c rename to src/errors.c index cb59560..5b3f60d 100644 --- a/errors.c +++ b/src/errors.c @@ -1,6 +1,6 @@ // This is a personal academic project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -#include "include/errors.h" +#include "../include/errors.h" void printError(char * string) { fprintf(stderr, "%s\n", string); diff --git a/random.c b/src/random.c similarity index 93% rename from random.c rename to src/random.c index db49d70..c54c9b6 100644 --- a/random.c +++ b/src/random.c @@ -1,6 +1,6 @@ // This is a personal academic project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -#include "include/random.h" +#include "../include/random.h" static uint32_t m_z = 362436069; static uint32_t m_w = 521288629; diff --git a/server.c b/src/server.c similarity index 97% rename from server.c rename to src/server.c index cb5b5ba..ee1cecb 100644 --- a/server.c +++ b/src/server.c @@ -1,6 +1,6 @@ // This is a personal academic project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -#include "include/server.h" +#include "../include/server.h" int main(int argc, char *argv[]) { int fd = createSocket(); diff --git a/sockets.c b/src/sockets.c similarity index 98% rename from sockets.c rename to src/sockets.c index 79d9efc..6cf6d6e 100644 --- a/sockets.c +++ b/src/sockets.c @@ -1,6 +1,6 @@ // This is a personal academic project. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -#include "include/sockets.h" +#include "../include/sockets.h" int createSocket() { int fd;