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
 GIT := $(BUILD_DIR)/$(DATA_DIR)/git.c
30
 GIT := $(BUILD_DIR)/$(DATA_DIR)/git.c
31
 SRCS += $(GIT)
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
 OBJS := $(SRCS:%.c=$(BUILD_DIR)/%.o)
35
 OBJS := $(SRCS:%.c=$(BUILD_DIR)/%.o)
37
 
36
 
81
 DEPS=$(OBJS:%.o=%.d)
80
 DEPS=$(OBJS:%.o=%.d)
82
 -include $(DEPS)
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
 .PRECIOUS: $(BUILD_DIR)/$(DATA_DIR)/%.c $(BUILD_DIR)/$(DATA_DIR)/%.h
85
 .PRECIOUS: $(BUILD_DIR)/$(DATA_DIR)/%.c $(BUILD_DIR)/$(DATA_DIR)/%.h
86
 
86
 
87
 all: $(BIN)
87
 all: $(BIN)
102
 	@echo Generating $@ from $<
102
 	@echo Generating $@ from $<
103
 	@sed 's|GIT_VERSION|$(shell git describe --abbrev=7 --dirty --always --tags)|g' $< > $@
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
 	@echo Generating $@
106
 	@echo Generating $@
107
 	@util/gen_angles.py -n speed_table -d $(BUILD_DIR)/$(DATA_DIR) -s 16 -w 2 -f 0 -m 42 -t int8_t
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
 		$(PNGA) $< -o $@ -spr8x8                                                        \
159
 		$(PNGA) $< -o $@ -spr8x8                                                        \
160
 	)))))
160
 	)))))
161
 
161
 
162
-$(BUILD_DIR)/%.o: %.c $(ASSETS)
162
+$(BUILD_DIR)/%.o: %.c $(ASSETS) $(SRCS)
163
 	@mkdir -p $(@D)
163
 	@mkdir -p $(@D)
164
 	@echo Compiling Code $<
164
 	@echo Compiling Code $<
165
 	$(eval BAFLAG = $(shell echo "$<" | sed -n 's/.*\.ba\([0-9]\+\).*/\-Wf-ba\1/p'))
165
 	$(eval BAFLAG = $(shell echo "$<" | sed -n 's/.*\.ba\([0-9]\+\).*/\-Wf-ba\1/p'))
166
 	@$(LCC) $(LCCFLAGS) $(BAFLAG) -c -o $@ $<
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
 	@mkdir -p $(@D)
169
 	@mkdir -p $(@D)
170
 	@echo Compiling Asset $<
170
 	@echo Compiling Asset $<
171
 	@$(LCC) $(LCCFLAGS) -c -o $@ $<
171
 	@$(LCC) $(LCCFLAGS) -c -o $@ $<
172
 
172
 
173
-$(BUILD_DIR)/%.o: %.s $(ASSETS)
173
+$(BUILD_DIR)/%.o: %.s $(ASSETS) $(SRCS)
174
 	@mkdir -p $(@D)
174
 	@mkdir -p $(@D)
175
 	@echo Assembling $<
175
 	@echo Assembling $<
176
 	@$(LCC) $(LCCFLAGS) -c -o $@ $<
176
 	@$(LCC) $(LCCFLAGS) -c -o $@ $<
177
 
177
 
178
-$(BUILD_DIR)/$(BIN): $(OBJS)
178
+$(BUILD_DIR)/$(BIN): $(OBJS) $(SRCS)
179
 	@echo Linking $@
179
 	@echo Linking $@
180
 	@$(LCC) $(LCCFLAGS) -o $@ $(OBJS)
180
 	@$(LCC) $(LCCFLAGS) -o $@ $(OBJS)
181
 
181
 

Loading…
Cancel
Save