PEP#: 311
[tpot/pegasus.git.bak/pegasus.git] / Makefile
1 #//%2006////////////////////////////////////////////////////////////////////////
2 #//
3 #// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 #// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 #// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
6 #// IBM Corp.; EMC Corporation, The Open Group.
7 #// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 #// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 #// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 #// EMC Corporation; VERITAS Software Corporation; The Open Group.
11 #// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 #// EMC Corporation; Symantec Corporation; The Open Group.
13 #//
14 #// Permission is hereby granted, free of charge, to any person obtaining a copy
15 #// of this software and associated documentation files (the "Software"), to
16 #// deal in the Software without restriction, including without limitation the
17 #// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 #// sell copies of the Software, and to permit persons to whom the Software is
19 #// furnished to do so, subject to the following conditions:
20 #// 
21 #// THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 #// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 #// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 #// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 #// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 #// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 #// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 #// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 #//
30 #//==============================================================================
31 # Pegasus top level make file
32 # see the usage rule for options
33
34 ROOT = .
35
36 include $(ROOT)/env_var.status
37 include $(ROOT)/mak/config.mak
38
39 # This is a recurse make file
40 # Defines subdirectorys to go to recursively
41
42 # DIRS = src cgi
43 DIRS = src test Schemas
44
45 # Define the inclusion of the recurse.mak file to execute the next
46 # level of makefiles defined by the DIRS variable
47
48 defaultrule: all setupdevserver
49
50 include $(ROOT)/mak/recurse.mak
51
52 .PHONY: FORCE
53
54 FORCE:
55
56 usage: FORCE
57         $(USAGE)
58         $(USAGE)"Makefile targets:"
59         $(USAGE)
60         $(USAGE)"Recursive rules - These are the primatives that traverse the tree"
61         $(USAGE)"invoking the specified command in each subdirectory directory."
62         $(USAGE)"NOTE: all is special, it specifies no target and therefore invokes"
63         $(USAGE)"the default rule for that directory."
64         $(USAGE)"all                 - recursive DEFAULT rule"
65         $(USAGE)"clean               - recursive clean"
66         $(USAGE)"depend              - buildmu recursive depend"
67         $(USAGE)"messages            - rootbundle recursive messages"
68         $(USAGE)"tests               - recursive tests"
69         $(USAGE)"poststarttests      - recursive poststarttests"
70         $(USAGE) 
71         $(USAGE)"Combinational rules - Combine other rules to achieve results"
72         $(USAGE)"DEFAULT RULE        - all, setupdevserver"
73         $(USAGE)"new                 - clean repositoryclean"
74         $(USAGE)"build               - depend all, setupdevserver"
75         $(USAGE)"world               - build unittests servertests"
76         $(USAGE)
77         $(USAGE)"Functional rules - Other rules to achieve specified results"
78         $(USAGE)"clobber             -removes objects built during compile"
79         $(USAGE)"                     specifically the following directories are removed:"
80         $(USAGE)"                      $(PEGASUS_HOME)/bin"
81         $(USAGE)"                      $(PEGASUS_HOME)/lib"
82         $(USAGE)"                      $(PEGASUS_HOME)/obj"
83         $(USAGE)"buildmu             - builds the mu utility"
84         $(USAGE)"setupdevserver      - setup the development server env"
85         $(USAGE)"cleandevserver      - cleans the development server env"
86         $(USAGE)"repository          - builds the base repository. Does not remove other"
87         $(USAGE)"                      namespaces than the base namespaces."  
88         $(USAGE)"testrepository      - builds items for the test suites into the repository"
89         $(USAGE)"removetestrepository- removes test items from the repository"
90         $(USAGE)"repositoryclean     - removes the complete repository"
91         $(USAGE)"listplatforms       - List all valid platforms"
92         $(USAGE)
93         $(USAGE)"Test rules (accessable here but implemented in TestMakefile)"
94         $(USAGE)"alltests            - unittests and servertests"
95         $(USAGE)"unittests           - runs the unit functional test"
96         $(USAGE)"servertests         - runs basic server tests"
97         $(USAGE)"perftests           - runs basic server performance tests"
98         $(USAGE)"standardtests       - runs server extended tests"
99         $(USAGE)"testusage           - TestMakefile usage"
100         $(USAGE)"testusage2          - TestMakefile usage2"
101         $(USAGE)"stresstests         - Runs the default stresstests"
102         $(USAGE)
103         $(USAGE)"--------------------"
104         $(USAGE)"Quick start:"
105         $(USAGE)"  After checkout of new tree:"
106         $(USAGE)"  use \"make listplatforms\" to view a list of platforms"
107         $(USAGE)"  set PEGASUS_PLATFORM=<your platofrm>"
108         $(USAGE)"  set PEGASUS_ROOT=<location of your pegasus source>"
109         $(USAGE)"  set PEGASUS_HOME=<build output location"
110         $(USAGE)"  make world"
111         $(USAGE)
112         $(USAGE)"  This will build everthing with a default configuration"
113         $(USAGE)"  and run the automated tests."
114         $(USAGE)
115         $(USAGE)"--------------------"
116         $(USAGE)"Examples:"
117         $(USAGE)"  After \"cvs checkout\" of new tree:    make world"
118         $(USAGE)
119         $(USAGE)"  After changes to include files:      make"
120         $(USAGE)
121         $(USAGE)"  After changes to the files included: make build"
122         $(USAGE)
123         $(USAGE)"  After \"cvs update\" or to start over: make new world" 
124         $(USAGE)
125
126 listplatforms: FORCE
127         $(USAGE)
128         $(USAGE)"The $(words $(VALID_PLATFORMS)) valid platforms are:"
129         $(USAGE)" $(foreach w, $(VALID_PLATFORMS), " $w ")"
130         $(USAGE)
131         $(USAGE)
132
133 #########################################################################
134 # This section defines any prerequisites that are required by the 
135 # recursive rules.
136 #
137 # NOTE: You can add prerequisties for the recursive rules but you cannot
138 #       add any commands to run as part of the rule. You can define them 
139 #       and make will quietly ignore them and they will not be run either
140 #       before or after the recursive rule. 
141 #
142 #
143 messages: rootbundle
144
145 depend: buildmu
146
147 #########################################################################
148 # This section defines combinational rules
149 #
150 #-----------------------
151 # build target: builds all source
152 #
153 build: depend all setupdevserver
154
155 #------------------------
156 # rebuild target is being deprecated instead use "make new build"
157 #
158 rebuild_msg: FORCE
159         @$(ECHO) "==============================================================================="
160         @$(ECHO) "Makefile: The rebuild target is being deprecated." 
161         @$(ECHO) "          Use \"make usage\" for a description of the usage model."
162         @$(ECHO) "          Consider using \"make new world\" ."
163         @$(ECHO) "          Invoking the old rebuild rule now."
164         @$(ECHO) "==============================================================================="
165
166 rebuild: rebuild_msg shortsleep new build s_unittests repository
167
168 #-----------------------
169 # new target: cleans everthing
170 #
171 # This can be combined on the command line with other rules like:
172 #
173 # make new build
174 # make new world 
175
176 new: clean repositoryclean
177
178 #-----------------------
179 # world targets: builds everything and dependent on which target may do testing
180 #
181 #       Typically used after a fresh checkout from CVS 
182
183 world: build s_unittests servertests
184
185
186 ############################
187 #
188 # rules defined in TestMakefile that are repeated here for convenience
189 #
190 shortsleep: FORCE
191         @$(MAKE)  -f TestMakefile shortsleep
192
193 servertests: FORCE
194         @ $(MAKE) -f TestMakefile servertests
195
196 perftests: FORCE
197         @ $(MAKE) -f TestMakefile perftests
198
199 s_unittests: FORCE
200         @ $(MAKE) -f TestMakefile -s unittests
201
202 unittests: FORCE
203         @ $(MAKE) -f TestMakefile unittests
204
205 standardtests: FORCE
206         @ $(MAKE) -f TestMakefile standardtests
207
208 alltests: FORCE
209         @ $(MAKE) -f TestMakefile alltests
210
211 testusage: FORCE
212         @ $(MAKE) -f TestMakefile usage
213
214 testusage2: FORCE
215         @ $(MAKE) -f TestMakefile usage2
216
217 stresstests:
218         @$(ECHO) "Running OpenPegasus StressTests"
219         @$(MAKE)  -f TestMakefile stresstests
220         @$(ECHO) "+++++ OpenPegasus StressTests complete"
221
222 ##########################################################################
223 #
224 # This section defines functional rules
225 #
226 #---------------------
227 # buildmu target: build mu the make utility that among other things
228 #                 includes depend
229 buildmu: FORCE
230         $(MKDIRHIER) $(BIN_DIR)
231         $(MAKE) --directory=$(PEGASUS_ROOT)/src/utils/mu -f Makefile
232
233 #----------------------
234 # setupdevserver and cleandevserver are used to setup and clear the 
235 # server configuration files needed to run the server in a development
236 # environment. 
237 #
238 setupdevserver: FORCE
239         $(MAKE) --directory=$(PEGASUS_ROOT)/src/Server -f Makefile install_run
240         @$(ECHO) "PEGASUS Development Server Runtime Environment configured "
241
242 cleandevserver: FORCE
243         $(MAKE) --directory=$(PEGASUS_ROOT)/src/Server -f Makefile install_run_clean
244
245 clobber: FORCE
246         - $(RMDIRHIER) $(PEGASUS_HOME)/bin
247         - $(RMDIRHIER) $(PEGASUS_HOME)/lib
248         - $(RMDIRHIER) $(PEGASUS_HOME)/obj
249
250
251 #---------------------
252 # The repository Target removes and rebuilds the base repository. It
253 # does not remove all possible namespaces.  See
254 # Schemas/Pegasus/Makefile for details. The repository clean has the
255 # same limitation
256
257 # Note: Arguments must be quoted to preserve upper case characters in VMS.
258 repository: FORCE
259         @ $(MAKE) "-SC" Schemas/Pegasus repository
260
261 repositoryclean: FORCE
262         @ $(RMREPOSITORY) $(REPOSITORY_ROOT)
263
264 repositoryServer: FORCE
265         @ $(MAKE) "-SC" Schemas/Pegasus repositoryServer
266
267 testrepository: FORCE
268         @ $(MAKE) "-SC" src/Providers/sample/Load repository
269         @ $(MAKE) "-SC" test/wetest repository
270         @ $(MAKE) "-SC" src/Clients/benchmarkTest/Load repository
271         @ $(MAKE) "-SC" src/Pegasus/CQL/CQLCLI repository
272         @ $(MAKE) "-SC" src/Pegasus/Query/QueryExpression/tests repository
273         @ $(MAKE) "-SC" src/Providers/TestProviders/Load repository
274 ifndef PEGASUS_DISABLE_CQL
275         @ $(MAKE) "-SC" src/Pegasus/ControlProviders/QueryCapabilitiesProvider/tests repository
276 endif
277 ifeq ($(PEGASUS_ENABLE_JMPI_PROVIDER_MANAGER), true)
278         @ $(MAKE) "-SC" src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests repository
279 endif
280         @ $(MAKE) --directory=$(PEGASUS_ROOT)/src/Clients/cimsub/tests/testscript \
281             -f Makefile repository
282
283 testrepositoryServer: FORCE
284         @ $(MAKE) "-SC" src/Providers/sample/Load repositoryServer
285         @ $(MAKE) "-SC" test/wetest repositoryServer
286         @ $(MAKE) "-SC" src/Clients/benchmarkTest/Load repositoryServer
287         @ $(MAKE) "-SC" src/Pegasus/CQL/CQLCLI repositoryServer
288         @ $(MAKE) "-SC" src/Pegasus/Query/QueryExpression/tests repositoryServer
289         @ $(MAKE) "-SC" src/Providers/TestProviders/Load repositoryServer
290 ifndef PEGASUS_DISABLE_CQL
291         @ $(MAKE) "-SC" src/Pegasus/ControlProviders/QueryCapabilitiesProvider/tests repositoryServer
292 endif
293 ifeq ($(PEGASUS_ENABLE_JMPI_PROVIDER_MANAGER), true)
294         @ $(MAKE) "-SC" src/Pegasus/ProviderManager2/JMPI/org/pegasus/jmpi/tests repositoryServer
295 endif
296         @ $(MAKE) --directory=$(PEGASUS_ROOT)/src/Clients/cimsub/tests/testscript \
297             -f Makefile repositoryServer
298
299 removetestrepository: FORCE
300         @ $(MAKE) "-SC" src/Providers/sample/Load removerepository
301         @ $(MAKE) "-SC" test/wetest removerepository
302         @ $(MAKE) "-SC" src/Clients/benchmarkTest/Load removerepository
303         @ $(MAKE) "-SC" src/Providers/TestProviders/Load removerepository
304         @ $(MAKE) "-SC" src/Clients/cimsub/tests/testscript removerepository
305
306 config:
307         @ $(ROOT)/SetConfig_EnvVar
308
309 rootbundle: 
310         $(MAKE) --directory=$(PEGASUS_ROOT)/src/utils/cnv2rootbundle -f Makefile