/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 edam.mk

  • Committer: edam
  • Date: 2011-03-16 16:03:15 UTC
  • Revision ID: edam@waxworlds.org-20110316160315-418eeb4u3lvhyxje
- added the debug goal

Show diffs side-by-side

added added

removed removed

86
86
#
87
87
# SUBDIRS      A list of subdirectories to build before attempting to build the
88
88
#              target. These subdirectories are also included in a clean_all.
89
 
#              Note that if the file 'subdir.mk' exists in a subdirectory, it
 
89
#              Note that if the file 'emake.mk' exists in a subdirectory, it
90
90
#              will be used explicitly, rather than any default makefile.
91
91
#
92
92
# SUBPROJS     A list of the names of other makefiles to run before attempting
119
119
# run          Builds the target of your Makefile and, if successful, runs it.
120
120
#              This is not available if you're building a library of some kind.
121
121
#
 
122
# debug        The same as the run goal, except instead of running the target,
 
123
#              it is debugged with gdb.
 
124
#
122
125
# clean        Deletes temporary files.
123
126
#
124
127
# clean_all    Deletes temporary files and then goes through then project's
158
161
 
159
162
# debug/profile build flags
160
163
CPPFLAGS        := $(if $(PROFILEMODE),-pg -D PROFILE) $(if $(DEBUGMODE),\
161
 
        -g -D DEBUG -Wall -Wextra,-D NDEBUG -O2) $(CPPFLAGS)
 
164
        -g3 -D DEBUG -Wall -Wextra,-D NDEBUG -O2) $(CPPFLAGS)
162
165
CXXFLAGS        := $(if $(DEBUGMODE),-Woverloaded-virtual -Wreorder \
163
166
        -Wctor-dtor-privacy) $(CXXFLAGS)
164
167
DFLAGS          := $(if $(DEBUGMODE),,-frelease)
224
227
#_______________________________________________________________________________
225
228
#                                                                          RULES
226
229
 
227
 
.PHONY: all subdirs subprojs target clean clean_all run depend dep \
 
230
.PHONY: all subdirs subprojs target clean clean_all run debug depend dep \
228
231
        $(SUBDIRS) $(SUBPROJS)
229
232
 
230
233
all: subdirs subprojs target
250
253
ifndef MKSHAREDLIB
251
254
run: target
252
255
        ./$(TARGET)
 
256
 
 
257
debug: target
 
258
        gdb ./$(TARGET)
253
259
endif
254
260
endif
255
261
 
256
262
$(SUBDIRS) $(SUBPROJS):
257
263
        @if [ "$@" = "$(firstword $(SUBDIRS) $(SUBPROJS))" ]; then echo; fi
258
264
        @$(MAKE) $(if $(filter $@,$(SUBPROJS)), -f $@.mk, \
259
 
                -C $@ $(if $(wildcard $@/subdir.mk),-f subdir.mk,)) \
 
265
                -C $@ $(if $(wildcard $@/emake.mk),-f emake.mk,)) \
260
266
                $(filter-out $(SUBDIRS) $(SUBPROJS) subdirs subprojs,$(MAKECMDGOALS))
261
267
        @echo
262
268