]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/MUON/build/rules.mk
This commit was generated by cvs2svn to compensate for changes in r11742,
[u/mrichter/AliRoot.git] / HLT / MUON / build / rules.mk
1 ############################################################################
2 #
3 # Author: Artur Szostak
4 # Email:  artur@alice.phy.uct.ac.za | artursz@iafrica.com
5 #
6 ############################################################################
7
8 # Implementation of make rules that are common to all modules.
9
10 .PHONY : all depend create-distrib symlink
11
12 all : $(TARGET_NAME) symlink $(addprefix $(INCLUDE_DIR)/,$(INCLUDE_HEADERS))
13
14 create-distrib : all
15         @mkdir -p $(DISTRIBUTION_TARGET_DIR)
16         $(VERBOSE) cp $(TARGET_NAME) $(DISTRIBUTION_TARGET_DIR)/
17
18 depend : $(DEPENDS)
19
20 symlink : $(SYMLINK_NAME)
21
22 ############################################################################
23
24 $(TARGET_NAME) : $(OBJECTS)
25 #       Create the output directory if it is missing
26         @mkdir -p $(@D)
27 ifdef VERBOSE_MAKE
28         @echo -------------------------------------------------------------------------------
29 else
30         @echo "linking $(^F) => $(@F)"
31 endif
32         $(VERBOSE) $(CXX) $(LINKFLAGS) $^ -o $@
33         @echo "Made $@"
34
35 ############################################################################
36
37 ifdef DICTIONARY
38
39 # The following file must be generated for rootcint. Refer to the comment
40 # where the command is used.
41 $(OUTPUT_TARGET_DIR)/dummy.h :
42         @mkdir -p $(@D)
43         @touch $@
44
45 # Note the -p, +P, -P options makes rootcint use the real C++ preprocessor
46 # to preprocess the headers.
47 $(OUTPUT_TARGET_DIR)/$(DICTIONARY) : $(DICTIONARY_HEADERS) $(STUB_HEADERS) $(LINKDEF) $(OUTPUT_TARGET_DIR)/dummy.h
48 #       Create the output directory if it is missing
49         @mkdir -p $(@D)
50 ifndef VERBOSE_MAKE
51         @echo "generating $(@F)"
52 endif
53 #       $(VERBOSE) rootcint -f $@ -c $(INCLUDES) $(MACROS) -p +STUB $(STUB_HEADERS) -STUB $(DICTIONARY_HEADERS) $(LINKDEF)
54 # Since rootcint contains a bug and does not allow one to use -p with the
55 # (+/-)STUB option but does allow (+/-)P combinations we need to run the
56 # command as given bellow. Note the dummy file is there since rootcint
57 # requires at least one file before the +P or +STUB options.
58         $(VERBOSE) rootcint -f $@ -c $(INCLUDES) $(MACROS) $(OUTPUT_TARGET_DIR)/dummy.h +P +STUB $(STUB_HEADERS) -STUB $(DICTIONARY_HEADERS) -P $(LINKDEF)
59
60
61 endif
62
63 ############################################################################
64
65 $(OUTPUT_TARGET_DIR)/%.d : %.cxx
66 #       Create the output directory if it is missing
67         @mkdir -p $(@D)
68 ifndef VERBOSE_MAKE
69         @echo "making dependancies $(<F) => $(@F)"
70 endif
71 #       Note the sed command replaces the target xx.o with xx.o xx.d
72         $(VERBOSE) $(CXX) $(CXXFLAGS) -MM $< | \
73                 sed "s/\(.*\)\.o/$(subst /,\/,$(@D)/)\1\.o $(subst /,\/,$(@D)/)\1\.d/g" > $@
74
75 ############################################################################
76
77 $(OUTPUT_TARGET_DIR)/%.o : %.cxx
78 #       Create the output directory if it is missing
79         @mkdir -p $(@D)
80 ifndef VERBOSE_MAKE
81         @echo "compiling $(<F) => $(@F)"
82 endif
83         $(VERBOSE) $(CXX) $(CXXFLAGS) -c $< -o $@
84
85 ############################################################################
86
87 $(INCLUDE_DIR)/%.hpp : %.hpp
88 #       Create the output directory if it is missing
89         @mkdir -p $(@D)
90 ifndef VERBOSE_MAKE
91         @echo "copying header $(@F) to include directory."
92 endif
93         $(VERBOSE) cp $< $@
94
95 ############################################################################
96
97 $(SYMLINK_NAME) : $(TARGET_NAME)
98 #       Create the output directory if it is missing
99         @mkdir -p $(@D)
100 ifndef VERBOSE_MAKE
101         @echo "creating symbolic link to $<"
102 endif
103         $(VERBOSE) rm -f $@
104         $(VERBOSE) ln -s $< $@
105
106 ############################################################################
107
108 incbuild : $(OUTPUT_TARGET_DIR)/build.number
109 ifndef VERBOSE_MAKE
110         @echo Incrementing build version number for $(TARGET_NAME).
111 endif
112         $(VERBOSE) let NUM=`cat $<`+1 && echo $$NUM > $<
113
114 $(OUTPUT_TARGET_DIR)/build.number :
115         @mkdir -p $(@D)
116         @echo 0 > $@
117
118 ############################################################################
119
120 $(SRC_DIR)/Version/Version.cxx : $(OUTPUT_TARGET_DIR)/VersionNumbers.hpp
121
122 $(OUTPUT_TARGET_DIR)/VersionNumbers.hpp : major.number minor.number $(OUTPUT_TARGET_DIR)/build.number
123 ifndef VERBOSE_MAKE
124         @echo Generating $(@F)
125 endif
126         $(VERBOSE) echo // This file was generated with \"rules.mk\". Do not modify. > $@
127         $(VERBOSE) echo \#define MAJOR_VERSION `cat $(word 1,$^)` >> $@
128         $(VERBOSE) echo \#define MINOR_VERSION `cat $(word 2,$^)` >> $@
129         $(VERBOSE) echo \#define BUILD_NUMBER  `cat $(word 3,$^)` >> $@
130
131 ############################################################################
132
133 ifneq ($(findstring clean, $(MAKECMDGOALS)), clean)
134 -include $(DEPENDS)
135 endif
136