45f3e862710c0fa415944c22c2505d8d7047d18e
[certmaster.git] / Makefile
1 VERSION = $(shell echo `awk '{ print $$1 }' version`)
2 RELEASE = $(shell echo `awk '{ print $$2 }' version`)
3 NEWRELEASE = $(shell echo $$(($(RELEASE) + 1)))
4
5 MESSAGESPOT=po/messages.pot
6
7 TOPDIR = $(shell pwd)
8 DIRS = certmaster docs scripts
9 PYDIRS = certmaster scripts
10 EXAMPLEDIR = examples
11 INITDIR = init-scripts
12
13 all: rpms
14
15
16 manpage:
17 pod2man --center="certmaster-request" --release="" ./docs/certmaster-request.pod | gzip -c > ./docs/certmaster-request.1.gz
18 pod2man --center="certmaster" --release="" ./docs/certmaster.pod | gzip -c > ./docs/certmaster.1.gz
19 pod2man --center="certmaster-ca" --release="" ./docs/certmaster-ca.pod | gzip -c > ./docs/certmaster-ca.1.gz
20
21 messages: certmaster/*.py
22 touch $(MESSAGESPOT)
23 xgettext -k_ -kN_ -o $(MESSAGESPOT) certmaster/*.py
24 sed -i'~' -e 's/SOME DESCRIPTIVE TITLE/certmaster/g' -e 's/YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER/2007 Red Hat, inc. /g' -e 's/FIRST AUTHOR <EMAIL@ADDRESS>, YEAR/Adrian Likins <alikins@redhat.com>, 2007/g' -e 's/PACKAGE VERSION/certmaster $(VERSION)-$(RELEASE)/g' -e 's/PACKAGE/certmaster/g' $(MESSAGESPOT)
25
26
27 bumprelease:
28 -echo "$(VERSION) $(NEWRELEASE)" > version
29
30 setversion:
31 -echo "$(VERSION) $(RELEASE)" > version
32
33 build: clean
34 python setup.py build -f
35
36 clean:
37 -rm -f MANIFEST
38 -rm -rf dist/ build/
39 -rm -rf *~
40 -rm -rf rpm-build/
41 -rm -rf docs/*.gz
42 -for d in $(DIRS); do ($(MAKE) -C $$d clean ); done
43
44 clean_hard:
45 -rm -rf $(shell python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")/certmaster
46
47 clean_harder:
48 -rm -rf /etc/pki/certmaster
49 -rm -rf /etc/certmaster
50 -rm -rf /var/lib/certmaster
51
52 clean_hardest: clean_rpms
53
54
55 install: build manpage
56 python setup.py install -f
57
58 install_hard: clean_hard install
59
60 install_harder: clean_harder install
61
62 install_hardest: clean_harder clean_rpms rpms install_rpm restart
63
64 install_rpm:
65 -rpm -Uvh rpm-build/certmaster-$(VERSION)-$(RELEASE)$(shell rpm -E "%{?dist}").noarch.rpm
66
67 restart:
68 -/etc/init.d/certmaster restart
69
70 recombuild: install_harder restart
71
72 clean_rpms:
73 -rpm -e certmaster
74
75 sdist: messages
76 python setup.py sdist
77
78 new-rpms: bumprelease rpms
79
80 pychecker:
81 -for d in $(PYDIRS); do ($(MAKE) -C $$d pychecker ); done
82 pyflakes:
83 -for d in $(PYDIRS); do ($(MAKE) -C $$d pyflakes ); done
84
85 money: clean
86 -sloccount --addlang "makefile" $(TOPDIR) $(PYDIRS) $(EXAMPLEDIR) $(INITDIR)
87
88 async: install
89 /sbin/service certmaster restart
90 sleep 4
91
92 rpms: build manpage sdist
93 mkdir -p rpm-build
94 cp dist/*.gz rpm-build/
95 cp version rpm-build/
96 rpmbuild --define "_topdir %(pwd)/rpm-build" \
97 --define "_builddir %{_topdir}" \
98 --define "_rpmdir %{_topdir}" \
99 --define "_srcrpmdir %{_topdir}" \
100 --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
101 --define "_specdir %{_topdir}" \
102 --define "_sourcedir %{_topdir}" \
103 -ba certmaster.spec