projet-multitaches/Makefile

31 lines
946 B
Makefile

all: client server rapport cdb
client: src/client.c src/client.h src/common.c src/common.h
@if command -v clang >/dev/null 2>&1; then \
clang -MJ client.o.json -o client src/client.c src/common.c -pthread; \
else \
cc -o client src/client.c src/common.c -pthread; \
fi
server: src/server.c src/server.h src/common.c src/common.h
@if command -v clang >/dev/null 2>&1; then \
clang -MJ server.o.json -o server src/server.c src/common.c -lpthread; \
else \
cc -o server src/server.c src/common.c -lpthread; \
fi
cdb: client server
@if command -v clang >/dev/null 2>&1; then \
sed -e '1s/^/[\'$$'\n''/' -e '$$s/,$$/\'$$'\n'']/' *.o.json > compile_commands.json; \
fi
rapport: rapport.tex rapport.sty
@latexmk -pdf rapport.tex
@if ! cmp --silent build/rapport.pdf rapport.pdf; then \
cp build/rapport.pdf rapport.pdf; \
echo "Updated"; \
fi
clean:
@rm -rf server client *.o.json compile_commands.json build 2>/dev/null