/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:40:53 UTC
  • Revision ID: edam@waxworlds.org-20090305134053-7afaeqithc87bwp2
Tags: 1.10
- combines sources in to one variable, SOURCES
- renamed switches to build static and shared lib to BUILDALIB and BUILDSOLIB
- fixed run goal
- added subdirs goal to phony list
- fix linking to use CXX, not CC

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#                                          Edam's general-purpose makefile v1.11
 
1
#                                          Edam's general-purpose makefile v1.10
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          := 
 
13
TARGET          := tim.a
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
 
 
50
44
.PHONY: all subdirs target clean clean_all run depend dep $(SUBDIRS)
51
45
 
52
46
all: subdirs target
55
49
 
56
50
target: $(TARGET)
57
51
 
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) *~
 
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
65
62
 
66
63
ifndef BUILDALIB
67
64
ifndef BUILDSOLIB
74
71
#       makedepend -f- -- $(CPPFLAGS) -- $(SOURCES) > $(DEPFILE)
75
72
 
76
73
$(SUBDIRS):
77
 
        @echo ==== Sub directory: $@
78
 
        @$(MAKE) --no-print-directory -C $@ $(filter-out $(SUBDIRS),$(MAKECMDGOALS))
 
74
        @$(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS)
79
75
 
80
76
$(TARGET): $(OBJECTS)
81
77
ifdef BUILDALIB