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