2 # Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 TREEROOT = $(shell cd ${TOPDIR}; pwd)
21 include $(TOPDIR)/include/builddefs
23 SPECF = $(PKG_NAME).spec
24 LDIRT = *.rpm $(SPECF) rpmmacros rpmfiles* rpm-*.rc
26 LSRCFILES = macros.template $(SPECF).in rpm-2.rc.template
28 default install install-dev install-lib:
32 # Generate a binary rpm file
33 dist : default $(SPECF) rpm-$(RPM_VERSION).rc
34 $(RPMBUILD) -ba --rcfile ./rpm-$(RPM_VERSION).rc $(SPECF)
36 # Because rpm prior to v.2.90 does not support macros and old style config
37 # is not supported by rpm v.3, we have to resort to such ugly hacks
38 ifneq ($(RPM_VERSION),2)
39 rpm-$(RPM_VERSION).rc : rpmmacros
40 @$(SED) -e '/^macrofiles:/s|~/.rpmmacros|rpmmacros|' </usr/lib/rpm/rpmrc >$@
42 rpmmacros : macros.template
43 @$(SED) -e 's|%topdir%|$(TREEROOT)|g' < $< > $@
45 rpm-2.rc: rpm-2.rc.template
46 @$(SED) -e 's|%topdir%|$(TOPDIR)|g' < $< > $@
49 # Generate the rpm specfile format file list from the install-sh manifest
50 rpmfiles rpmfiles-dev rpmfiles-lib:
51 $(SORT) -u $$DIST_MANIFEST | $(AWK) > $@ '\
52 $$1 == "d" { printf ("%%%%dir %%%%attr(%s,%s,%s) %s\n", $$2, $$3, $$4, $$5); } \
53 $$1 == "f" { if (match ($$6, "$(PKG_MAN_DIR)") || \
54 match ($$6, "$(PKG_DOC_DIR)")) \
55 printf ("%%%%doc "); \
56 if (match ($$6, "$(PKG_MAN_DIR)")) \
57 printf ("%%%%attr(%s,%s,%s) %s*\n", $$2, $$3, $$4, $$6); \
59 printf ("%%%%attr(%s,%s,%s) %s\n", $$2, $$3, $$4, $$6); } \
60 $$1 == "l" { if (match ($$3, "$(PKG_MAN_DIR)") || \
61 match ($$3, "$(PKG_DOC_DIR)")) \
62 printf ("%%%%doc "); \
63 if (match ($$3, "$(PKG_MAN_DIR)")) \
64 printf ("%%%%attr(0777,root,root) %s*\n", $$3); \
66 printf ("%%%%attr(0777,root,root) %s\n", $$3); }'
69 ${SPECF} : ${SPECF}.in
70 $(SED) -e's|@pkg_name@|$(PKG_NAME)|g' \
71 -e's|@pkg_version@|$(PKG_VERSION)|g' \
72 -e's|@pkg_release@|$(PKG_RELEASE)|g' \
73 -e's|@pkg_distribution@|$(PKG_DISTRIBUTION)|g' \
74 -e's|@build_root@|$(DIST_ROOT)|g' \
75 -e'/^BuildRoot: *$$/d' \
76 -e's|@make@|$(MAKE)|g' < $< > $@