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-08-29 23:19:13 +02:00
|
|
|
|
2023-09-01 15:13:05 +02:00
|
|
|
clean-objs := $(TARGETS) $(foreach t,$(TARGETS),$(modules_$(t))) $(depfiles)
|
2023-09-01 09:18:32 +02:00
|
|
|
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
|
2023-08-28 21:56:54 +02:00
|
|
|
|
|
|
|
.PHONY: all test clean
|
|
|
|
|
2023-09-01 09:18:32 +02:00
|
|
|
all: $(or $(DEFAULT_TARGETS),$(TARGETS))
|
|
|
|
|
|
|
|
-include $(depfiles)
|
2023-08-28 21:56:54 +02:00
|
|
|
|
|
|
|
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-08-28 21:56:54 +02:00
|
|
|
|
2023-09-01 09:18:32 +02:00
|
|
|
%.o: %.cpp
|
|
|
|
@echo " ... build $@"
|
|
|
|
$(VERBOSE)g++ $(CXX_FLAGS) -c -o $@ $<
|
2023-08-28 21:56:54 +02:00
|
|
|
|
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-08-31 23:53:20 +02:00
|
|
|
|
2023-09-01 09:18:32 +02:00
|
|
|
$(foreach t,$(TARGETS),$(eval $(call target_rule,$(t))))
|