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