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