source: JEM-EUSO/esaf_cc_at_lal/packages/makeso.gmk @ 114

Last change on this file since 114 was 114, checked in by moretto, 11 years ago

actual version of ESAF at CCin2p3

File size: 3.2 KB
Line 
1# ESAF : Euso Simulation and Analysis Framework
2# $Id: makeso.gmk 2960 2011-07-06 06:06:59Z mabl $
3#
4# makeso.gmk
5#
6# Common part of GNUmakefile with shared libraries creation
7#
8# You can pass PACKAGES_EXCLUDE=name which will cause the build process to
9# ignore src/name.cc during build.
10
11DUMMY := $(shell [ ! -d $(PACKAGETMP) ] && mkdir -p $(PACKAGETMP) )
12
13
14# Dictionary variables
15PACKAGEL   := include/LinkDef.hh
16PACKAGED   := G___$(PACKAGENAME)Dict
17PACKAGEDS  := $(PACKAGETMP)/$(PACKAGED).cc
18PACKAGEDH  := $(PACKAGEDS:.cc=.h)
19PACKAGEDO  := $(PACKAGEDS:.cc=.o)
20
21# Check if PACKAGES_EXCLUDE is given and print info
22ifdef PACKAGES_EXCLUDE
23PACKAGE_IGNORES := $(patsubst %,src/%.cc,$(PACKAGES_EXCLUDE))
24PACKAGE_IGNOREH := $(patsubst %,include/%.hh,$(PACKAGES_EXCLUDE))
25$(info INFO: Ignoring package $(PACKAGES_EXCLUDE)...)
26endif
27
28PACKAGES   := $(filter-out $(PACKAGE_IGNORES), $(wildcard src/*.cc))
29PACKAGEH   := $(filter-out $(wildcard include/*LinkDef.hh) $(PACKAGE_IGNOREH),$(wildcard include/*.hh))
30PACKAGEO   := $(patsubst src/%.cc,$(PACKAGETMP)/%.o,$(PACKAGES))
31PACKAGEDEP := $(PACKAGEO:.o=.d)
32
33PACKAGEINC   := $(PACKAGEH:include%=$(INCLUDEDIR)%)
34
35CXXFLAGS   += -I.
36
37# Since ROOT does not provide off64_t types, we define it here to suppress warnings during
38# dictionary building of files which include zlib.h.
39CINT_FLAGS := -Doff64_t=int64_t
40
41$(PACKAGELIB): $(PACKAGETMP)/obj.last
42        @echo Building $(@F)...
43        @$(CXX) --shared $(CXXFLAGS) $(PACKAGEDO) $(PACKAGEO) -L$(LIBDIR) -o $@
44
45$(PACKAGEDO): $(PACKAGEDS)
46        @echo Compiling $(<F)
47        @$(CXX) -c $(CXXFLAGS) $< -o $@
48       
49
50$(PACKAGEDS): $(PACKAGEH) $(PACKAGEL)
51        @echo Building $(@F) dictionary...
52ifdef CPPVERBOSE
53        rootcint -v4 -f $@ -c -p $(CINT_FLAGS) $(INCLUDES) $(PACKAGEH) $(PACKAGEL)
54else
55        @rootcint -v4 -f $@ -c -p $(CINT_FLAGS) $(INCLUDES) $(PACKAGEH) $(PACKAGEL)
56endif
57obj: $(PACKAGETMP)/obj.last
58
59lib: includes $(PACKAGELIB)
60
61dict: includes $(PACKAGEDS)
62
63# Touch the versioning file
64$(PACKAGETMP)/obj.last: $(PACKAGEO) $(PACKAGEDO)
65        @touch $@
66
67# Build objects
68$(PACKAGETMP)/%.o : src/%.cc
69        @echo Compiling $(<F)
70ifdef CPPVERBOSE
71        $(CXX) -c $(CXXFLAGS) $< -o $@
72else
73        @$(CXX) -c $(CXXFLAGS) $< -o $@
74endif
75
76cleandep:
77        @echo Cleaning up dependencies
78        @rm -f $(PACKAGEDEP)
79
80cleandict:
81        @echo Cleaning up dictionary
82        @rm -f $(PACKAGEDH) $(PACKAGEDS) $(PACKAGEDO)
83
84clean:
85        @echo Cleaning up $(PACKAGENAME)
86        @rm -f $(PACKAGELIB)
87        @rm -rf $(PACKAGETMP)
88        @rm -f tags
89
90map:
91        @echo \'$(PACKAGELIBDEP)\'
92        $(ELIBMAP) -r $(ESAFMAP) -l $(PACKAGELIB) \
93        -d $(PACKAGELIBDEP) -c $(PACKAGEL)
94
95includes: $(PACKAGEINC)
96
97#dependencies
98$(PACKAGETMP)/%.d: src/%.cc
99        @echo Making dependency for file $<...
100        @touch $@
101        @set -e; rmkdepend -f- -Y -w3000 -- $(CXXFLAGS) $< 2> /dev/null \
102                | sed 's!$(<D)/\($*\)\.o[ :]*!$(PACKAGETMP)/\1.o $@ : !g' > $@; \
103                [ -s $@ ] || rm -f $@
104
105$(INCLUDEDIR)/%.hh: include/%.hh
106        @if [ -d $(INCLUDEDIR) ]; then cp $< $@; echo Updating $<; fi
107
108ifneq ($(MAKECMDGOALS),clean)
109ifneq ($(MAKECMDGOALS),cleandep)
110ifneq ($(PACKAGEDEP),)
111-include $(PACKAGEDEP)
112endif
113endif
114endif
115
116.PHONY: obj lib dict cleandep cleandict clean tags doc map includes
117
118tags:
119#       @echo Creating tags file
120        @-ctags -l c++ -T -S -w src/*.cc include/*.hh
121
122doc:
123        @echo Updating classes and paths...
124        @$(ESAFPACKAGES)/tools/MakeListOfClasses.pl $(PACKAGENAME) dummy $(ESAFDOC)
Note: See TracBrowser for help on using the repository browser.