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