Take Makefile improvements from anaconda.
[pykickstart.git] / Makefile
blobddf1cbf7f28322cdc45bfb29a8e6e21b5cfe8a5b
1 PKGNAME=pykickstart
2 VERSION=$(shell awk '/Version:/ { print $$2 }' $(PKGNAME).spec)
3 RELEASE=$(shell awk '/Release:/ { print $$2 }' $(PKGNAME).spec | sed -e 's|%.*$$||g')
4 TAG=r$(VERSION)-$(RELEASE)
6 MANDIR=/usr/share/man
7 PREFIX=/usr
9 PYCHECKEROPTS=--no-shadowbuiltin --no-argsused --no-miximport --maxargs 0 --no-local -\# 0 --only
11 default: all
13 all:
14 $(MAKE) -C po
16 docs:
17 curl -A "pykickstart-build" -o docs/kickstart-docs.txt "http://fedoraproject.org/wiki/Anaconda/Kickstart?action=raw"
19 check:
20 PYTHONPATH=. pychecker $(PYCHECKEROPTS) pykickstart/*.py pykickstart/commands/*.py pykickstart/handlers/*.py
22 clean:
23 -rm *.tar.gz pykickstart/*.pyc pykickstart/commands/*.pyc pykickstart/handlers/*.pyc docs/kickstart-docs.txt ChangeLog
24 $(MAKE) -C po clean
25 python setup.py -q clean --all
27 install: all
28 python setup.py install --root=$(DESTDIR)
29 $(MAKE) -C po install
31 ChangeLog:
32 (GIT_DIR=.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
34 tag:
35 git tag -a -m "Tag as $(TAG)" -f $(TAG)
36 @echo "Tagged as $(TAG)"
38 archive: tag docs
39 @rm -f ChangeLog
40 @make ChangeLog
41 git-archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ $(TAG) > $(PKGNAME)-$(VERSION).tar
42 mkdir -p $(PKGNAME)-$(VERSION)/docs/
43 cp docs/kickstart-docs.txt $(PKGNAME)-$(VERSION)/docs/
44 cp ChangeLog $(PKGNAME)-$(VERSION)/
45 tar -rf $(PKGNAME)-$(VERSION).tar $(PKGNAME)-$(VERSION)
46 gzip -9 $(PKGNAME)-$(VERSION).tar
47 rm -rf $(PKGNAME)-$(VERSION)
48 @echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
50 local: docs
51 @rm -f ChangeLog
52 @make ChangeLog
53 @rm -rf $(PKGNAME)-$(VERSION).tar.gz
54 @rm -rf /tmp/$(PKGNAME)-$(VERSION) /tmp/$(PKGNAME)
55 @dir=$$PWD; cp -a $$dir /tmp/$(PKGNAME)-$(VERSION)
56 @cd /tmp/$(PKGNAME)-$(VERSION) ; python setup.py -q sdist
57 @cp /tmp/$(PKGNAME)-$(VERSION)/dist/$(PKGNAME)-$(VERSION).tar.gz .
58 @rm -rf /tmp/$(PKGNAME)-$(VERSION)
59 @echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
61 rpmlog:
62 @git-log --pretty="format:- %s (%ae)" $(TAG).. |sed -e 's/@.*)/)/'
63 @echo
65 bumpver:
66 @NEWSUBVER=$$((`echo $(VERSION) |cut -d . -f 2` + 1)) ; \
67 NEWVERSION=`echo $(VERSION).$$NEWSUBVER |cut -d . -f 1,3` ; \
68 DATELINE="* `date "+%a %b %d %Y"` `git-config user.name` <`git-config user.email`> - $$NEWVERSION-1" ; \
69 cl=`grep -n %changelog pykickstart.spec |cut -d : -f 1` ; \
70 tail --lines=+$$(($$cl + 1)) pykickstart.spec > speclog ; \
71 (head -n $$cl pykickstart.spec ; echo "$$DATELINE" ; make --quiet rpmlog 2>/dev/null ; echo ""; cat speclog) > pykickstart.spec.new ; \
72 mv pykickstart.spec.new pykickstart.spec ; rm -f speclog ; \
73 sed -i "s/Version: $(VERSION)/Version: $$NEWVERSION/" pykickstart.spec ; \
74 sed -i "s/version='$(VERSION)'/version='$$NEWVERSION'/" setup.py
76 .PHONY: check clean install tag archive local docs