1
1
#_______________________________________________________________________________
3
# edam's general-purpose makefile v2.3
3
# edam's general-purpose makefile v2.2
4
4
#_______________________________________________________________________________
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
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
107
106
# empty rules with no prerequesits or commands. This causes make not to fail if
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).
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).
111
110
ifndef PROFILEMODE
112
FIXUP_DEPENDENCY_FILES = \
111
FIXUP_DEPENDANCY_FILES = \
113
112
sed 's/\#.*//;s/^[^:]*://;s/^[ \t]*//;s/ *\\$$//;/^$$/d;s/$$/:/' < \
114
113
$(basename $<).dep > .$$$$~; cat .$$$$~ >> $(basename $<).dep; rm .$$$$~;
115
DEPFLAGS = -MMD -MP -MF $(basename $<).dep
114
DEPFLAGS = -MD -MF $(basename $<).dep
119
# include dependencies
118
# include dependancies
120
119
ifneq "$(MAKECMDGOALS)" "clean"
121
120
ifneq "$(MAKECMDGOALS)" "clean_all"
122
121
-include $(DEPFILES)
169
168
%.o %_d.o %_p.o: %.c
170
169
$(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)
174
175
%.o %_d.o %_p.o: %.C
175
176
$(CXX) -c $(CPPFLAGS) $(DEPFLAGS) $(CXXFLAGS) -o $@ $<
177
$(FIXUP_DEPENDANCY_FILES)
176
178
%.o %_d.o %_p.o: %.cpp
177
179
$(CXX) -c $(CPPFLAGS) $(DEPFLAGS) $(CXXFLAGS) -o $@ $<
180
$(FIXUP_DEPENDANCY_FILES)
179
182
%.o %_d.o %_p.o: %.d
180
183
$(GDC) -c $(CPPFLAGS) $(DFLAGS) -o $@ $<
182
185
%.o %_d.o %_p.o: %.s
183
186
$(AS) $(ASFLAGS) -o $@ $<
185
$(AS) $(ASFLAGS) -M $< > $(basename $<).dep
186
$(FIXUP_DEPENDENCY_FILES)
188
187
%.o %_d.o %_p.o: %.S
189
188
$(AS) $(ASFLAGS) -o $@ $<
191
$(AS) $(ASFLAGS) -M $< > $(basename $<).dep
192
$(FIXUP_DEPENDENCY_FILES)
194
189
%.o %_d.o %_p.o: %.asm
195
190
$(AS) $(ASFLAGS) -o $@ $<
197
$(AS) $(ASFLAGS) -M $< > $(basename $<).dep
198
$(FIXUP_DEPENDENCY_FILES)
193
$(AS) $(ASFLAGS) -M $< > $@
194
$(FIXUP_DEPENDANCY_FILES)
196
$(AS) $(ASFLAGS) -M $< > $@
197
$(FIXUP_DEPENDANCY_FILES)
199
$(AS) $(ASFLAGS) -M $< > $@
200
$(FIXUP_DEPENDANCY_FILES)
201
202
#_______________________________________________________________________________