vgbc/Makefile

39 lines
730 B
Makefile
Raw Normal View History

2023-08-26 19:04:02 +02:00
include Makeconf
2023-09-01 09:18:32 +02:00
# Auto tracking of headers
CXX_FLAGS += -MMD
depfiles := $(wildcard *.d **/*.d)
2023-09-01 09:18:32 +02:00
clean-objs := $(foreach t,$(TARGETS),$(modules_$(t))) $(depfiles)
cmd = $(VERBOSE)g++ $(CXX_FLAGS) -o $@ $^
msg = $(or $(verb_$@),finalize) $@
2023-08-29 23:22:20 +02:00
2023-09-01 09:18:32 +02:00
ifneq ($V,1)
VERBOSE := @
endif
.PHONY: all test clean
2023-09-01 09:18:32 +02:00
all: $(or $(DEFAULT_TARGETS),$(TARGETS))
-include $(depfiles)
clean:
rm -rf $(clean-objs)
2023-08-28 22:31:24 +02:00
test: vgbc.test
2023-09-01 09:18:32 +02:00
@echo " ... run test $<"
$(VERBOSE)./$< $(if $(V),-s)
2023-09-01 09:18:32 +02:00
%.o: %.cpp
@echo " ... build $@"
$(VERBOSE)g++ $(CXX_FLAGS) -c -o $@ $<
2023-09-01 09:18:32 +02:00
define target_rule
$(1): $$(modules_$(1))
@echo " ..." $$(or $$(msg_$(1)),$$(msg))
$$(VERBOSE)$$(or $$(cmd_$(1)),$$(cmd))
endef
2023-09-01 09:18:32 +02:00
$(foreach t,$(TARGETS),$(eval $(call target_rule,$(t))))