Merge branch 'dyninst_proccontrol' of ssh://git.dyninst.org/pub/dyninst into dyninst_...
[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 # Note that the first rule listed ("all") is what gets made by default,
13 # i.e., if make is given no arguments.  Don't add other targets before all!
14 all: world
15
16 # Include component dependency information
17 include ./make.components
18
19 .PHONY: $(Everything) $(Everything_install) $(Everything_tests) $(Everything_tests_install) install world intro comp_intro ready clean distclean depend all
20 .PHONY: DyninstAPI SymtabAPI StackwalkerAPI basicComps subSystems testsuites InstructionAPI ValueAdded DepGraphAPI ParseAPI DynC_API DataflowAPI ProcControlAPI PatchAPI
21
22 BUILD_ID = "$(SUITE_NAME) v$(RELEASE_NUM)$(BUILD_MARK)$(BUILD_NUM)"
23
24 $(Everything) $(Everything_tests):
25         @if [ -f $@/$(PLATFORM)/Makefile ]; then \
26                 $(MAKE) -C $@/$(PLATFORM); \
27         elif [ -f $@/Makefile ]; then \
28                 $(MAKE) -C $@; \
29         else \
30                 echo $@ has no Makefile; \
31                 true; \
32         fi
33
34 $(Everything_install) $(Everything_tests_install):
35         @if [ -f $(@:%_install=%)/$(PLATFORM)/Makefile ]; then \
36                 $(MAKE) -C $(@:%_install=%)/$(PLATFORM) install; \
37         elif [ -f $(@:%_install=%)/Makefile ]; then \
38                 $(MAKE) -C $(@:%_install=%) install; \
39         else \
40                 echo $(@:%_install=%) has no Makefile; \
41                 true; \
42         fi
43
44 $(Test_targets):
45         @$(MAKE) -C testsuite/$(PLATFORM) $(@:%_testsuite=%)
46
47 install: intro ready $(fullSystem_install)
48
49 world: intro $(fullSystem)
50 depend:
51         +@for subsystem in $(fullSystem); do                    \
52             if [ -f $$subsystem/$(PLATFORM)/Makefile ]; then    \
53                         $(MAKE) -C $$subsystem/$(PLATFORM) $@;          \
54             else                                                \
55                         true;                                           \
56             fi                                                  \
57         done
58
59 clean distclean:
60         +@for subsystem in $(Everything) $(Everything_tests); do                        \
61             if [ -f $$subsystem/$(PLATFORM)/Makefile ]; then    \
62                         $(MAKE) -C $$subsystem/$(PLATFORM) $@;          \
63             else                                                \
64                         true;                                           \
65             fi                                                  \
66         done
67
68 # Check that the main installation directories, etc., are ready for a build,
69 # creating them if they don't already exist!
70 ready:
71         @echo "[User:`whoami` Host:`hostname` Platform:$(PLATFORM) Date:`date '+%Y-%m-%d'`]"
72         +@for installdir in $(LIBRARY_DEST) $(PROGRAM_DEST) $(INCLUDE_DEST); do \
73             if [ -d $$installdir ]; then                        \
74                 echo "Installation directory $$installdir exists...";   \
75                 true;                                           \
76             else                                                \
77                 echo "Creating installation directory $$installdir ...";\
78                 $(INSTALL) -d -p $$installdir;                          \
79             fi                                                  \
80         done
81
82 intro: comp_intro
83         @echo "Build of $(BUILD_ID) on $(PLATFORM) for $(DEFAULT_COMPONENT): $(fullSystem)"
84
85 comp_intro:
86         +@echo "Primary compiler for Paradyn build is:"
87         +@if [ `basename $(CXX)` = "xlC" ]; then                \
88      echo "xlC"; \
89         else \
90         echo CXX = $(CXX); \
91           $(CXX) --version; \
92      true; \
93         fi
94
95 # Before refactoring the Makefile, we used to support these build targets.  Recreate them with
96 # simple aliases 
97 DyninstAPI: comp_intro dyninstAPI parseThat dyninstAPI_testsuite
98 SymtabAPI: comp_intro symtabAPI symtabAPI_testsuite
99 StackwalkerAPI: comp_intro stackwalk
100 basicComps: comp_intro dyninstAPI
101 subSystems: comp_intro dyninstAPI
102 testsuites: comp_intro testsuite
103 InstructionAPI: comp_intro instructionAPI instructionAPI_testsuite
104 ValueAdded: comp_intro valueAdded/sharedMem
105 DepGraphAPI: comp_intro depGraphAPI
106 ParseAPI: comp_intro parseAPI
107 DynC_API: comp_intro dynC_API
108 DataflowAPI: comp_intro parseAPI
109 ProcControlAPI: comp_intro proccontrol proccontrol_testsuite
110 PatchAPI: comp_intro parseAPI
111
112 # Testsuite dependencies
113 parseThat: $(filter-out parseThat,$(parseThat))
114 parseThat_install: $(fullSystem_install_notests)
115 testsuite: $(fullSystem_notests)
116 testsuite_install: $(fullSystem_install_notests)
117
118 # For each dependency in make.components (targ), create a rule that looks like
119 #  targ: $filter-out( $(targ),$($(targ)))
120 # Thus when targ is stackwalk we will evaluate to:
121 #   stackwalk: dynutil common proccontrol    
122 $(foreach targ,$(Everything),$(eval $(targ): $(filter-out $(targ),$($(targ)))))
123
124 # Same as above, but for %_install targets
125 $(foreach targ,$(Everything),$(eval $(targ)_install: $(patsubst %,%_install,$(filter-out $(targ),$($(targ))))))
126
127 #Every install target depends on ready
128 $(foreach targ,$(Everything),$(eval $(targ)_install: ready))
129
130 # Now add testsuite dependency rules.  An example of these expanding is:
131 #   dyninstAPI_testsuite: dyninstAPI
132 $(foreach targ,$(test_comps),$(eval $(targ)_testsuite: $(targ)))
133
134 docs install-man:
135         +for subsystem in $(fullSystem); do                     \
136             if [ -f $$subsystem/docs/Makefile ]; then           \
137                 $(MAKE) -C $$subsystem/docs $@;                 \
138             else                                                \
139                 true;                                           \
140             fi                                                  \
141         done
142
143
144 # The "make nightly" target is what should get run automatically every
145 # Note that the nightlies will build the testsuite with all mutatees
146 # at all optimization levels--this gets huge
147 testsuite-nightly:
148         $(MAKE) -C testsuite/$(PLATFORM) all
149
150 umd-nightly:
151         $(MAKE) clean
152         $(MAKE) nightly
153
154 # Used for UW nightly builds
155 nightly: ready $(Everything_install) parseThat_install testsuite-nightly