1
1
#_______________________________________________________________________________
3
# edam's general-purpose makefile v2.2
3
# edam's general-purpose makefile v2.3
4
4
#_______________________________________________________________________________
103
# Set up dependancy generation build flags and a commands to be executed after
104
# generating any dependancy file. The commands append the names of all the
105
# depended-on files in the dependancy file to the end of the dependancy file as
103
# Set up dependency generation build flags and, for those languages where the
104
# the compiler/assembler doesn't support dependency generation, commands to be
105
# executed after generating any dependency file. The commands append the names
106
# of all the depended-on files in the dependency file to the end of the file as
106
107
# empty rules with no prerequesits or commands. This causes make not to fail if
107
# one of these files becomes non-existant, but causes files dependant on these
108
# files to be rebuilt (and thus also have their dependancies regenerated).
108
# one of these files becomes non-existant, but causes files dependent on these
109
# files to be rebuilt (and thus also have their dependencies regenerated).
110
111
ifndef PROFILEMODE
111
FIXUP_DEPENDANCY_FILES = \
112
FIXUP_DEPENDENCY_FILES = \
112
113
sed 's/\#.*//;s/^[^:]*://;s/^[ \t]*//;s/ *\\$$//;/^$$/d;s/$$/:/' < \
113
114
$(basename $<).dep > .$$$$~; cat .$$$$~ >> $(basename $<).dep; rm .$$$$~;
114
DEPFLAGS = -MD -MF $(basename $<).dep
115
DEPFLAGS = -MMD -MP -MF $(basename $<).dep
118
# include dependancies
119
# include dependencies
119
120
ifneq "$(MAKECMDGOALS)" "clean"
120
121
ifneq "$(MAKECMDGOALS)" "clean_all"
121
122
-include $(DEPFILES)
168
169
%.o %_d.o %_p.o: %.c
169
170
$(CC) -c $(CPPFLAGS) $(DEPFLAGS) $(CFLAGS) -o $@ $<
170
$(FIXUP_DEPENDANCY_FILES)
172
172
%.o %_d.o %_p.o: %.cc
173
173
$(CXX) -c $(CPPFLAGS) $(DEPFLAGS) $(CXXFLAGS) -o $@ $<
174
$(FIXUP_DEPENDANCY_FILES)
175
174
%.o %_d.o %_p.o: %.C
176
175
$(CXX) -c $(CPPFLAGS) $(DEPFLAGS) $(CXXFLAGS) -o $@ $<
177
$(FIXUP_DEPENDANCY_FILES)
178
176
%.o %_d.o %_p.o: %.cpp
179
177
$(CXX) -c $(CPPFLAGS) $(DEPFLAGS) $(CXXFLAGS) -o $@ $<
180
$(FIXUP_DEPENDANCY_FILES)
182
179
%.o %_d.o %_p.o: %.d
183
180
$(GDC) -c $(CPPFLAGS) $(DFLAGS) -o $@ $<
185
182
%.o %_d.o %_p.o: %.s
186
183
$(AS) $(ASFLAGS) -o $@ $<
185
$(AS) $(ASFLAGS) -M $< > $(basename $<).dep
186
$(FIXUP_DEPENDENCY_FILES)
187
188
%.o %_d.o %_p.o: %.S
188
189
$(AS) $(ASFLAGS) -o $@ $<
191
$(AS) $(ASFLAGS) -M $< > $(basename $<).dep
192
$(FIXUP_DEPENDENCY_FILES)
189
194
%.o %_d.o %_p.o: %.asm
190
195
$(AS) $(ASFLAGS) -o $@ $<
193
$(AS) $(ASFLAGS) -M $< > $@
194
$(FIXUP_DEPENDANCY_FILES)
196
$(AS) $(ASFLAGS) -M $< > $@
197
$(FIXUP_DEPENDANCY_FILES)
199
$(AS) $(ASFLAGS) -M $< > $@
200
$(FIXUP_DEPENDANCY_FILES)
197
$(AS) $(ASFLAGS) -M $< > $(basename $<).dep
198
$(FIXUP_DEPENDENCY_FILES)
202
201
#_______________________________________________________________________________