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