Fix building with KEEP_TEMPS=1, and NODEP=1.

KEEP_TEMPS=1 not working was due to the pattern substitution in the old makefile rules for compiling C files ($*) not working with the explicit generation of dependencies. NODEP=1 not working was due to the NODEP rule for src/%.s not being updated to use preproc and cpp.
This commit is contained in:
luckytyphlosion 2021-06-03 17:46:09 -04:00
parent 92152e45e2
commit 4687847ace

View File

@ -308,7 +308,7 @@ endif
ifeq ($(SCAN_DEPS),1) ifeq ($(SCAN_DEPS),1)
$(info Scanning deps start $(shell date +%s%3N)) $(info Scanning deps start $(shell date +%s%3N))
ifeq ($(NODEP),1) ifeq ($(NODEP),1)
$(C_BUILDDIR)/%.o : $(C_SUBDIR)/%.c $(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.c
ifeq (,$(KEEP_TEMPS)) ifeq (,$(KEEP_TEMPS))
@echo "$(CC1) <flags> -o $@ $<" @echo "$(CC1) <flags> -o $@ $<"
@$(CPP) $(CPPFLAGS) $< | $(PREPROC) $< charmap.txt -i | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ - @$(CPP) $(CPPFLAGS) $< | $(PREPROC) $< charmap.txt -i | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ -
@ -325,17 +325,17 @@ ifeq (,$$(KEEP_TEMPS))
@echo "$$(CC1) <flags> -o $$@ $$<" @echo "$$(CC1) <flags> -o $$@ $$<"
@$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ -
else else
@$$(CPP) $$(CPPFLAGS) $$< -o $$(C_BUILDDIR)/$$*.i @$$(CPP) $$(CPPFLAGS) $$< -o $$(C_BUILDDIR)/$3.i
@$$(PREPROC) $$(C_BUILDDIR)/$$*.i charmap.txt | $$(CC1) $$(CFLAGS) -o $$(C_BUILDDIR)/$$*.s @$$(PREPROC) $$(C_BUILDDIR)/$3.i charmap.txt | $$(CC1) $$(CFLAGS) -o $$(C_BUILDDIR)/$3.s
@echo -e ".text\n\t.align\t2, 0\n" >> $$(C_BUILDDIR)/$$*.s @echo -e ".text\n\t.align\t2, 0\n" >> $$(C_BUILDDIR)/$3.s
$$(AS) $$(ASFLAGS) -o $$@ $$(C_BUILDDIR)/$$*.s $$(AS) $$(ASFLAGS) -o $$@ $$(C_BUILDDIR)/$3.s
endif endif
endef endef
$(foreach src, $(C_SRCS), $(eval $(call C_DEP,$(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o, $(src)),$(src)))) $(foreach src, $(C_SRCS), $(eval $(call C_DEP,$(patsubst $(C_SUBDIR)/%.c,$(C_BUILDDIR)/%.o,$(src)),$(src),$(patsubst $(C_SUBDIR)/%.c,%,$(src)))))
endif endif
ifeq ($(NODEP),1) ifeq ($(NODEP),1)
$(GFLIB_BUILDDIR)/%.o : $(GFLIB_SUBDIR)/%.c $$(c_dep) $(GFLIB_BUILDDIR)/%.o: $(GFLIB_SUBDIR)/%.c $$(c_dep)
ifeq (,$(KEEP_TEMPS)) ifeq (,$(KEEP_TEMPS))
@echo "$(CC1) <flags> -o $@ $<" @echo "$(CC1) <flags> -o $@ $<"
@$(CPP) $(CPPFLAGS) $< | $(PREPROC) $< charmap.txt -i | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ - @$(CPP) $(CPPFLAGS) $< | $(PREPROC) $< charmap.txt -i | $(CC1) $(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $(AS) $(ASFLAGS) -o $@ -
@ -352,18 +352,18 @@ ifeq (,$$(KEEP_TEMPS))
@echo "$$(CC1) <flags> -o $$@ $$<" @echo "$$(CC1) <flags> -o $$@ $$<"
@$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ - @$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ -
else else
@$$(CPP) $$(CPPFLAGS) $$< -o $$(GFLIB_BUILDDIR)/$$*.i @$$(CPP) $$(CPPFLAGS) $$< -o $$(GFLIB_BUILDDIR)/$3.i
@$$(PREPROC) $$(GFLIB_BUILDDIR)/$$*.i charmap.txt | $$(CC1) $$(CFLAGS) -o $$(GFLIB_BUILDDIR)/$$*.s @$$(PREPROC) $$(GFLIB_BUILDDIR)/$3.i charmap.txt | $$(CC1) $$(CFLAGS) -o $$(GFLIB_BUILDDIR)/$3.s
@echo -e ".text\n\t.align\t2, 0\n" >> $$(GFLIB_BUILDDIR)/$$*.s @echo -e ".text\n\t.align\t2, 0\n" >> $$(GFLIB_BUILDDIR)/$3.s
$$(AS) $$(ASFLAGS) -o $$@ $$(GFLIB_BUILDDIR)/$$*.s $$(AS) $$(ASFLAGS) -o $$@ $$(GFLIB_BUILDDIR)/$3.s
endif endif
endef endef
$(foreach src, $(GFLIB_SRCS), $(eval $(call GFLIB_DEP,$(patsubst $(GFLIB_SUBDIR)/%.c,$(GFLIB_BUILDDIR)/%.o, $(src)),$(src)))) $(foreach src, $(GFLIB_SRCS), $(eval $(call GFLIB_DEP,$(patsubst $(GFLIB_SUBDIR)/%.c,$(GFLIB_BUILDDIR)/%.o, $(src)),$(src),$(patsubst $(GFLIB_SUBDIR)/%.c,%, $(src)))))
endif endif
ifeq ($(NODEP),1) ifeq ($(NODEP),1)
$(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s $(C_BUILDDIR)/%.o: $(C_SUBDIR)/%.s
$(AS) $(ASFLAGS) -o $@ $< $(PREPROC) $< charmap.txt | $(CPP) -I include - | $(AS) $(ASFLAGS) -o $@
else else
define SRC_ASM_DATA_DEP define SRC_ASM_DATA_DEP
$1: $2 $$(shell $(SCANINC) -I include -I "" $2) $1: $2 $$(shell $(SCANINC) -I include -I "" $2)