1 w.otsuka 1.1.2.2 #//%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 w.otsuka 1.1.2.2 #// 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 ###############################################################################
32 ##
33 ## RPM Makefile for building tog-pegasus rpms
34 ##
35 ## see the usage rule for documentation of rules etc.
36 ##
37 ##
38 ###############################################################################
39
40
41 RELEASE:=$(shell lsb_release -r -s)
42 IDISTRO:=$(shell lsb_release -i -s)
43 w.otsuka 1.1.2.2 PLATFORM:=$(shell /bin/rpm --eval %_target_cpu)
44 BRANCH:=$(PEGASUS_BUILD_BRANCH)
45 RPM:=rpm
46 RPMBUILD:=rpmbuild
47 RM:=rm
48 MV:=mv
49 CP:=cp
50 GREP:=grep
51 ECHO:=echo
52 TOG_INSTALLED_RPMS:=$(shell $(RPM) -qa|grep tog-pegasus)
53 REMOVE_PEGASUS_DIRECTORY:=$(RM) -Rf pegasus.old; $(MV) pegasus pegasus.old
54
55 ifndef PEGASUS_SRC_RELEASE
56 PEGASUS_SRC_RELEASE:=1
57 endif
58
59 ifdef PEGASUS_BUILD_BRANCH
60 ifeq ($(PEGASUS_BUILD_BRANCH),MAIN)
61 PEGASUS_RPM_CVS_TAG:=HEAD
62 else
63 PEGASUS_RPM_CVS_TAG:=$(PEGASUS_BUILD_BRANCH)
64 w.otsuka 1.1.2.2 endif
65 else
66 PEGASUS_RPM_CVS_TAG:=HEAD
67 endif
68
69 ifeq ($(IDISTRO),RedHatEnterpriseServer)
70 DISTRO:=REDHAT
71 export PEGASUS_DISTRO_SUFFIX:=$(if $(filter $(RELEASE),4.92 4.93 5),el5,\
72 xxx)
73 else
74 ifeq ($(findstring RedHat,$(IDISTRO)),RedHat)
75 DISTRO:=REDHAT
76 ifeq ($(RELEASE),4)
77 export PEGASUS_DISTRO_SUFFIX=rhel4
78 else
79 ifeq ($(RELEASE),3)
80 export PEGASUS_DISTRO_SUFFIX=rhel3
81 else
82 export PEGASUS_DISTRO_SUFFIX=xxx
83 endif
84 endif
85 w.otsuka 1.1.2.2 else
86 ifeq ($(findstring SUSE,$(IDISTRO)),SUSE)
87 DISTRO:=SUSE
88 ifeq ($(RELEASE),9)
89 export PEGASUS_DISTRO_SUFFIX=sles9
90 else
91 ifeq ($(RELEASE),10)
92 export PEGASUS_DISTRO_SUFFIX=sles10
93 else
94 export PEGASUS_DISTRO_SUFFIX=xxx
95 endif
96 endif
97 endif
98 endif
99 endif
100
101 ###############################################################################
102 #
103 # The user may set PEGASUS_RPM_DIRECTORY to the path of their rpm build target.
104 # The source tar file will then be in
105 # PEGASUS_RPM_DIRECTORY/SOURCES/tog-pegasus.
106 w.otsuka 1.1.2.2 # If PEGASUS_RPM_DIRECTORY is not defined the rpm build target path will be
107 # defaulted to the well-known locations on redhat and suse systems.
108 #
109 ###############################################################################
110 ifndef PEGASUS_RPM_DIRECTORY
111 ifeq ($(DISTRO),REDHAT)
112 PEGASUS_RPM_DIRECTORY:=/usr/src/redhat
113 else
114 ifeq ($(DISTRO),SUSE)
115 PEGASUS_RPM_DIRECTORY:=/usr/src/packages
116 endif
117 endif
118 TOG_PEGASUS_DIR:=""
119 else
120 TOG_PEGASUS_DIR:=tog-pegasus
121 endif
122
123 VERSION:=$(PEGASUS_RPM_VERSION)-$(PEGASUS_SRC_RELEASE)
124 CORE_RPM:=tog-pegasus-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
125 SDK_RPM:=tog-pegasus-devel-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
126 TEST_RPM:=tog-pegasus-test-$(VERSION).$(PEGASUS_DISTRO_SUFFIX).$(PLATFORM).rpm
127 w.otsuka 1.1.2.2 SRC_RPM:=tog-pegasus-$(VERSION).src.rpm
128
129 USAGE = @$(ECHO) $(1)
130
131 usage:
132 $(USAGE)
133 $(USAGE)"RPMMakefile targets:"
134 $(USAGE)""
135 $(USAGE)"exportSRC - cvs export of pegasus"
136 $(USAGE)"createSRCRPM - creates source rpm"
137 $(USAGE)"createBINRPM - creates binary rpms including the test"
138 $(USAGE)" rpm from the source rpm"
139 $(USAGE)"buildRPM - createSRCRPM createBINRPM"
140 $(USAGE)"buildall - exportSRC buildRPM"
141 $(USAGE)"list - list the installed pegasus rpms"
142 $(USAGE)"clean - cleans build and target directories"
143 $(USAGE)""
144 $(USAGE)"Input variables:"
145 $(USAGE)"PEGASUS_BUILD_BRANCH - pegasus branch to build"
146 $(USAGE)" HEAD is used if MAIN is specified"
147 $(USAGE)"PEGASUS_RPM_VERSION - pegasus release version (Required)"
148 w.otsuka 1.1.2.2 $(USAGE)"PEGASUS_SRC_RELEASE - pegasus source release number"
149 $(USAGE)" defaults to 1 if not specified"
150 $(USAGE)"PEGASUS_RPM_DIRECTORY- path to target binary rpm directory"
151 $(USAGE)" if it is not defined"
152 $(USAGE)" defaults to /usr/src/redhat"
153 $(USAGE)" for Red Hat distributions"
154 $(USAGE)" defaults to /usr/src/packages"
155 $(USAGE)" for SUSE distributions"
156 $(USAGE)""
157
158 exportSRC:
159 @cvs -d:pserver:anon@cvs.opengroup.org:/cvs/MSB export -r $(PEGASUS_RPM_CVS_TAG) pegasus
160
161 createSRCRPM:
162
163 ifndef PEGASUS_RPM_VERSION
164 @$(ECHO) "PEGASUS_RPM_VERSION is not defined"
165 @exit 2
166 endif
167 @$(MV) pegasus tog-pegasus-$(PEGASUS_RPM_VERSION)
168 @$(CP) tog-pegasus-$(PEGASUS_RPM_VERSION)/rpm/tog-pegasus.spec $(PEGASUS_RPM_DIRECTORY)/SPECS
169 w.otsuka 1.1.2.2 @tar czf tog-pegasus-$(VERSION).tar.gz tog-pegasus-$(PEGASUS_RPM_VERSION)
170 @$(CP) tog-pegasus-$(VERSION).tar.gz $(PEGASUS_RPM_DIRECTORY)/SOURCES/$(TOG_PEGASUS_DIR)
171 @$(RPMBUILD) -bs $(PEGASUS_RPM_DIRECTORY)/SPECS/tog-pegasus.spec
172
173 createBINRPM:
174 @$(RPM) -i $(PEGASUS_RPM_DIRECTORY)/SRPMS/$(SRC_RPM)
175 @$(RPMBUILD) -bb --define 'LINUX_VERSION $(PEGASUS_DISTRO_SUFFIX)' --define 'PEGASUS_BUILD_TEST_RPM 1' $(PEGASUS_RPM_DIRECTORY)/SPECS/tog-pegasus.spec
176
177 buildRPM: createSRCRPM createBINRPM
178
179 buildall: exportSRC buildRPM
180
181 list:
182 @$(RPM) -qa|$(GREP) tog-pegasus
183
184 clean:
185 -$(RPM) -e $(filter tog-pegasus-test%,$(TOG_INSTALLED_RPMS))
186 -$(RPM) -e $(filter tog-pegasus-devel%,$(TOG_INSTALLED_RPMS))
187 -$(RPM) -e $(filter tog-pegasus-2%,$(TOG_INSTALLED_RPMS))
188 -$(RM) -rf $(PEGASUS_RPM_DIRECTORY)/BUILD/tog-pegasus-$(VERSION)
189 -$(REMOVE_PEGASUS_DIRECTORY)
190 w.otsuka 1.1.2.2 -$(RM) -rf pegasus tog-pegasus-*
191 -$(RM) -rf /var/tmp/tog-pegasus-*
192
|