aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: dabfa2d0f1c0d998f01ffd4dcb68e20473e32caa (plain) (blame)
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
#
# Makefile for sos system support tools
#

NAME	= sos
VERSION = $(shell echo `awk '/^Version:/ {print $$2}' sos.spec`)
RELEASE = $(shell echo `awk '/^Release:/ {gsub(/\%.*/,""); print $2}' sos.spec`)
REPO = http://svn.fedorahosted.org/svn/sos
TMPDIR = /tmp/$(NAME)-$(VERSION)

SUBDIRS = po sos sos/plugins gpgkeys extras doc doc/_build/html doc/_build/html/_sources doc/_build/html/_static
PYFILES = $(wildcard *.py)

all: subdirs

subdirs:
	for d in $(SUBDIRS); do make -C $$d; [$$? = 0] || exit 1; done

install: document
	mkdir -p $(DESTDIR)/usr/share/man/man1
	@gzip -c man/en/sosreport.1 > sosreport.1.gz
	mkdir -p $(DESTDIR)/usr/share/$(NAME)
	mkdir -p $(DESTDIR)/usr/share/doc/$(NAME)-$(VERSION)/_sources
	mkdir -p $(DESTDIR)/usr/share/doc/$(NAME)-$(VERSION)/_static
	mkdir -p $(DESTDIR)/etc
	install -m644 sosreport.1.gz $(DESTDIR)/usr/share/man/man1/.
	install -m644 LICENSE README README.rh-upload TODO $(DESTDIR)/usr/share/$(NAME)/.
	install -m644 doc/_build/html/*.{html,inv,js} $(DESTDIR)/usr/share/doc/$(NAME)-$(VERSION)/.
	install -m644 doc/_build/html/_sources/* $(DESTDIR)/usr/share/doc/$(NAME)-$(VERSION)/_sources/.
	install -m644 doc/_build/html/_static/* $(DESTDIR)/usr/share/doc/$(NAME)-$(VERSION)/_static/.
	install -m644 $(NAME).conf $(DESTDIR)/etc/$(NAME).conf
	make DESTDIR=`cd $(DESTDIR); pwd` -C po install

document:
	make -C $(PWD)/doc html

archive: 
	@rm -rf $(NAME)-$(VERSION).tar.gz
	@rm -rf $(TMPDIR)
	@svn export --force $(PWD) $(TMPDIR)
	@tar Ccvzf /tmp $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)
	@cp $(NAME)-$(VERSION).tar.gz $(shell rpm -E '%_sourcedir')
	@rm -rf $(NAME)-$(VERSION).tar.gz
	@echo "Archive is $(NAME)-$(VERSION).tar.gz"

clean:
	@rm -fv *~ .*~ changenew ChangeLog.old $(NAME)-$(VERSION).tar.gz
	@rm -rfv {dist,build,sos.egg-info}
	@rm -rf MANIFEST
	@rm -rfv $(TMPDIR)
	@for i in `find . -iname *.pyc`; do \
		rm $$i; \
	done; \
	for d in $(SUBDIRS); do make -C $$d clean ; done

rpm: gpgkey
	@$(MAKE) archive
	@rpmbuild -ba sos.spec

gpgkey:
	@echo "Building gpg key"
	@test -f gpgkeys/rhsupport.pub && echo "GPG key already exists." || \
	gpg --batch --gen-key gpgkeys/gpg.template