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