2023-07-30 12:34:38 +00:00
|
|
|
ifdef DEBUG
|
|
|
|
COMMON_FLAGS = -g -O0
|
|
|
|
else
|
|
|
|
COMMON_FLAGS = -DNDEBUG -O3
|
|
|
|
endif
|
|
|
|
|
|
|
|
CXX_FLAGS = -Wall -Wextra -Wpedantic -Weffc++ ${COMMON_FLAGS}
|
|
|
|
LINKER_FLAGS = -lraylib
|
|
|
|
|
|
|
|
OBJDIR = objdir
|
|
|
|
|
|
|
|
SOURCES = \
|
2023-07-31 06:01:51 +00:00
|
|
|
src/main.cc \
|
|
|
|
src/game.cc
|
2023-07-30 12:34:38 +00:00
|
|
|
|
2023-07-31 06:01:51 +00:00
|
|
|
HEADERS = \
|
|
|
|
src/game.h
|
2023-07-30 12:43:18 +00:00
|
|
|
|
2023-07-30 12:34:38 +00:00
|
|
|
OBJECTS = $(addprefix ${OBJDIR}/,$(subst .cc,.cc.o,${SOURCES}))
|
|
|
|
|
2023-07-30 12:43:18 +00:00
|
|
|
all: | format demo_0
|
2023-07-30 12:34:38 +00:00
|
|
|
|
|
|
|
demo_0: ${OBJECTS}
|
2023-07-30 12:46:07 +00:00
|
|
|
${CXX} ${CXX_FLAGS} ${LINKER_FLAGS} -o $@ $^
|
2023-07-30 12:34:38 +00:00
|
|
|
|
|
|
|
.PHONY: clean format
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf ${OBJDIR}
|
|
|
|
rm -f demo_0
|
|
|
|
|
2023-07-30 12:43:18 +00:00
|
|
|
format:
|
|
|
|
clang-format -i --style=google ${HEADERS} ${SOURCES}
|
2023-07-30 12:34:38 +00:00
|
|
|
|
2023-07-31 06:01:51 +00:00
|
|
|
.SECONDEXPANSION:
|
|
|
|
|
|
|
|
${OBJDIR}/%.cc.o: $$(subst ${OBJDIR}/,,%.cc) ${HEADERS}
|
2023-07-30 12:34:38 +00:00
|
|
|
@mkdir -p $(dir $@)
|
2023-07-31 06:01:51 +00:00
|
|
|
${CXX} -c ${CXX_FLAGS} -o $@ $<
|