Browse Source

generate sources before compiling them

Thomas B 3 weeks ago
parent
commit
1cc2a6caa9
1 changed files with 8 additions and 8 deletions
  1. 8
    8
      Makefile

+ 8
- 8
Makefile View File

@@ -30,8 +30,7 @@ SRCS := $(wildcard $(SRC_DIR)/*.c)
30 30
 GIT := $(BUILD_DIR)/$(DATA_DIR)/git.c
31 31
 SRCS += $(GIT)
32 32
 
33
-SPEED_TABLE := $(BUILD_DIR)/$(DATA_DIR)/speed_table.c
34
-SRCS += $(SPEED_TABLE)
33
+SRCS += $(BUILD_DIR)/$(DATA_DIR)/speed_table.c
35 34
 
36 35
 OBJS := $(SRCS:%.c=$(BUILD_DIR)/%.o)
37 36
 
@@ -81,7 +80,8 @@ $(info BUILD_TYPE is $(BUILD_TYPE))
81 80
 DEPS=$(OBJS:%.o=%.d)
82 81
 -include $(DEPS)
83 82
 
84
-.PHONY: all run cloc sgb_run bgb_run gbe_run flash clean compile_commands.json usage $(GIT) $(SPEED_TABLE)
83
+.PHONY: all run cloc sgb_run bgb_run gbe_run flash clean compile_commands.json usage
84
+.PHONY: $(GIT) $(BUILD_DIR)/$(DATA_DIR)/speed_table.c $(BUILD_DIR)/$(DATA_DIR)/speed_table.h
85 85
 .PRECIOUS: $(BUILD_DIR)/$(DATA_DIR)/%.c $(BUILD_DIR)/$(DATA_DIR)/%.h
86 86
 
87 87
 all: $(BIN)
@@ -102,7 +102,7 @@ $(GIT): $(DATA_DIR)/git.c
102 102
 	@echo Generating $@ from $<
103 103
 	@sed 's|GIT_VERSION|$(shell git describe --abbrev=7 --dirty --always --tags)|g' $< > $@
104 104
 
105
-$(SPEED_TABLE):
105
+$(BUILD_DIR)/$(DATA_DIR)/speed_table.c:
106 106
 	@echo Generating $@
107 107
 	@util/gen_angles.py -n speed_table -d $(BUILD_DIR)/$(DATA_DIR) -s 16 -w 2 -f 0 -m 42 -t int8_t
108 108
 
@@ -159,23 +159,23 @@ $(BUILD_DIR)/$(DATA_DIR)/%.c $(BUILD_DIR)/$(DATA_DIR)/%.h: $(DATA_DIR)/%.png
159 159
 		$(PNGA) $< -o $@ -spr8x8                                                        \
160 160
 	)))))
161 161
 
162
-$(BUILD_DIR)/%.o: %.c $(ASSETS)
162
+$(BUILD_DIR)/%.o: %.c $(ASSETS) $(SRCS)
163 163
 	@mkdir -p $(@D)
164 164
 	@echo Compiling Code $<
165 165
 	$(eval BAFLAG = $(shell echo "$<" | sed -n 's/.*\.ba\([0-9]\+\).*/\-Wf-ba\1/p'))
166 166
 	@$(LCC) $(LCCFLAGS) $(BAFLAG) -c -o $@ $<
167 167
 
168
-$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c $(ASSETS)
168
+$(BUILD_DIR)/%.o: $(BUILD_DIR)/%.c $(ASSETS) $(SRCS)
169 169
 	@mkdir -p $(@D)
170 170
 	@echo Compiling Asset $<
171 171
 	@$(LCC) $(LCCFLAGS) -c -o $@ $<
172 172
 
173
-$(BUILD_DIR)/%.o: %.s $(ASSETS)
173
+$(BUILD_DIR)/%.o: %.s $(ASSETS) $(SRCS)
174 174
 	@mkdir -p $(@D)
175 175
 	@echo Assembling $<
176 176
 	@$(LCC) $(LCCFLAGS) -c -o $@ $<
177 177
 
178
-$(BUILD_DIR)/$(BIN): $(OBJS)
178
+$(BUILD_DIR)/$(BIN): $(OBJS) $(SRCS)
179 179
 	@echo Linking $@
180 180
 	@$(LCC) $(LCCFLAGS) -o $@ $(OBJS)
181 181
 

Loading…
Cancel
Save