/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:45:42 UTC
  • Revision ID: edam@waxworlds.org-20090305134542-llxrwg3d7xucnf60
Tags: 1.11
- fixed recursive cleaning
- notify when recursing during build

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#                                          Edam's general-purpose makefile v1.10
 
1
#                                          Edam's general-purpose makefile v1.11
2
2
#_______________________________________________________________________________
3
3
#                                                                S E T T I N G S
4
4
 
10
10
# Target binary/library
11
11
#BUILDALIB      := 1
12
12
#BUILDSOLIB     := 1
13
 
TARGET          := tim.a
 
13
TARGET          := 
14
14
 
15
15
# All source files
16
16
SOURCES         := tim.cc
41
41
TARGET          := $(patsubst %.so,%,$(patsubst %.a,%,$(TARGET)))
42
42
TARGET          := $(TARGET)$(if $(BUILDALIB),.a,)$(if $(BUILDSOLIB),.so,)
43
43
 
 
44
# Turn clean_all in to a recursive clean
 
45
ifeq "$(MAKECMDGOALS)" "clean_all"
 
46
export RECURSIVE_CLEAN := 1
 
47
MAKECMDGOALS := clean
 
48
endif
 
49
 
44
50
.PHONY: all subdirs target clean clean_all run depend dep $(SUBDIRS)
45
51
 
46
52
all: subdirs target
49
55
 
50
56
target: $(TARGET)
51
57
 
52
 
clean:
53
 
ifeq "$(MAKECMDGOALS)" "clean"
54
 
ifdef SUBDIRS
55
 
        @echo NOT RECURSING: Use \"make clean_all\" to clean subdirectoried as well...
56
 
endif
57
 
endif
58
 
        rm -f core $(DEPFILE) $(OBJECTS) $(TARGET)
59
 
        rm -f *~
60
 
 
61
 
clean_all: subdirs clean
 
58
ifdef RECURSIVE_CLEAN
 
59
clean clean_all: subdirs
 
60
else
 
61
clean:  
 
62
@echo "NOT RECURSING: use 'make clean_all' to clean subdirectories as well."
 
63
endif
 
64
        rm -f $(OBJECTS) $(TARGET) core $(DEPFILE) *~
62
65
 
63
66
ifndef BUILDALIB
64
67
ifndef BUILDSOLIB
71
74
#       makedepend -f- -- $(CPPFLAGS) -- $(SOURCES) > $(DEPFILE)
72
75
 
73
76
$(SUBDIRS):
74
 
        @$(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS)
 
77
        @echo ==== Sub directory: $@
 
78
        @$(MAKE) --no-print-directory -C $@ $(filter-out $(SUBDIRS),$(MAKECMDGOALS))
75
79
 
76
80
$(TARGET): $(OBJECTS)
77
81
ifdef BUILDALIB