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