Merge branch 'master' into NewInstpoint
[dyninst.git] / Makefile
1 #
2 # TopLevel Makefile for the Paradyn (and DyninstAPI) system.
3 #
4 # $Id: Makefile,v 1.95 2008/10/03 21:12:39 legendre Exp $
5 #
6
7 TO_CORE = .
8 # Include additional local definitions (if available)
9 include ./make.config.local
10 # Include the make configuration specification (site configuration options)
11 include ./make.config
12
13 BUILD_ID = "$(SUITE_NAME) v$(RELEASE_NUM)$(BUILD_MARK)$(BUILD_NUM)"
14
15 SymtabAPI       = ready common symtabAPI dynutil
16 StackwalkerAPI = ready common symtabAPI stackwalk
17 DyninstAPI      = ready common symtabAPI instructionAPI parseAPI dyninstAPI_RT dyninstAPI dynutil
18 DynC_API = ready common dyninstAPI dynC_API  dynutil
19 InstructionAPI  = ready common instructionAPI dynutil
20 ProcControlAPI = ready common proccontrol
21 DepGraphAPI = depGraphAPI
22 ParseAPI = ready common symtabAPI instructionAPI parseAPI
23 ValueAdded = valueAdded/sharedMem
24 #DataflowAPI = instructionAPI parseAPI dataflowAPI
25 DataflowAPI = ParseAPI
26
27 testsuites = dyninstAPI/tests 
28 allSubdirs_noinstall =
29
30 ifndef DONT_BUILD_DYNINST
31 fullSystem      += $(DyninstAPI)
32 Build_list      += DyninstAPI
33 endif
34
35 ifndef DONT_BUILD_PROCCONTROL
36 fullSystem += proccontrol
37 Build_list += proccontrol
38 endif
39
40 ifndef DONT_BUILD_NEWTESTSUITE
41 testsuites += testsuite parseThat
42 allSubdirs_noinstall += testsuite 
43 fullSystem += testsuite parseThat
44 Build_list += testsuite parseThat
45 endif
46
47 fullSystem += parseAPI
48
49 fullSystem += dynC_API
50 Build_list += dynC_API
51
52 allCoreSubdirs  = dyninstAPI_RT common dyninstAPI symtabAPI dynutil instructionAPI parseAPI dynC_API
53 allSubdirs      = $(allCoreSubdirs) parseThat $(testsuites) valueAdded/sharedMem depGraphAPI stackwalk proccontrol
54
55
56 # We're not building the new test suite on all platforms yet
57
58
59 # Note that the first rule listed ("all") is what gets made by default,
60 # i.e., if make is given no arguments.  Don't add other targets before all!
61
62 all: ready world
63
64 # This rule makes most of the normal recursive stuff.  Just about any
65 # target can be passed down to the lower-level Makefiles by listing it
66 # as a target here:
67
68 depend:
69         +@for subsystem in $(fullSystem); do                    \
70             if [ -f $$subsystem/$(PLATFORM)/Makefile ]; then    \
71                         $(MAKE) -C $$subsystem/$(PLATFORM) $@;          \
72             else                                                \
73                         true;                                           \
74             fi                                                  \
75         done
76
77 clean distclean:
78         +@for subsystem in $(allSubdirs); do                    \
79             if [ -f $$subsystem/$(PLATFORM)/Makefile ]; then    \
80                         $(MAKE) -C $$subsystem/$(PLATFORM) $@;          \
81             else                                                \
82                         true;                                           \
83             fi                                                  \
84         done
85
86 install:        ready world
87         +@for subsystem in $(fullSystem); do 
88                         \
89                 if [ -f $$subsystem/$(PLATFORM)/Makefile ]; then        \
90                         $(MAKE) -C $$subsystem/$(PLATFORM) install;             \
91                 elif [ -f $$subsytem/Makefile ]; then                   \
92                         $(MAKE) -C $$subsystem install; \
93            else \
94                         true;                                           \
95            fi                                                   \
96         done    
97
98 # Check that the main installation directories, etc., are ready for a build,
99 # creating them if they don't already exist!  Also touch make.config.local
100 # if needed.
101
102 ready:
103         @echo "[User:`whoami` Host:`hostname` Platform:$(PLATFORM) Date:`date '+%Y-%m-%d'`]"
104         +@for installdir in $(LIBRARY_DEST) $(PROGRAM_DEST) $(INCLUDE_DEST); do \
105             if [ -d $$installdir ]; then                        \
106                 echo "Installation directory $$installdir exists...";   \
107                 true;                                           \
108             else                                                \
109                 echo "Creating installation directory $$installdir ...";\
110                 mkdir -p $$installdir;                          \
111             fi                                                  \
112         done
113
114         +@if [ ! -f make.config.local ]; then   \
115             touch make.config.local;            \
116         fi
117
118         +@echo "Primary compiler for Paradyn build is:"
119         +@if [ `basename $(CXX)` = "xlC" ]; then                \
120                echo "xlC"; \
121         elif [ `basename $(CXX)` = "insure" ]; then \
122                 echo "insure"; \
123         else \
124         echo CXX = $(CXX); \
125           $(CXX) -v; \
126      true; \
127         fi
128
129 # The "make world" target is set up to build things in the "correct"
130 # order for a build from scratch.  It builds and installs things in the
131 # "basicComps" list first, then builds and installs the remaining
132 # Paradyn "subSystems" (excluding the currently optional DyninstAPI).
133 # NB: "make world" has also been set up locally to build the DyninstAPI,
134 # however, this is optional and can be removed if desired.
135 #
136 # This make target doesn't go first in the Makefile, though, since we
137 # really only want to make "install" when it's specifically requested.
138 # Note that "world" doesn't do a "clean", since it's nice to be able
139 # to restart a compilation that fails without re-doing a lot of
140 # unnecessary work.
141
142 intro:
143         @echo "Build of $(BUILD_ID) starting for $(PLATFORM)!"
144 ifdef DONT_BUILD_DYNINST
145         @echo "Build of DyninstAPI components skipped!"
146 endif
147
148 world: intro
149         $(MAKE) $(fullSystem)
150         @echo "Build of $(BUILD_ID) complete for $(PLATFORM)!"
151
152 # "make Paradyn" and "make DyninstAPI" are also useful and valid build targets!
153
154 DyninstAPI SymtabAPI StackwalkerAPI basicComps subSystems testsuites InstructionAPI ValueAdded DepGraphAPI ParseAPI DynC_API DataflowAPI ProcControlAPI: 
155         $(MAKE) $($@)
156         @echo "Build of $@ complete."
157         @date
158
159 # Low-level directory-targets  (used in the sets defined above)
160 # Explicit specification of these rules permits better parallelization
161 # than building subsystems using a for loop
162
163 .PHONY: $(allSubdirs) $(allSubdirs_noinstall)
164
165 $(allSubdirs): 
166         @if [ -f $@/$(PLATFORM)/Makefile ]; then \
167                 $(MAKE) -C $@/$(PLATFORM) && \
168                 $(MAKE) -C $@/$(PLATFORM) install; \
169         elif [ -f $@/Makefile ]; then \
170                 $(MAKE) -C $@ && \
171                 $(MAKE) -C $@ install; \
172         else \
173                 echo $@ has no Makefile; \
174                 true; \
175         fi
176
177 $(allSubdirs_noinstall):
178         +@if [ -f $@/$(PLATFORM)/Makefile ]; then \
179                 $(MAKE) -C $@/$(PLATFORM); \
180         elif [ -f $@/Makefile ]; then \
181                 $(MAKE) -C $@; \
182         else \
183                 echo $@ has no Makefile; \
184                 true; \
185         fi
186
187 # Generate targets of the form install_<target> for all directories in
188 # allSubdirs_noinstall
189 allSubdirs_explicitInstall = $(patsubst %,install_%,$(allSubdirs_noinstall))
190 coreSubdirs_explicitInstall = $(patsubst %,install_%,$(allCoreSubdirs))
191
192 $(allSubdirs_explicitInstall): install_%: %
193         +@if [ -f $(@:install_%=%)/$(PLATFORM)/Makefile ]; then \
194                 $(MAKE) -C $(@:install_%=%)/$(PLATFORM) install; \
195         elif [ -f $(@:install_%=%)/Makefile ]; then \
196                 $(MAKE) -C $(@:install_%=%) install; \
197         else \
198                 echo $(@:install_%=%) has no Makefile; \
199                 true; \
200         fi
201
202
203 $(coreSubdirs_explicitInstall): install_%: %
204         +@if [ -f $(@:install_%=%)/$(PLATFORM)/Makefile ]; then \
205                 $(MAKE) -C $(@:install_%=%)/$(PLATFORM) install; \
206         elif [ -f $(@:install_%=%)/Makefile ]; then \
207                 $(MAKE) -C $(@:install_%=%) install; \
208         else \
209                 echo $(@:install_%=%) has no Makefiles; \
210                 true; \
211         fi
212 # dependencies -- keep parallel make from building out of order
213 symtabAPI igen: common
214 stackwalk: symtabAPI dynutil
215 dyninstAPI: symtabAPI instructionAPI parseAPI common dynutil
216 instructionAPI: common dynutil
217 symtabAPI dyninstAPI: dynutil
218 dyner dynC_API codeCoverage dyninstAPI/tests testsuite: dyninstAPI
219 testsuite: $(coreSubdirs_explicitInstall)
220 testsuite: parseThat
221 parseThat: $(coreSubdirs_explicitInstall)
222 proccontrol: common dynutil
223 parseAPI: symtabAPI instructionAPI common dynutil
224 #depGraphAPI: instructionAPI $(coreSubdirs_explicitInstall)
225 # depGraphAPI: instructionAPI dyninstAPI
226
227 # This rule passes down the documentation-related make stuff to
228 # lower-level Makefiles in the individual "docs" directories.
229
230 docs install-man:
231         +for subsystem in $(fullSystem); do                     \
232             if [ -f $$subsystem/docs/Makefile ]; then           \
233                 $(MAKE) -C $$subsystem/docs $@;                 \
234             else                                                \
235                 true;                                           \
236             fi                                                  \
237         done
238
239
240 # The "make nightly" target is what should get run automatically every
241 # night.  It uses "make world" to build things in the right order for
242 # a build from scratch.  
243 #
244 # Note that "nightly" should only be run on the primary build site,
245 # and does things like building documentation that don't need to be
246 # built for each different architecture.  Other "non-primary" build
247 # sites that run each night should just run "make clean world".
248
249 umd-nightly:
250         $(MAKE) clean
251         $(MAKE) DyninstAPI ValueAdded
252
253 # Used for UW nightly builds
254 nightly: all ValueAdded
255         $(MAKE) -C testsuite/$(PLATFORM) all
256
257 #nightly:
258 #       $(MAKE) clean
259 #       $(MAKE) world
260 ##      $(MAKE) DyninstAPI
261 #       $(MAKE) docs
262 #       $(MAKE) install-man
263 #       chmod 644 /p/paradyn/man/man?/*