/make/edam-mk

To get this branch, use:
bzr branch http://bzr.ed.am/make/edam-mk

« back to all changes in this revision

Viewing changes to Makefile

  • Committer: edam
  • Date: 2009-03-05 13:55:34 UTC
  • Revision ID: edam@waxworlds.org-20090305135534-omg3htccymsu5ki4
Tags: 2.2
- added support for D!
- also cleanup dependency files

Show diffs side-by-side

added added

removed removed

1
1
#_______________________________________________________________________________
2
2
#
3
 
#                       edam's general-purpose makefile                     v2.3
 
3
#                     edam's general-purpose makefile v2.2
4
4
#_______________________________________________________________________________
5
5
#                                                                COMMON SETTINGS
6
6
 
100
100
endif
101
101
endif
102
102
 
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).
110
109
ifdef DEBUGMODE
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
116
115
endif
117
116
endif
118
117
 
119
 
# include dependencies
 
118
# include dependancies
120
119
ifneq "$(MAKECMDGOALS)" "clean"
121
120
ifneq "$(MAKECMDGOALS)" "clean_all"
122
121
-include $(DEPFILES)
168
167
 
169
168
%.o %_d.o %_p.o: %.c
170
169
        $(CC) -c $(CPPFLAGS) $(DEPFLAGS) $(CFLAGS) -o $@ $<
 
170
        $(FIXUP_DEPENDANCY_FILES)
171
171
 
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)
178
181
 
179
182
%.o %_d.o %_p.o: %.d
180
183
        $(GDC) -c $(CPPFLAGS) $(DFLAGS) -o $@ $<
181
184
 
182
185
%.o %_d.o %_p.o: %.s
183
186
        $(AS) $(ASFLAGS) -o $@ $<
184
 
ifdef DEBUGMODE
185
 
        $(AS) $(ASFLAGS) -M $< > $(basename $<).dep
186
 
        $(FIXUP_DEPENDENCY_FILES)
187
 
endif
188
187
%.o %_d.o %_p.o: %.S
189
188
        $(AS) $(ASFLAGS) -o $@ $<
190
 
ifdef DEBUGMODE
191
 
        $(AS) $(ASFLAGS) -M $< > $(basename $<).dep
192
 
        $(FIXUP_DEPENDENCY_FILES)
193
 
endif
194
189
%.o %_d.o %_p.o: %.asm
195
190
        $(AS) $(ASFLAGS) -o $@ $<
196
 
ifdef DEBUGMODE
197
 
        $(AS) $(ASFLAGS) -M $< > $(basename $<).dep
198
 
        $(FIXUP_DEPENDENCY_FILES)
199
 
endif
 
191
 
 
192
%.dep: %.s
 
193
        $(AS) $(ASFLAGS) -M $< > $@
 
194
        $(FIXUP_DEPENDANCY_FILES)
 
195
%.dep: %.S
 
196
        $(AS) $(ASFLAGS) -M $< > $@
 
197
        $(FIXUP_DEPENDANCY_FILES)
 
198
%.dep: %.asm
 
199
        $(AS) $(ASFLAGS) -M $< > $@
 
200
        $(FIXUP_DEPENDANCY_FILES)
200
201
 
201
202
#_______________________________________________________________________________