summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 9debb31c4753a2f7f306a49ef5ef84755c04f113 (plain)
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
###############################################################################
# Makefile for fedora-doc-common packaging
# Created by: Paul W. Frields <stickster@gmail.com>
# License: GPL
# Copyright 2005 Paul W. Frields
###############################################################################

DOCBASE = fedora-doc-common

######################################################
# Some packaging specific vars
DATE		= $(shell date +"%Y-%m-%d")
NOW 		= $(shell date +"%a %b %e %Y")
SPECIN		= ../docs-common/packaging/$(DOCBASE).spec
VERSION		= $(shell rpm -q --specfile --queryformat '%{version}\n' $(SPECIN))
RELEASE		= $(shell rpm -q --specfile --queryformat '%{release}\n' $(SPECIN))
DOCSPEC 	= $(shell rpm ${RPMFLAGS} --eval '%{_specdir}')/$(DOCBASE).spec
DOCSRCTAR 	= $(shell rpm ${RPMFLAGS} --eval '%{_sourcedir}')/$(DOCBASE)-$(VERSION).src.tar.gz
TITLE		= Fedora Documentation Project Shared Files
######################################################
# Some RPM flags...
######################################################
RPMFLAGS 	= 	--define "docbase $(DOCBASE)" \
			--define "_topdir $(PWD)/rpmbuild"

RPM		= rpm ${RPMFLAGS}
######################################################


clean:
	rm -rf $(DOCBASE)*.rpm
	rm -rf $(PWD)/rpmbuild

update: clean
	cvs update

rpm: update
#
# Make RPM-compliant tarball of source XML and other stuff
	mkdir $(DOCBASE)-$(VERSION)
	find . -maxdepth 1 -type d \( \
		-name 'bin' -o \
		-name 'common' -o \
		-name 'css' -o \
		-name 'images' -o \
		-name 'packaging' -o \
		-name 'stylesheet-images' -o \
		-name 'xsl' \) | xargs -i \
		find {} -maxdepth 1 -type f ! \( \
		-name '.*' -o -name '*~' -o \
		-name '*.svg' -o -name '*.eps' \) | \
		cpio -pamdv $(DOCBASE)-$(VERSION)
# include Makefile.common for use in offline FDP doc building
	cp Makefile.common $(DOCBASE)-$(VERSION)
#
# Make RPM build tree; don't rely on local user's setup
	mkdir -p rpmbuild/{BUILD,RPMS/noarch,SOURCES,SPECS,SRPMS}
	tar -zcvf $(DOCSRCTAR) $(DOCBASE)-$(VERSION)
	cp $(SPECIN) $(DOCSPEC)
	rm -rf $(DOCBASE)-$(VERSION)/
#FORGET THIS CRAP... replace with 'make clog' shortly
# Make rpmlint happy with a changelog entry
# FIXME: Maybe more magic would make this stickier; pity
#        I'm no magician...
#	sed 's/\(%changelog\)/\1\n* $(NOW) Fedora Docs Project <fedora-docs-list@redhat.com> - $(VERSION)-$(RELEASE)\n- Update to $(RELEASE)\n/' \
#		$(SPECIN) > $(DOCSPEC)
#
# Do the build...
#
	rpmbuild -bb $(RPMFLAGS) $(DOCSPEC)
	mv $(shell ${RPM} --eval '%{_rpmdir}')/noarch/*.rpm .
	rpmbuild --clean --rmsource $(RPMFLAGS) $(DOCSPEC)
	rm -rf $(shell ${RPM} --eval '%{_topdir}')