2 # Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
6 TREEROOT = $(shell cd ${TOPDIR}; pwd)
7 include $(TOPDIR)/include/builddefs
9 SPECF = $(PKG_NAME).spec
10 LDIRT = *.rpm $(SPECF) rpmmacros rpmfiles* rpm-*.rc
12 LSRCFILES = macros.template $(SPECF).in rpm-2.rc.template
14 default install install-dev install-lib:
18 # Generate a binary rpm file
19 dist : default $(SPECF) rpm-$(RPM_VERSION).rc
20 $(RPMBUILD) -ba --rcfile ./rpm-$(RPM_VERSION).rc $(SPECF)
22 # Because rpm prior to v.2.90 does not support macros and old style config
23 # is not supported by rpm v.3, we have to resort to such ugly hacks
24 ifneq ($(RPM_VERSION),2)
25 rpm-$(RPM_VERSION).rc : rpmmacros
26 @$(SED) -e '/^macrofiles:/s|~/.rpmmacros|rpmmacros|' </usr/lib/rpm/rpmrc >$@
28 rpmmacros : macros.template
29 @$(SED) -e 's|%topdir%|$(TREEROOT)|g' < $< > $@
31 rpm-2.rc: rpm-2.rc.template
32 @$(SED) -e 's|%topdir%|$(TOPDIR)|g' < $< > $@
35 # Generate the rpm specfile format file list from the install-sh manifest
36 rpmfiles rpmfiles-dev rpmfiles-lib:
37 $(SORT) -u $$DIST_MANIFEST | $(AWK) > $@ '\
38 $$1 == "d" { printf ("%%%%dir %%%%attr(%s,%s,%s) %s\n", $$2, $$3, $$4, $$5); } \
39 $$1 == "f" { if (match ($$6, "$(PKG_MAN_DIR)") || \
40 match ($$6, "$(PKG_DOC_DIR)")) \
41 printf ("%%%%doc "); \
42 if (match ($$6, "$(PKG_MAN_DIR)")) \
43 printf ("%%%%attr(%s,%s,%s) %s*\n", $$2, $$3, $$4, $$6); \
45 printf ("%%%%attr(%s,%s,%s) %s\n", $$2, $$3, $$4, $$6); } \
46 $$1 == "l" { if (match ($$3, "$(PKG_MAN_DIR)") || \
47 match ($$3, "$(PKG_DOC_DIR)")) \
48 printf ("%%%%doc "); \
49 if (match ($$3, "$(PKG_MAN_DIR)")) \
50 printf ("%%%%attr(0777,root,root) %s*\n", $$3); \
52 printf ("%%%%attr(0777,root,root) %s\n", $$3); }'
55 ${SPECF} : ${SPECF}.in
56 $(SED) -e's|@pkg_name@|$(PKG_NAME)|g' \
57 -e's|@pkg_version@|$(PKG_VERSION)|g' \
58 -e's|@pkg_release@|$(PKG_RELEASE)|g' \
59 -e's|@pkg_distribution@|$(PKG_DISTRIBUTION)|g' \
60 -e's|@build_root@|$(DIST_ROOT)|g' \
61 -e'/^BuildRoot: *$$/d' \
62 -e's|@make@|$(MAKE)|g' < $< > $@