summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJulian Blake Kongslie2022-10-08 00:39:15 -0700
committerJulian Blake Kongslie2022-10-08 00:39:15 -0700
commit85b34e1c9dc03585ec4f13f6241cd8f0ecaf9cd9 (patch)
tree0ec9a990fab8c06d0e2c6aa67447f3a8003aaf3d /Makefile
parentMinor cleanup and some compilation fixes. (diff)
downloadbiggolf-85b34e1c9dc03585ec4f13f6241cd8f0ecaf9cd9.tar.xz
Trivial support for running the checker on an image.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 14 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 863826d..9ae29fd 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ DEBUG := -g
9CXX := g++ 9CXX := g++
10CXXFLAGS := $(WARNINGS) $(OPTIMIZE) $(DEBUG) 10CXXFLAGS := $(WARNINGS) $(OPTIMIZE) $(DEBUG)
11 11
12SED := sed 12LD := ld
13 13
14XXD := xxd 14XXD := xxd
15 15
@@ -30,15 +30,27 @@ clean:
30 rm -rf $(BUILD) 30 rm -rf $(BUILD)
31.PHONY: clean 31.PHONY: clean
32 32
33.SECONDARY:
33.SUFFIXES: 34.SUFFIXES:
34 35
35override SOURCES := $(shell find -\( -name build -prune -\) -o -\( -name \*.cpp -print -\)) 36override SOURCES := $(shell find -\( -name build -prune -\) -o -\( -\( -name \*.bin -o -name \*.hex -o -name \*.cpp -\) -print -\))
36 37
37override OBJECTS := $(addprefix $(BUILD)/, $(addsuffix .o, $(basename $(SOURCES)))) 38override OBJECTS := $(addprefix $(BUILD)/, $(addsuffix .o, $(basename $(SOURCES))))
38override DEPENDS := $(addprefix $(BUILD)/, $(addsuffix .d, $(basename $(SOURCES)))) 39override DEPENDS := $(addprefix $(BUILD)/, $(addsuffix .d, $(basename $(SOURCES))))
39 40
40-include $(DEPENDS) 41-include $(DEPENDS)
41 42
43$(BUILD)/%.bin: %.hex
44 @mkdir -p $(dir $@)
45 $(XXD) -r -p $< $@
46
47$(BUILD)/%.o: %.bin
48 @mkdir -p $(dir $@)
49 $(LD) -r -b binary -z noexecstack -o $@ $<
50
51$(BUILD)/%.o: $(BUILD)/%.bin
52 $(LD) -r -b binary -z noexecstack -o $@ $<
53
42$(BUILD)/%.o: %.cpp 54$(BUILD)/%.o: %.cpp
43 @mkdir -p $(dir $@) 55 @mkdir -p $(dir $@)
44 $(CXX) $(CXXFLAGS) $(COMPILE_FLAGS) -c -o $@ $< 56 $(CXX) $(CXXFLAGS) $(COMPILE_FLAGS) -c -o $@ $<
@@ -46,7 +58,3 @@ $(BUILD)/%.o: %.cpp
46$(BUILD)/minigolf: $(OBJECTS) 58$(BUILD)/minigolf: $(OBJECTS)
47 @mkdir -p $(dir $@) 59 @mkdir -p $(dir $@)
48 $(CXX) $(CXXFLAGS) -o $@ -Wl,--start-group $+ -Wl,--end-group $(LINK_FLAGS) 60 $(CXX) $(CXXFLAGS) -o $@ -Wl,--start-group $+ -Wl,--end-group $(LINK_FLAGS)
49
50$(BUILD)/%.bin: %.hex
51 @mkdir -p $(dir $@)
52 $(SED) -e "s/\\s*#.*//" $< | $(XXD) -r -p > $@