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