Improve dependency file generation
Run the whole generation in one command
This commit is contained in:
11
Makefile
11
Makefile
@@ -67,13 +67,12 @@ $(DEPSDIR)/%.d: $(SRCDIR)/%.asm dummy
|
|||||||
@echo Building deps file $@
|
@echo Building deps file $@
|
||||||
@mkdir -p $(DEPSDIR)
|
@mkdir -p $(DEPSDIR)
|
||||||
@mkdir -p $(OBJDIR)
|
@mkdir -p $(OBJDIR)
|
||||||
@set -e
|
|
||||||
@# Generate dependency file (side effect: also compiles!)
|
@# Generate dependency file (side effect: also compiles!)
|
||||||
@# Output to a different file to not overwrite the old one on compilation failure (Make would think the compilation succeeded the next time)
|
@# Output to a different file to make `sed` work (otherwise it would use the same file as input and output)
|
||||||
$(RGBASM) -M $@.tmp $(ASFLAGS) -o $(patsubst $(SRCDIR)/%.asm,$(OBJDIR)/%.o,$<) $<
|
set -e; \
|
||||||
@# Add all obj dependencies to the deps file too, so Make knows to remake it
|
$(RGBASM) -M $@.tmp $(ASFLAGS) -o $(patsubst $(SRCDIR)/%.asm,$(OBJDIR)/%.o,$<) $<; \
|
||||||
@sed 's,\($*\)\.o[ :]*,\1.o $@: ,g' < $@.tmp > $@
|
sed 's,\($*\)\.o[ :]*,\1.o $@: ,g' < $@.tmp > $@; \
|
||||||
@rm $@.tmp
|
rm $@.tmp
|
||||||
|
|
||||||
# Include (and potentially remake) all dependency files
|
# Include (and potentially remake) all dependency files
|
||||||
include $(patsubst $(SRCDIR)/%.asm,$(DEPSDIR)/%.d,$(ASMFILES))
|
include $(patsubst $(SRCDIR)/%.asm,$(DEPSDIR)/%.d,$(ASMFILES))
|
||||||
|
|||||||
Reference in New Issue
Block a user