]>
Commit | Line | Data |
---|---|---|
2bd0ea18 | 1 | # |
36fda47f | 2 | # Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. |
2bd0ea18 NS |
3 | # |
4 | ||
5 | TOPDIR = ../.. | |
6 | TREEROOT = $(shell cd ${TOPDIR}; pwd) | |
7 | include $(TOPDIR)/include/builddefs | |
8 | ||
fc49813f | 9 | SPECF = $(PKG_NAME).spec |
36fda47f | 10 | LDIRT = *.rpm $(SPECF) rpmmacros rpmfiles* rpm-*.rc |
2bd0ea18 NS |
11 | |
12 | LSRCFILES = macros.template $(SPECF).in rpm-2.rc.template | |
13 | ||
36fda47f | 14 | default install install-dev install-lib: |
2bd0ea18 NS |
15 | |
16 | include $(BUILDRULES) | |
17 | ||
36fda47f | 18 | # Generate a binary rpm file |
2bd0ea18 | 19 | dist : default $(SPECF) rpm-$(RPM_VERSION).rc |
41a1923d | 20 | $(RPMBUILD) -ba --rcfile ./rpm-$(RPM_VERSION).rc $(SPECF) |
2bd0ea18 NS |
21 | |
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 | |
d766b6aa | 24 | ifneq ($(RPM_VERSION),2) |
2bd0ea18 | 25 | rpm-$(RPM_VERSION).rc : rpmmacros |
16c44ed2 | 26 | @$(SED) -e '/^macrofiles:/s|~/.rpmmacros|rpmmacros|' </usr/lib/rpm/rpmrc >$@ |
2bd0ea18 NS |
27 | |
28 | rpmmacros : macros.template | |
16c44ed2 | 29 | @$(SED) -e 's|%topdir%|$(TREEROOT)|g' < $< > $@ |
2bd0ea18 NS |
30 | else |
31 | rpm-2.rc: rpm-2.rc.template | |
16c44ed2 | 32 | @$(SED) -e 's|%topdir%|$(TOPDIR)|g' < $< > $@ |
2bd0ea18 NS |
33 | endif |
34 | ||
36fda47f NS |
35 | # Generate the rpm specfile format file list from the install-sh manifest |
36 | rpmfiles rpmfiles-dev rpmfiles-lib: | |
16c44ed2 | 37 | $(SORT) -u $$DIST_MANIFEST | $(AWK) > $@ '\ |
36fda47f NS |
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); \ | |
44 | else \ | |
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); \ | |
51 | else \ | |
52 | printf ("%%%%attr(0777,root,root) %s\n", $$3); }' | |
53 | ||
2bd0ea18 NS |
54 | .PHONY: $(SPECF) |
55 | ${SPECF} : ${SPECF}.in | |
16c44ed2 | 56 | $(SED) -e's|@pkg_name@|$(PKG_NAME)|g' \ |
fc49813f NS |
57 | -e's|@pkg_version@|$(PKG_VERSION)|g' \ |
58 | -e's|@pkg_release@|$(PKG_RELEASE)|g' \ | |
59 | -e's|@pkg_distribution@|$(PKG_DISTRIBUTION)|g' \ | |
2bd0ea18 NS |
60 | -e's|@build_root@|$(DIST_ROOT)|g' \ |
61 | -e'/^BuildRoot: *$$/d' \ | |
2bd0ea18 | 62 | -e's|@make@|$(MAKE)|g' < $< > $@ |