jumpartifact.com_demo_0/Makefile
Stephen Seo c99407a474 Impl 3d_helpers, unit tests, basic 3D demo
3d_helpers facilitate usage of transformation matrices.

Unit tests ensure the 3d_helpers are correct.

Currently, the program rotates a Cube mesh in x, y, and z axes.
2023-08-02 19:59:06 +09:00

56 lines
1 KiB
Makefile

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 = \
src/main.cc \
src/game.cc \
src/screen.cc \
src/screen_test.cc \
src/screen_trunner.cc \
src/3d_helpers.cc
HEADERS = \
src/game.h \
src/screen.h \
src/screen_test.h \
src/screen_trunner.h \
src/3d_helpers.h
OBJECTS = $(addprefix ${OBJDIR}/,$(subst .cc,.cc.o,${SOURCES}))
TEST_SOURCES = \
src/test/test.cc
TEST_OBJECTS = $(addprefix ${OBJDIR}/,$(subst .cc,.cc.o,${TEST_SOURCES}))
all: | format demo_0
demo_0: ${OBJECTS}
${CXX} ${CXX_FLAGS} ${LINKER_FLAGS} -o $@ $^
test: $(filter-out ${OBJDIR}/src/main.cc.o,${OBJECTS}) ${TEST_OBJECTS}
${CXX} ${CXX_FLAGS} ${LINKER_FLAGS} -o $@ $^
.PHONY: clean format
clean:
rm -rf ${OBJDIR}
rm -f demo_0
rm -f test
format:
clang-format -i --style=google ${HEADERS} ${SOURCES}
.SECONDEXPANSION:
${OBJDIR}/%.cc.o: $$(subst ${OBJDIR}/,,%.cc) ${HEADERS}
@mkdir -p $(dir $@)
${CXX} -c ${CXX_FLAGS} -o $@ $<