citro3d/test/pc/Makefile
2021-06-17 13:51:26 -05:00

43 lines
1.1 KiB
Makefile

TARGET := test
CFILES := $(wildcard *.c) $(wildcard ../../source/maths/*.c)
CXXFILES := $(wildcard *.cpp)
OFILES := $(addprefix build/,$(CXXFILES:.cpp=.o)) \
$(patsubst ../../source/maths/%,build/%,$(CFILES:.c=.o))
DFILES := $(wildcard build/*.d)
CFLAGS := -Wall -g -pipe -I../../include --coverage
CXXFLAGS := $(CFLAGS) $(CPPFLAGS) -std=gnu++11 -DGLM_FORCE_RADIANS -DGLM_FORCE_CTOR_INIT
LDFLAGS := $(ARCH) -pipe -lm --coverage
.PHONY: all clean lcov
all: $(TARGET)
$(TARGET): $(OFILES)
@echo "Linking $@"
$(CXX) -o $@ $^ $(LDFLAGS)
lcov: all
@./$(TARGET)
@lcov --capture --no-external --directory ../../include --directory ../../source --directory ../../test/pc --output-file coverage.info
@genhtml coverage.info --output-directory lcov
$(OFILES): | build
build:
@[ -d build ] || mkdir build
build/%.o : %.cpp $(wildcard *.h)
@echo "Compiling $@"
@$(CXX) -o $@ -c $< $(CXXFLAGS) -MMD -MP -MF build/$*.d
build/%.o : ../../source/maths/%.c $(wildcard *.h)
@echo "Compiling $@"
@$(CC) -o $@ -c $< $(CFLAGS) -MMD -MP -MF build/$*.d
clean:
$(RM) -r $(TARGET) build/ coverage.info lcov/
-include $(DFILES)