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