Merge branch 'master' of ssh://git.dyninst.org/pub/dyninst
[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                 if [ -f $$subsystem/$(PLATFORM)/Makefile ]; then        \
89                         $(MAKE) -C $$subsystem/$(PLATFORM) install;             \
90                 elif [ -f $$subsytem/Makefile ]; then                   \
91                         $(MAKE) -C $$subsystem install; \
92            else \
93                         true;                                           \
94            fi                                                   \
95         done    
96
97 # Check that the main installation directories, etc., are ready for a build,
98 # creating them if they don't already exist!  Also touch make.config.local
99 # if needed.
100
101 ready:
102         +@for installdir in $(LIBRARY_DEST) $(PROGRAM_DEST) $(INCLUDE_DEST); do \
103             if [ -d $$installdir ]; then                        \
104                 echo "Installation directory $$installdir exists...";   \
105                 true;                                           \
106             else                                                \
107                 echo "Creating installation directory $$installdir ...";\
108                 mkdir -p $$installdir;                          \
109             fi                                                  \
110         done
111
112         +@if [ ! -f make.config.local ]; then   \
113             touch make.config.local;            \
114         fi
115
116         +@echo "Primary compiler for Paradyn build is:"
117         +@if [ `basename $(CXX)` = "xlC" ]; then                \
118                echo "xlC"; \
119         elif [ `basename $(CXX)` = "insure" ]; then \
120                 echo "insure"; \
121         else \
122         echo CXX = $(CXX); \
123           $(CXX) -v; \
124      true; \
125         fi
126
127 # The "make world" target is set up to build things in the "correct"
128 # order for a build from scratch.  It builds and installs things in the
129 # "basicComps" list first, then builds and installs the remaining
130 # Paradyn "subSystems" (excluding the currently optional DyninstAPI).
131 # NB: "make world" has also been set up locally to build the DyninstAPI,
132 # however, this is optional and can be removed if desired.
133 #
134 # This make target doesn't go first in the Makefile, though, since we
135 # really only want to make "install" when it's specifically requested.
136 # Note that "world" doesn't do a "clean", since it's nice to be able
137 # to restart a compilation that fails without re-doing a lot of
138 # unnecessary work.
139
140 intro:
141         @echo "Build of $(BUILD_ID) starting for $(PLATFORM)!"
142 ifdef DONT_BUILD_DYNINST
143         @echo "Build of DyninstAPI components skipped!"
144 endif
145
146 world: intro
147         $(MAKE) $(fullSystem)
148         @echo "Build of $(BUILD_ID) complete for $(PLATFORM)!"
149
150 # "make Paradyn" and "make DyninstAPI" are also useful and valid build targets!
151
152 DyninstAPI SymtabAPI StackwalkerAPI basicComps subSystems testsuites InstructionAPI ValueAdded DepGraphAPI ParseAPI DynC_API DataflowAPI ProcControlAPI: 
153         $(MAKE) $($@)
154         @echo "Build of $@ complete."
155         @date
156
157 # Low-level directory-targets  (used in the sets defined above)
158 # Explicit specification of these rules permits better parallelization
159 # than building subsystems using a for loop
160
161 .PHONY: $(allSubdirs) $(allSubdirs_noinstall)
162
163 $(allSubdirs): 
164         @if [ -f $@/$(PLATFORM)/Makefile ]; then \
165                 $(MAKE) -C $@/$(PLATFORM) && \
166                 $(MAKE) -C $@/$(PLATFORM) install; \
167         elif [ -f $@/Makefile ]; then \
168                 $(MAKE) -C $@ && \
169                 $(MAKE) -C $@ install; \
170         else \
171                 echo $@ has no Makefile; \
172                 true; \
173         fi
174
175 $(allSubdirs_noinstall):
176         +@if [ -f $@/$(PLATFORM)/Makefile ]; then \
177                 $(MAKE) -C $@/$(PLATFORM); \
178         elif [ -f $@/Makefile ]; then \
179                 $(MAKE) -C $@; \
180         else \
181                 echo $@ has no Makefile; \
182                 false; \
183         fi
184
185 # Generate targets of the form install_<target> for all directories in
186 # allSubdirs_noinstall
187 allSubdirs_explicitInstall = $(patsubst %,install_%,$(allSubdirs_noinstall))
188 coreSubdirs_explicitInstall = $(patsubst %,install_%,$(allCoreSubdirs))
189
190 $(allSubdirs_explicitInstall): install_%: %
191         +@if [ -f $(@:install_%=%)/$(PLATFORM)/Makefile ]; then \
192                 $(MAKE) -C $(@:install_%=%)/$(PLATFORM) install; \
193         elif [ -f $(@:install_%=%)/Makefile ]; then \
194                 $(MAKE) -C $(@:install_%=%) install; \
195         else \
196                 echo $(@:install_%=%) has no Makefile; \
197                 true; \
198         fi
199
200
201 $(coreSubdirs_explicitInstall): install_%: %
202         +@if [ -f $(@:install_%=%)/$(PLATFORM)/Makefile ]; then \
203                 $(MAKE) -C $(@:install_%=%)/$(PLATFORM) install; \
204         elif [ -f $(@:install_%=%)/Makefile ]; then \
205                 $(MAKE) -C $(@:install_%=%) install; \
206         else \
207                 echo $(@:install_%=%) has no Makefiles; \
208                 true; \
209         fi
210 # dependencies -- keep parallel make from building out of order
211 symtabAPI igen: common
212 stackwalk: symtabAPI dynutil
213 dyninstAPI: symtabAPI instructionAPI parseAPI common dynutil
214 instructionAPI: common dynutil
215 symtabAPI dyninstAPI: dynutil
216 dyner dynC_API codeCoverage dyninstAPI/tests testsuite: dyninstAPI
217 testsuite: $(coreSubdirs_explicitInstall)
218 testsuite: parseThat
219 parseThat: $(coreSubdirs_explicitInstall)
220 proccontrol: common dynutil
221 parseAPI: symtabAPI instructionAPI common dynutil
222 #depGraphAPI: instructionAPI $(coreSubdirs_explicitInstall)
223 # depGraphAPI: instructionAPI dyninstAPI
224
225 # This rule passes down the documentation-related make stuff to
226 # lower-level Makefiles in the individual "docs" directories.
227
228 docs install-man:
229         +for subsystem in $(fullSystem); do                     \
230             if [ -f $$subsystem/docs/Makefile ]; then           \
231                 $(MAKE) -C $$subsystem/docs $@;                 \
232             else                                                \
233                 true;                                           \
234             fi                                                  \
235         done
236
237
238 # The "make nightly" target is what should get run automatically every
239 # night.  It uses "make world" to build things in the right order for
240 # a build from scratch.  
241 #
242 # Note that "nightly" should only be run on the primary build site,
243 # and does things like building documentation that don't need to be
244 # built for each different architecture.  Other "non-primary" build
245 # sites that run each night should just run "make clean world".
246
247 umd-nightly:
248         $(MAKE) clean
249         $(MAKE) DyninstAPI ValueAdded
250
251 # Used for UW nightly builds
252 nightly: all ValueAdded
253         $(MAKE) -C testsuite/$(PLATFORM) all
254
255 #nightly:
256 #       $(MAKE) clean
257 #       $(MAKE) world
258 ##      $(MAKE) DyninstAPI
259 #       $(MAKE) docs
260 #       $(MAKE) install-man
261 #       chmod 644 /p/paradyn/man/man?/*