Skip to content

Commit 2d7cf38

Browse files
committed
ffbuild/commonmak: Fix rebuild check with implicit rule chains
When there's a chain of implicit rules, make treats files generated inside that chain as intermediate files. Those intermediate files are removed after completion of make. When make is run again, it normally determines the need for a rebuild by comparing the timestamps of the original source file and the final output of the chain and if still up-to-date, it doesn't rebuild, even when the intermediate files are not present. That makes sense of course - why would it delete them otherwise, it would end up in builds being never up-to-date. But this original by-the-book logic appeared to be broken and has been worked around by adding all intermediate files to the .SECONDARY special target, which required extra logic and issues with make clean. What broke the up-to-date checking is the dependency file generation. For the .c files generated by BIN2C the compile target created a .d file which indicated that the .ptx.o file has a dependency on the ptx.c file. And that dependency broke the normal make behavior with intermediate files. This patch compiles the BIN2C generated .c files without generating .d files. In turn the files do not longer need to be added to the .SECONDARY target in common.mak. When interested in those files for debugging, a line can be added to the corresponding Makefile like .SECONDARY: %.ptx.c %.ptx.gz Signed-off-by: softworkz <softworkz@hotmail.com>
1 parent eb6dc95 commit 2d7cf38

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

ffbuild/common.mak

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ else
139139
$(BIN2C) $(patsubst $(SRC_PATH)/%,$(SRC_LINK)/%,$<) $@ $(subst .,_,$(basename $(notdir $@)))
140140
endif
141141

142+
%.ptx.o: %.ptx.c
143+
$(CC) $(CCFLAGS) -c -o $@ $<
144+
145+
142146
# 1) Preprocess CSS to a minified version
143147
%.css.min: %.css
144148
# Must start with a tab in the real Makefile
@@ -177,6 +181,13 @@ else # NO COMPRESSION
177181
$(BIN2C) $< $@ $(subst .,_,$(basename $(notdir $@)))
178182
endif
179183

184+
%.html.o: %.html.c
185+
$(CC) $(CCFLAGS) -c -o $@ $<
186+
187+
%.css.o: %.css.c
188+
$(CC) $(CCFLAGS) -c -o $@ $<
189+
190+
180191
clean::
181192
$(RM) $(BIN2CEXE) $(CLEANSUFFIXES:%=ffbuild/%)
182193

@@ -228,11 +239,9 @@ ALLHEADERS := $(subst $(SRC_DIR)/,$(SUBDIR),$(wildcard $(SRC_DIR)/*.h $(SRC_DIR)
228239
SKIPHEADERS += $(ARCH_HEADERS:%=$(ARCH)/%) $(SKIPHEADERS-)
229240
SKIPHEADERS := $(SKIPHEADERS:%=$(SUBDIR)%)
230241
HOBJS = $(filter-out $(SKIPHEADERS:.h=.h.o),$(ALLHEADERS:.h=.h.o))
231-
PTXOBJS = $(filter %.ptx.o,$(OBJS))
232-
RESOURCEOBJS = $(filter %.css.o %.html.o,$(OBJS))
233242
$(HOBJS): CCFLAGS += $(CFLAGS_HEADERS)
234243
checkheaders: $(HOBJS)
235-
.SECONDARY: $(HOBJS:.o=.c) $(PTXOBJS:.o=.c) $(PTXOBJS:.o=.gz) $(PTXOBJS:.o=) $(RESOURCEOBJS:.o=.c) $(RESOURCEOBJS:%.css.o=%.css.min) $(RESOURCEOBJS:%.css.o=%.css.min.gz) $(RESOURCEOBJS:%.html.o=%.html.gz) $(RESOURCEOBJS:.o=)
244+
.SECONDARY: $(HOBJS:.o=.c)
236245

237246
alltools: $(TOOLS)
238247

0 commit comments

Comments
 (0)