summaryrefslogtreecommitdiffstats
path: root/mak/commands.mak
blob: 83b29b69486b6538d92b2a5bd668539576f414da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# commands.mak is a helper Makefile that is intended to be included in an upper level Makefile. 

# Ensure that config.mak is included (so that the ROOT variable is set correctly)

ifndef ROOT
    ifdef PEGASUS_ROOT
        ROOT =  $(subst \,/,$(PEGASUS_ROOT))
    else
        ROOT = .
    endif
    include $(ROOT)/mak/config.mak
endif

ifeq ($(OS),win32)
    STRIPCRS = stripcrs $(RESULTFILE) $(MASTERRESULTFILE)
    DIFF = mu compare
    REDIRECTERROR = 2>&1
    CIMSERVER_START_SERVICE = cimserver -start $(CIMSERVER_CONFIG_OPTIONS)
    CIMSERVER_STOP_SERVICE = cimserver -stop
    SLEEP = mu sleep
    REMOVE_PEGASUS_DIRECTORY = mu rmdirhier pegasus
    MUEXE = mu.exe
    MKDIRHIER = $(MUEXE) mkdirhier
    RMDIRHIER = $(MUEXE) rmdirhier
    ECHO = mu echo
    ECHO-E = mu echo-e
    COPY = mu copy
    CHMOD =
    CHOWN =
    CHGRP =
endif

ifeq ($(OS),HPUX)
    STRIPCRS = 
    DIFF = diff
    REDIRECTERROR = 2>&1
    CIMSERVER_START_SERVICE = cimserver $(CIMSERVER_CONFIG_OPTIONS)
    CIMSERVER_STOP_SERVICE = cimserver -s
    SLEEP = sleep
    REMOVE_PEGASUS_DIRECTORY = rm -Rf pegasus.old; mv pegasus pegasus.old
    MUEXE = mu
    MKDIRHIER = mkdir -p
    RMDIRHIER = rm -rf
    CPDIRHIER = cp -R
    ECHO = echo
    ECHO-E = echo
    COPY = cp
    TOUCH = touch
    CAT = cat
    DOCXX = doc++

    GENERATE_RANDSEED = randseed
    OPENSSL_COMMAND = openssl
    GET_HOSTNAME = `hostname`

    ifeq ($(PEGASUS_PLATFORM), HPUX_PARISC_ACC)
        LIB_LINK_SUFFIX = .sl
    else
        LIB_LINK_SUFFIX = .so
    endif

    Pdr_xr_xr_x = 555
    P_rwxr_xr_x = 755
    P_r_xr__r__ = 744
    P_r__r__r__ = 444
    P_r________ = 400
    P_r_xr_xr_x = 555
    P_rw_r__r__ = 644
    CHMODDIRHIER = chmod -R

    INSTALL_USR = bin
    INSTALL_GRP = bin
    CIMSERVER_USR = root
    CIMSERVER_GRP = sys 
    CHMOD = chmod
    CHOWN = chown
    CHGRP = chgrp
    CHOWNDIRHIER = chown -R
    CHGRPDIRHIER = chgrp -R

    SYMBOLIC_LINK_CMD = ln -f -s
endif

ifeq ($(OS),solaris)
    STRIPCRS =
    DIFF = diff
    REDIRECTERROR = 2>&1
    CIMSERVER_START_SERVICE = cimserver $(CIMSERVER_CONFIG_OPTIONS)
    CIMSERVER_STOP_SERVICE = /usr/bin/ps -ef | /usr/bin/grep cimserver | /usr/bin/grep -v grep | /usr/bin/awk '{print "kill -9 "$$2 |"/usr/bin/ksh"}'
    SLEEP = sleep
    REMOVE_PEGASUS_DIRECTORY = rm -Rf pegasus.old; mv pegasus pegasus.old
    MUEXE = mu
    MKDIRHIER = mkdir -p
    RMDIRHIER = rm -rf
    ECHO = echo
    ECHO-E = mu echo-e 
    COPY = cp
    CHMOD =
    CHOWN =
    CHGRP =
endif

ifeq ($(OS),linux)
    STRIPCRS =
    DIFF = diff
    REDIRECTERROR = 2>&1
    CIMSERVER_START_SERVICE = cimserver $(CIMSERVER_CONFIG_OPTIONS)
    CIMSERVER_STOP_SERVICE = cimserver -s
    SLEEP = sleep
    REMOVE_PEGASUS_DIRECTORY = rm -Rf pegasus.old; mv pegasus pegasus.old
    MUEXE = mu
    MKDIRHIER = mkdir -p
    RMDIRHIER = rm -rf
    CPDIRHIER = cp -R
    ECHO = echo
    ECHO-E = echo -e
    COPY = cp
    TOUCH = touch
    CAT = cat
    DOCXX = doc++

    OPENSSL_COMMAND = openssl
    GET_HOSTNAME = `hostname`

    LIB_LINK_SUFFIX = .so

    Pdr_xr_xr_x = 555
    P_rwxr_xr_x = 755
    P_r_xr__r__ = 744
    P_r__r__r__ = 444
    P_r________ = 400
    P_r_xr_xr_x = 555
    P_rw_r__r__ = 644
    CHMODDIRHIER = chmod -R

    INSTALL_USR = root
    INSTALL_GRP = root
    CIMSERVER_USR = root
    CIMSERVER_GRP = root
    CHMOD = chmod
    CHOWN = chown
    CHGRP = chgrp
    CHOWNDIRHIER = chown -R
    CHGRPDIRHIER = chgrp -R

    SYMBOLIC_LINK_CMD = ln -f -s
endif

ifeq ($(OS),zos)
    STRIPCRS =
    DIFF = diff
    REDIRECTERROR =
    CIMSERVER_START_SERVICE = cimserver $(CIMSERVER_CONFIG_OPTIONS)
    CIMSERVER_STOP_SERVICE = cimserver -s
    SLEEP = sleep
    REMOVE_PEGASUS_DIRECTORY = rm -Rf pegasus.old; mv pegasus pegasus.old
    MUEXE = mu
    MKDIRHIER = mkdir -p
    RMDIRHIER = rm -rf
    ECHO =
    ECHO-E =
    COPY = cp
    CHMOD =
    CHOWN =
    CHGRP =
endif

ifeq ($(OS),VMS)
    STRIPCRS =
    DIFF = mu compare
    REDIRECTERROR =
    CIMSERVER_START_SERVICE = cimserver $(CIMSERVER_CONFIG_OPTIONS)
    CIMSERVER_STOP_SERVICE = cimserver -s
    SLEEP = wait
    REMOVE_PEGASUS_DIRECTORY = mu rmdirhier pegasus
    MUEXE = mu
    MKDIRHIER = $(MUEXE) mkdirhier
    RMDIRHIER = $(MUEXE) rmdirhier
    ECHO =
    ECHO-E =
    CHMOD =
    CHOWN =
    CHGRP =
endif

ifeq ($(OS),aix)
    STRIPCRS =
    DIFF = diff
    REDIRECTERROR =
    CIMSERVER_START_SERVICE = cimserver $(CIMSERVER_CONFIG_OPTIONS)
    CIMSERVER_STOP_SERVICE = cimserver -s
    SLEEP = sleep
    REMOVE_PEGASUS_DIRECTORY = rm -Rf pegasus.old; mv pegasus pegasus.old
    MUEXE = mu
    MKDIRHIER = mkdir -p
    RMDIRHIER = rm -rf
    ECHO = echo
    ECHO-E = 
    COPY = cp
    CHMOD =
    CHOWN =
    CHGRP =
endif

ifndef TMP_DIR
    ifdef PEGASUS_TMP
        TMP_DIR = $(subst \,/,$(PEGASUS_TMP))
    else
        TMP_DIR = .
    endif
endif

CMDSFORCE: 

cimstop: CMDSFORCE
	$(CIMSERVER_STOP_SERVICE)

cimstart: CMDSFORCE
	$(CIMSERVER_START_SERVICE)

sleep: CMDSFORCE
	$(SLEEP) $(TIME)

mkdirhier: CMDSFORCE
	$(MKDIRHIER) $(DIRNAME)

rmdirhier: CMDSFORCE
	$(RMDIRHIER) $(DIRNAME)

setpermissions: CMDSFORCE
	$(CHMOD) $(PERMISSIONS) $(OBJECT)
	$(CHOWN) $(OWNER) $(OBJECT) 
	$(CHGRP) $(GROUP) $(OBJECT) 

sethierpermissions: CMDSFORCE
	$(CHMODDIRHIER) $(PERMISSIONS) $(OBJECT)
	$(CHOWNDIRHIER) $(OWNER) $(OBJECT) 
	$(CHGRPDIRHIER) $(GROUP) $(OBJECT) 

createlink: CMDSFORCE
	$(SYMBOLIC_LINK_CMD) $(OBJECT) $(LINKNAME)

createrandomseed: CMDSFORCE
	$(GENERATE_RANDSEED) $(FILENAME)

# Because commands.mak is intended to be used as
# helper Makefile, embedded use of calls to "make" are
# problematic because the name of toplevel is not known.
# To workaround this problem, the MAKEOPTIONS define 
# has been added to the following commands to
# allow the name of the toplevel Makefile to be included. 
# E.g.,
#
# make MAKEOPTION="-f TestMakefile" cimstop_IgnoreError
#
# However, a better alternative would be to call the 
# the command directly from the toplevel makefile.
# E.g.,
#
# make -f TestMakefile -i cimstop

cimstop_IgnoreError: CMDSFORCE
	@$(MAKE) $(MAKEOPTIONS) -i cimstop

rmdirhier_IgnoreError: CMDSFORCE
	@$(MAKE) $(MAKEOPTIONS) -i rmdirhier

mkdirhier_IgnoreError: CMDSFORCE
	@$(MAKE) $(MAKEOPTIONS) -i mkdirhier


# The runTestSuite option starts the CIM Server
# with a designated set of configuration options (i.e.,
# CIMSERVER_CONFIG_OPTIONS) and then runs a specified
# set of tests (i.e., TESTSUITE_CMDS). After the tests
# have been executed, the CIM Server is stopped.
#
# To call runTestSuite, you simply (1) define the
# configuration options, (2) define the set of
# tests and (3) call commands.mak with the appropriate
# parameters.  Note: when specifying the set of tests
# @@ is used as a replacement for blank. E.g., the
# following sequence can be used to enable the
# HTTP connection, disable the HTTPS connection and
# run an osinfo, TestClient, OSTestClient,
# and InvokeMethod2 test.
#
#runTestSuiteTest_CONFIG_OPTIONS = enableHttpConnection=true enableHttpsConnection=false
#runTestSuiteTest_TEST_CMDS = \
#   osinfo@@-hlocalhost@@-p5988@@-uguest@@-wguest\
#   TestClient@@-local \
#   OSTestClient \
#   $(MAKE)@@--directory=$(PEGASUS_ROOT)/src/Pegasus/Client/tests/InvokeMethod2@@poststarttests
#
#runTestSuiteTest: CMDSFORCE
#	$(MAKE) $(MAKEOPTIONS) runTestSuite CIMSERVER_CONFIG_OPTIONS="$(runTestSuiteTest_CONFIG_OPTIONS)" TESTSUITE_CMDS="$(runTestSuiteTest_TEST_CMDS)"

runTestSuite: CMDSFORCE
	$(CIMSERVER_START_SERVICE)
	$(foreach i, $(TESTSUITE_CMDS), $(subst @@, ,$(i));)
	$(CIMSERVER_STOP_SERVICE)