-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathMakefile.devel
289 lines (240 loc) · 9.78 KB
/
Makefile.devel
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
#!/bin/sh
## Written by Michael Bell for the OpenCA project 2004
## (C) Copyright 2004 The OpenCA Project. All rights reserved.
## Same license like complete OpenCA distribution
## $Revision: 1.33 $
## This file is for developers and package maintainers only.
## It demonstrates how to generate all the necessary files
## before you can compile OpenCA if you have some problems
## with the results of our autotool versions.
## This file is also used to create releases and snapshots.
## hack for Debian because behaviour under SuSE is different
## looks like there was a change in GNU make
## MAKEFILE = $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
MAKEFILE = Makefile.devel
TOP = .
include $(TOP)/Makefile.global-vars
default: help
info help:
@echo "force-auto-files enforce the generation of all autotool files"
@echo "auto-files generate all nonexisting or outdated autotool files"
@echo "dist generate distribution"
@echo "rpm generate distribution rpm"
@echo "snap generate snapshot"
@echo "clean cleanup files"
########################################################
## BEGIN AUTOTOOL STUFF ##
########################################################
## we always do a complete run of the autotools to avoid
## version problems with the different autotools
## enforce a new generation
force-auto-files:
make -f $(MAKEFILE) auto-root
make -f $(MAKEFILE) clean
# make -f $(MAKEFILE) auto-scep
# make -f $(MAKEFILE) auto-openca-sv
## files and their dependiencies
auto-files: configure \
# src/scep/configure src/scep/Makefile.in src/scep/src/Makefile.in \
# src/openca-sv/configure src/openca-sv/Makefile.in src/openca-sv/src/Makefile.in
configure: configure.in
make -f $(MAKEFILE) auto-root
# src/scep/configure: src/scep/configure.in
# make -f $(MAKEFILE) auto-scep
# src/scep/Makefile.in: src/scep/Makefile.am
# make -f $(MAKEFILE) auto-scep
# src/scep/src/Makefile.in: src/scep/src/Makefile.am
# make -f $(MAKEFILE) auto-scep
# src/openca-sv/configure: src/openca-sv/configure.in
# make -f $(MAKEFILE) auto-openca-sv
# src/openca-sv/Makefile.in: src/openca-sv/Makefile.am
# make -f $(MAKEFILE) auto-openca-sv
# src/openca-sv/src/Makefile.in: src/openca-sv/src/Makefile.am
# make -f $(MAKEFILE) auto-openca-sv
## autotool runs
auto-root:
@rm -f configure || echo configure already removed
aclocal ##Pick up any changed autoconf macros
autoconf
# auto-scep:
# make -f $(MAKEFILE) auto-clean SUBTARGET=src/scep
# cd src/scep; aclocal -I . -I build
# cd src/scep; libtoolize --automake --copy --force
# cd src/scep; automake --add-missing --copy --gnu
# cd src/scep; autoconf
# cp src/scep/build/install-sh src/scep
# cp src/scep/build/install-sh .
# auto-openca-sv:
# make -f $(MAKEFILE) auto-clean SUBTARGET=src/openca-sv
# cd src/openca-sv; aclocal -I . -I build
# cd src/openca-sv; libtoolize --automake --copy --force
# cd src/openca-sv; automake --add-missing --copy --gnu
# cd src/openca-sv; autoconf
# cp src/openca-sv/build/install-sh src/openca-sv
auto-clean:
@cd $(SUBTARGET); \
rm aclocal.m4 -f || echo aclocal.m4 already removed; \
rm configure -f || echo configure already removed; \
rm install-sh -f || echo install-sh already removed; \
rm libtool -f || echo libtool already removed
@cd $(SUBTARGET)/build; \
rm aclocal.m4* -f || echo ac_locals already removed; \
rm acx_* -f || echo acx_* files already removed; \
rm compile -f || echo compile already removed; \
rm config.guess -f || echo config.guess already removed; \
rm config.sub -f || echo config.sub already removed; \
rm depcomp -f || echo depcomp already removed; \
rm install-sh -f || echo install-sh already removed; \
rm ltmain.sh -f || echo ltmain.sh already removed; \
rm missing -f || echo missing already removed; \
rm mkinstalldirs -f|| echo mkinstalldirs already removed; \
rm ylwrap -f || echo ylwrap already removed
make -f $(MAKEFILE) clean-autom4te SUBTARGET=$(SUBTARGET)
clean:
make -f $(MAKEFILE) clean-autom4te SUBTARGET=.
make -f $(MAKEFILE) clean-autom4te SUBTARGET=src/ocspd
make -f $(MAKEFILE) clean-autom4te SUBTARGET=src/openca-sv
make -f $(MAKEFILE) clean-autom4te SUBTARGET=src/scep
clean-autom4te:
# rm $(SUBTARGET)/autom4te.cache/output.0
# rm $(SUBTARGET)/autom4te.cache/requests
# rm $(SUBTARGET)/autom4te.cache/traces.0
# rmdir $(SUBTARGET)/autom4te.cache
rm -rf $(SUBTARGET)/autom4te.cache
########################################################
## END AUTOTOOL STUFF ##
########################################################
########################################################
## BEGIN RELEASE STUFF ##
########################################################
########################## BINARY DISTRO STUFF ###########################
MAKEFILE=Makefile
TODAY=`date +%Y%m%d`
TODAY = `/bin/date +%Y%m%d`
VERSION = `cat VERSION | sed -e s/-[0-9a-zA-Z-]*//`
MINOR = "1"
RC = $(MINOR)
PKGNAME = "openca-base"
TARGET_DIR = "/tmp/build-$(PKGNAME)-$(VERSION)"
# IB_OUTPUT=`find $(HOME)/installbuilder* -name output`
dist:
make -f $(MAKEFILE) source VERSION=$(VERSION)
snap:
make -f $(MAKEFILE) source VERSION=SNAP-$(TODAY)
source:
@echo
@echo "Cleaning up sources if necessary $(PKGNAME)-$(VERSION) ... "
@if [ -e $(PKGNAME)-$(VERSION).tar.gz ]; then \
rm $(PKGNAME)-*$(VERSION).tar.gz; \
fi ; \
touch tmp.po~; FILES=`find . -name "*.po~" -print`; rm $$FILES ; \
echo "done."
@echo -n "Creating GZIP TAR archive $(PKGNAME)-$(VERSION).tar.gz ... " ; \
mkdir -p /tmp/$(PKGNAME)-source/$(PKGNAME)-$(VERSION) ; \
tar cpf - * | tar xf - -C /tmp/$(PKGNAME)-source/$(PKGNAME)-$(VERSION) ; \
( \
cd /tmp/$(PKGNAME)-source/$(PKGNAME)-$(VERSION) ; \
make -f Makefile distclean ; \
) ; \
( \
cd /tmp/$(PKGNAME)-source ; \
tar cpf $(PKGNAME)-$(VERSION).tar --exclude "CVS" $(PKGNAME)-$(VERSION); \
gzip $(PKGNAME)-$(VERSION).tar; \
) ; \
mv /tmp/$(PKGNAME)-source/$(PKGNAME)-$(VERSION).tar.gz . ; \
rm -rf /tmp/$(PKGNAME)-source/ ; \
echo "done."
@echo
rpm: rpmbuild
rpmbuild:
@echo
@echo -n "Cleaning up old RPMs ... "
@for i in $(PKGNAME)*.rpm ; do \
rm -f $$i ; \
done
@echo "Done."
@echo -n "Creating spec file ... " ; \
filename=OpenCA.spec.orig ; \
if [ -e "contrib/$$filename" ] ; then \
echo "($$filename)"; \
cat "contrib/$$filename" | \
sed -e "s|@VERSION@|$(VERSION)|g" | \
sed -e "s|@RC@|$(RC)|g" | \
sed -e "s|@PKGNAME@|$(PKGNAME)|g" | \
sed -e "s|@build_root@|$(TARGET_DIR)|g" | \
sed -e "s|@openca_user@|$(openca_user)|g" | \
sed -e "s|@openca_group@|$(openca_group)|g" | \
sed -e "s|@httpd_user@|$(httpd_user)|g" | \
sed -e "s|@httpd_group@|$(httpd_group)|g" | \
sed -e "s|@httpd_fs_prefix@|$(httpd_fs_prefix)|g" | \
sed -e "s|@BUILDROOT@|$(TARGET_DIR)|g" > \
"contrib/OpenCA.spec" ; \
else \
echo "contrib/$$filename ... not found" ; \
exit 1 ; \
fi ; \
make -s -f $(MAKEFILE) source VERSION=$(VERSION) ; \
echo "Building RPM package(s)... " ; \
topdir="/tmp/rpmbuild" ; \
[ -d "$$topdir" ] && sudo rm -rf "$$topdir" ; \
sudo rpmbuild --define "_topdir $$topdir" -ta "$(PKGNAME)-$(VERSION).tar.gz" ; \
sudo mv $$topdir/RPMS/*/$(PKGNAME)*.rpm . ; \
sudo mv $$topdir/SRPMS/$(PKGNAME)*.src.rpm . ; \
echo
# if [ -d "/usr/src/redhat/BUILD" ] ; then \
# sudo rm -rf /usr/src/redhat/BUILD/$(PKGNAME)* ; \
# fi; \
# if [ -d "$(HOME)/rpmbuild" ] ; then \
# sudo rm -rf "$(HOME)/rpmbuild/BUILD/$(PKGNAME)*" ; \
# fi ; \
# sudo mv /usr/src/redhat/RPMS/*/$(PKGNAME)*.rpm . 2>/dev/null || \
# sudo mv $(HOME)/tmp/rpm/RPMS/*/$(PKGNAME)*.rpm . 2>/dev/null || \
# sudo mv $(HOME)/rpmbuild/RPMS/*/$(PKGNAME)*.rpm . 2>/dev/null ; \
# sudo mv /usr/src/redhat/SRPMS/$(PKGNAME)*.src.rpm . 2>/dev/null || \
# sudo mv $(HOME)/tmp/rpm/SRPMS/$(PKGNAME)*.src.rpm . 2>/dev/null || \
# sudo mv $(HOME)/rpmbuild/SRPMS/$(PKGNAME)*.src.rpm . 2>/dev/null ; \
# echo
pkgconfig-old:
@echo "IBOUT=$(IB_OUTPUT)"
@if [ "$(DIST_NAME)" = "darwin" ] ; then \
rm -rf $(PKGNAME)-*.app ; \
$(INSTALL_BUILDER) build contrib/$(PKGNAME)*.xml && \
$(SHELL) -c "cp -r "$(IB_OUTPUT)/$(PKGNAME)-*" ." ; \
o=`find . -name $(PKGNAME)-*.app` ; \
zip -rq "$$o.zip" "$$o" && rm -rf "$$o" ; \
rm -r $(IB_OUTPUT)/$$o ; \
else \
sudo $(INSTALL_BUILDER) build contrib/install-builder/$(PKGNAME).xml && \
$(SHELL) -c "cp -r "$(IB_OUTPUT)/$(PKGNAME)-*" ." ; \
$(SHELL) -c "rm -f $(IB_OUTPUT)/$(PKGNAME)-*" ; \
fi
bin pkgbuild:
@sudo rm -rf "$(TARGET_DIR)" ; \
./configure --prefix=/opt/openca --with-build-dir="$(TARGET_DIR)" ; \
$(MAKE) -f Makefile ; \
sudo DESTDIR="$(TARGET_DIR)" $(MAKE) -f Makefile install-offline install-online ; \
sudo $(MAKE) -f Makefile pkgconfig
pkgconfig:
@if [ "$(DIST_NAME)" = "darwin" ] ; then \
IB_OUTPUT=`find $(HOME)/installbuilder*/ -maxdepth 1 -name output` ; \
rm -rf $(PACKAGE_NAME)-*.app ; \
$(INSTALL_BUILDER) build contrib/install-builder/$(PKGNAME)*.xml && \
hdiutil create -srcfolder "$$IB_OUTPUT" \
-volname "$(PACKAGE_NAME) v$(VERSION) Install" \
"$(PACKAGE_NAME)-$(VERSION)-$(RC)-osx-$(ARCH_TARGET).dmg" ; \
rm -r $$IB_OUTPUT/$(PACKAGE_NAME)-*.app ; \
else \
ret=`echo ${build_os} | grep 'solaris'`; \
if [ $$? -eq 0 ] ; then \
IB_OUTPUT=`find $(MY_HOME)/installbuilder*/* -name output` ; \
else \
IB_OUTPUT=`find $(MY_HOME)/installbuilder*/ -maxdepth 1 -name output` ; \
fi ; \
sudo $(INSTALL_BUILDER) build contrib/install-builder/$(PKGNAME)*.xml && \
$(SHELL) -c "cp -r $$IB_OUTPUT/$(PACKAGE_NAME)-* ." ; \
$(SHELL) -c "sudo rm -f $$IB_OUTPUT/$(PACKAGE_NAME)-*" ; \
fi
########################################################
########################################################
## END RELEASE STUFF ##
########################################################