From f06ab846e3e297007afe65d9f815afff4638af0d Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Sat, 15 Oct 2022 12:23:23 -0700 Subject: Automatically discover programs and incorporate into the binary --- Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b6a5e0d..18d889f 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ clean: .SECONDARY: .SUFFIXES: -override SOURCES := $(shell find -\( -name build -prune -\) -o -\( -\( -name \*.bin -o -name \*.cpp -o -name \*.pal -\) -print -\)) +override SOURCES := $(shell find -\( -name build -prune -\) -o -\( -\( -name \*.bin -o -name \*.cpp -o -name \*.pal -\) -print -\)) $(BUILD)/programs/programs.cpp override OBJECTS := $(addprefix $(BUILD)/, $(addsuffix .o, $(basename $(SOURCES)))) override DEPENDS := $(addprefix $(BUILD)/, $(addsuffix .d, $(basename $(SOURCES)))) @@ -56,6 +56,14 @@ $(BUILD)/%.o: %.cpp @mkdir -p $(dir $@) $(CXX) $(CXXFLAGS) $(COMPILE_FLAGS) -c -o $@ $< +$(BUILD)/%.o: $(BUILD)/%.cpp + $(CXX) $(CXXFLAGS) $(COMPILE_FLAGS) -c -o $@ $< + +$(BUILD)/programs/programs.cpp: + @mkdir -p $(dir $@) + scripts/mkprograms > $@ +.PHONY: $(BUILD)/programs/programs.cpp + $(BUILD)/minigolf: $(OBJECTS) @mkdir -p $(dir $@) $(CXX) $(CXXFLAGS) -o $@ -Wl,--start-group $+ -Wl,--end-group $(LINK_FLAGS) -- cgit v1.2.3