Use a generic error message for gettid failure
[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
9 # Include the make configuration specification (site configuration options)
10 include ./make.config
11
12 # Include component dependency information
13 include ./make.components
14
15 all: world
16
17 .PHONY: $(Everything) $(Everything_install) $(Everything_tests) $(Everything_tests_install) install world intro comp_intro ready clean distclean depend all
18 .PHONY: DyninstAPI SymtabAPI StackwalkerAPI basicComps subSystems testsuites InstructionAPI ValueAdded DepGraphAPI ParseAPI DynC_API DataflowAPI ProcControlAPI PatchAPI
19
20 BUILD_ID = "$(SUITE_NAME) v$(RELEASE_NUM)$(BUILD_MARK)$(BUILD_NUM)"
21
22 $(Everything) $(Everything_tests):
23         @if [ -f $@/$(PLATFORM)/Makefile ]; then \
24                 $(MAKE) -C $@/$(PLATFORM); \
25         elif [ -f $@/Makefile ]; then \
26                 $(MAKE) -C $@; \
27         else \
28                 echo $@ has no Makefile; \
29                 true; \
30         fi
31
32 $(Everything_install) $(Everything_tests_install):
33         @if [ -f $(@:%_install=%)/$(PLATFORM)/Makefile ]; then \
34                 $(MAKE) -C $(@:%_install=%)/$(PLATFORM) install; \
35         elif [ -f $(@:%_install=%)/Makefile ]; then \
36                 $(MAKE) -C $(@:%_install=%) install; \
37         else \
38                 echo $(@:%_install=%) has no Makefile; \
39                 true; \
40         fi
41
42 $(Test_targets):
43         @$(MAKE) -C testsuite/$(PLATFORM) $(@:%_testsuite=%)
44
45 test-full:
46         @$(MAKE) -C testsuite/$(PLATFORM) full
47
48 install: intro ready $(fullSystem_install)
49
50 world: intro $(fullSystem)
51 depend:
52         +@for subsystem in $(fullSystem); do                    \
53             if [ -f $$subsystem/$(PLATFORM)/Makefile ]; then    \
54                         $(MAKE) -C $$subsystem/$(PLATFORM) $@;          \
55             else                                                \
56                         true;                                           \
57             fi                                                  \
58         done
59
60 clean distclean:
61         +@for subsystem in $(Everything) $(Everything_tests); do                        \
62             if [ -f $$subsystem/$(PLATFORM)/Makefile ]; then    \
63                         $(MAKE) -C $$subsystem/$(PLATFORM) $@;          \
64             else                                                \
65                         true;                                           \
66             fi                                                  \
67         done
68
69 # Check that the main installation directories, etc., are ready for a build,
70 # creating them if they don't already exist!
71 ready:
72         @echo "[User:`whoami` Host:`hostname` Platform:$(PLATFORM) Date:`date '+%Y-%m-%d'`]"
73         +@for installdir in $(LIBRARY_DEST) $(PROGRAM_DEST) $(INCLUDE_DEST); do \
74             if [ -d $$installdir ]; then                        \
75                 echo "Installation directory $$installdir exists...";   \
76                 true;                                           \
77             else                                                \
78                 echo "Creating installation directory $$installdir ...";\
79                 $(INSTALL) -d -p $$installdir;                          \
80             fi                                                  \
81         done
82
83 intro: comp_intro
84         @echo "Build of $(BUILD_ID) on $(PLATFORM) for $(DEFAULT_COMPONENT): $(fullSystem)"
85
86 comp_intro:
87         +@echo "Primary compiler for Paradyn build is:"
88         +@if [ `basename $(CXX)` = "xlC" ]; then                \
89      echo "xlC"; \
90         else \
91         echo CXX = $(CXX); \
92           $(CXX) --version; \
93      true; \
94         fi
95
96 # Before refactoring the Makefile, we used to support these build targets.  Recreate them with
97 # simple aliases 
98 ifndef DONT_BUILD_NEWTESTSUITE
99 dyn_testsuite = dyninstAPI_testsuite
100 sym_testsuite = symtabAPI_testsuite
101 ins_testsuite = instructionAPI_testsuite
102 pc_testsuite = proccontrol_testsuite
103 endif
104
105
106 DyninstAPI: dyninstAPI parseThat $(dyn_testsuite)
107 SymtabAPI: symtabAPI $(sym_testsuite)
108 StackwalkerAPI: stackwalk
109 basicComps:  dyninstAPI
110 subSystems:  dyninstAPI
111 testsuites:  testsuite
112 InstructionAPI:  instructionAPI $(ins_testsuite)
113 ValueAdded: valueAdded/sharedMem
114 DynC_API: dynC_API
115 ParseAPI: parseAPI
116 DataflowAPI: parseAPI
117 ProcControlAPI: proccontrol $(pc_testsuite)
118 PatchAPI: patchAPI
119
120 # Testsuite dependencies
121 parseThat: $(filter-out parseThat,$(parseThat))
122 parseThat_install: $(fullSystem_install_notests)
123 testsuite: $(fullSystem_notests)
124 testsuite_install: $(fullSystem_install_notests)
125
126 # For each dependency in make.components (targ), create a rule that looks like
127 #  targ: $filter-out( $(targ),$($(targ)))
128 # Thus when targ is stackwalk we will evaluate to:
129 #   stackwalk: dynutil common proccontrol    
130 $(foreach targ,$(Everything),$(eval $(targ): $(filter-out $(targ),$($(targ)))))
131
132 # Same as above, but for %_install targets
133 $(foreach targ,$(Everything),$(eval $(targ)_install: $(patsubst %,%_install,$(filter-out $(targ),$($(targ))))))
134
135 #Every install target depends on ready
136 $(foreach targ,$(Everything),$(eval $(targ)_install: ready))
137
138 # Now add testsuite dependency rules.  An example of these expanding is:
139 #   dyninstAPI_testsuite: dyninstAPI
140 $(foreach targ,$(test_comps),$(eval $(targ)_testsuite: $(targ)))
141
142 docs install-man:
143         +for subsystem in $(fullSystem); do                     \
144             if [ -f $$subsystem/docs/Makefile ]; then           \
145                 $(MAKE) -C $$subsystem/docs $@;                 \
146             else                                                \
147                 true;                                           \
148             fi                                                  \
149         done
150
151
152 # The "make nightly" target is what should get run automatically every
153 # Note that the nightlies will build the testsuite with all mutatees
154 # at all optimization levels--this gets huge
155 testsuite-nightly:
156         $(MAKE) -C testsuite/$(PLATFORM) all
157
158 umd-nightly:
159         $(MAKE) clean
160         $(MAKE) nightly
161
162 # Used for UW nightly builds
163 nightly: ready $(Everything_install) parseThat_install testsuite-nightly
164
165 echo:
166         @echo $(Everything)
167
168 PKGCONFIG_CFLAGS = $(CXX_REQ_FLAGS) -I$(includedir)
169 PKGCONFIG_LIBS = -L$(libdir) -ldyninstAPI -lstackwalk -lpcontrol -lpatchAPI -lparseAPI -linstructionAPI -lsymtabAPI -lsymLite -ldynDwarf -ldynElf -lcommon 
170
171 ifdef LIBDWARF_PLATFORM
172 PKGCONFIG_CFLAGS += -I$(LIBDWARF_INC)
173 ifeq (xtrue,x$(LIBDWARF_STATIC))
174 PKGCONFIG_LIBS += -rdynamic -Wl,--whole-archive
175 endif
176 PKGCONFIG_LIBS += -L$(LIBDWARF_LIB) -ldwarf
177 ifeq (xtrue,x$(LIBDWARF_STATIC))
178 PKGCONFIG_LIBS += -Wl,--no-whole-archive
179 endif
180 endif
181
182 ifdef LIBELF_PLATFORM
183 PKGCONFIG_CFLAGS += -I$(LIBELF_INC)
184 PKGCONFIG_LIBS += -L$(LIBELF_LIB) -lelf
185 endif
186
187 ifdef USE_LIBIBERTY
188 ifdef LIBIBERTY_LIB
189 PKGCONFIG_LIBS += -L$(LIBIBERTY_LIB)
190 endif
191 PKGCONFIG_LIBS += -rdynamic -Wl,--whole-archive -liberty -Wl,--no-whole-archive
192 endif
193
194 pkgconfig:
195         $(HIDE_COMP)$(RM) dyninst.pc
196         $(HIDE_COMP)echo "# This file contains pkgconfig information for Dyninst and its components" > dyninst.pc
197         $(HIDE_COMP)echo "prefix = $(prefix)" >> dyninst.pc
198         $(HIDE_COMP)echo "exec_prefix = $(exec_prefix)" >> dyninst.pc
199         $(HIDE_COMP)echo "includedir = $(includedir)" >> dyninst.pc
200         $(HIDE_COMP)echo "libdir = $(libdir)" >> dyninst.pc
201         $(HIDE_COMP)echo "bindir = $(bindir)" >> dyninst.pc
202         $(HIDE_COMP)echo >> dyninst.pc
203         $(HIDE_COMP)echo "Name: dyninst" >> dyninst.pc
204         $(HIDE_COMP)echo "Description: DyninstAPI binary instrumentation library" >> dyninst.pc
205         $(HIDE_COMP)echo "Requires: libelf, libdwarf" >> dyninst.pc
206         $(HIDE_COMP)echo "Version: 8.1.1" >> dyninst.pc
207         $(HIDE_COMP)echo "Cflags: $(PKGCONFIG_CFLAGS)" >> dyninst.pc
208         $(HIDE_COMP)echo "Libs: $(PKGCONFIG_LIBS)" >> dyninst.pc
209         $(HIDE_COMP)echo "Creating dyninst.pc pkgconfig file"