Files
http-server/makefile

44 lines
867 B
Makefile

CC = g++
CFLAGS = -std=c++17 -Wall -g
LFLAGS = -lstdc++fs
CPPS = $(shell find ./src/ -name *.cpp)
OBJS = $(patsubst ./src/%.cpp, ./build/%.o, ${CPPS})
DEPS = $(patsubst %.o, %.d, $(OBJS))
BUILDDIRS = $(patsubst ./src/%, ./build/%, $(shell find ./src/ -type d))
BINARY_NAME = server.out
BINARY_OUT = ./build/${BINARY_NAME}
BINARY_OUT_BIN = ./bin/${BINARY}
-include $(DEPS)
${BINARY_OUT}: directories ${OBJS}
${CC} ${CFLAGS} ${OBJS} ${LFLAGS} -o $@
./build/%.o: ./src/%.cpp
${CC} ${CFLAGS} -MMD -c $< -o $@
${BINARY_OUT_BIN}: ${BINARY_OUT}
mkdir -p ./bin
cp -u $^ $@
.PHONY: all clean check tests syntax directories
all: ${BINARY_OUT}
clean:
-rm -r ./build/
check: ${BINARY_OUT_BIN}
cd ./bin/ && ./${BINARY_NAME}
tests: ${BINARY_OUT_BIN}
cd ./test/ && ./tests.sh
syntax: ${CPPS}
${CC} ${CFLAGS} -fsyntax-only $^
directories:
mkdir -p ${BUILDDIRS}