Initial commit
This commit is contained in:
37
makefile
Normal file
37
makefile
Normal file
@@ -0,0 +1,37 @@
|
||||
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}
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
./build/%.o: ./src/%.cpp
|
||||
${CC} ${CFLAGS} -MMD -c $< -o $@
|
||||
|
||||
${BINARY_OUT}: directories ${OBJS}
|
||||
${CC} ${CFLAGS} ${OBJS} ${LFLAGS} -o $@
|
||||
|
||||
.PHONY: all clean check syntax directories
|
||||
|
||||
all: ${BINARY_OUT}
|
||||
|
||||
clean:
|
||||
-rm -r ./build/
|
||||
|
||||
check: ${BINARY_OUT}
|
||||
cp -uv $^ ./bin/
|
||||
./bin/${BINARY_NAME}
|
||||
|
||||
syntax: ${CPPS}
|
||||
${CC} ${CFLAGS} -fsyntax-only $^
|
||||
|
||||
directories:
|
||||
mkdir -p ${BUILDDIRS}
|
||||
Reference in New Issue
Block a user