summaryrefslogtreecommitdiff
path: root/Makefile
blob: c55482ef0e75305bea812cb73e3e6b36236a1745 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#############################################################################
# File		: Makefile
# Package	: rpmlint
# Author	: Frederic Lepied
# Created on	: Mon Sep 30 13:20:18 1999
# Version	: $Id: Makefile 1895 2011-12-04 16:23:10Z scop $
# Purpose	: rules to manage the files.
#############################################################################

BINDIR=/usr/bin
LIBDIR=/usr/share/rpmlint
ETCDIR=/etc
MANDIR=/usr/share/man

FILES = rpmlint *.py INSTALL README README.devel COPYING tools/*.py \
	Makefile config rpmdiff rpmlint.bash-completion rpmlint.1 \
	test.sh test/*.rpm test/*.spec test/*.py
GENERATED = AUTHORS ChangeLog __version__.py

PACKAGE = rpmlint
PYTHON = python

# update this variable to create a new release
VERSION := 1.4
TAG := $(shell echo "V$(VERSION)" | tr -- '-.' '__')
SVNBASE = $(shell svn info . | grep URL | sed -e 's/[^:]*:\s*//' -e 's,/\(trunk\|tags/.\+\)$$,,')

# for the [A-Z]* part
LC_ALL:=C
export LC_ALL

all: __version__.py __isocodes__.py
	if [ "x${COMPILE_PYC}" = "x1" ] ; then \
		$(PYTHON) -m py_compile [A-Z]*.py __*__.py ; \
	fi
	$(PYTHON) -O -m py_compile [A-Z]*.py __*__.py

clean:
	rm -f *~ *.pyc *.pyo $(GENERATED)

install: all
	mkdir -p $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(ETCDIR)/$(PACKAGE) $(DESTDIR)$(MANDIR)/man1
	-cp -p *.pyc $(DESTDIR)$(LIBDIR)
	cp -p *.py *.pyo $(DESTDIR)$(LIBDIR)
	cp -p rpmlint rpmdiff $(DESTDIR)$(BINDIR)
	cp -p config $(DESTDIR)$(ETCDIR)/$(PACKAGE)
	compdir=`pkg-config --variable=completionsdir bash-completion 2>/dev/null` ; \
	if [ "x$$compdir" = "x" ] ; then \
		mkdir -p $(DESTDIR)$(ETCDIR)/bash_completion.d ; \
		cp -p rpmlint.bash-completion $(DESTDIR)$(ETCDIR)/bash_completion.d/rpmlint ; \
	else \
		mkdir -p $(DESTDIR)$$compdir ; \
		cp -p rpmlint.bash-completion $(DESTDIR)$$compdir/rpmlint ; \
		ln -s rpmlint $(DESTDIR)$$compdir/rpmdiff ; \
	fi
	cp -p rpmlint.1 $(DESTDIR)$(MANDIR)/man1/rpmlint.1

verify:
	pychecker --limit=100 [A-Z]*.py __*__.py

.PHONY: check

check:
	./test.sh

version:
	@echo "$(VERSION)"


dist: cleandist localcopy tar

cleandist:
	rm -rf $(PACKAGE)-$(VERSION) $(PACKAGE)-$(VERSION).tar.xz

localcopy: $(FILES) $(GENERATED)
	mkdir $(PACKAGE)-$(VERSION)
	cp -p --parents $(FILES) $(GENERATED) $(PACKAGE)-$(VERSION)

tar: localcopy
	tar cv --owner=root --group=root -f $(PACKAGE)-$(VERSION).tar $(PACKAGE)-$(VERSION)
	xz -9evf $(PACKAGE)-$(VERSION).tar
	rm -rf $(PACKAGE)-$(VERSION)

export:
	svn export $(SVNBASE)/tags/$(TAG) $(PACKAGE)-$(VERSION)

tag:
	@if svn list $(SVNBASE)/tags/$(TAG) &>/dev/null ; then \
	    echo "ERROR: tag \"$(TAG)\" probably already exists" ; \
	    exit 1 ; \
	else \
	    echo 'svn copy -m "Tag $(TAG)." . $(SVNBASE)/tags/$(TAG)' ; \
	    svn copy -m "Tag $(TAG)." . $(SVNBASE)/tags/$(TAG) ; \
	fi

AUTHORS: authors.xml authors.xsl
	xsltproc authors.xsl authors.xml | sort -u > $@

ChangeLog: $(FILES) authors.xml
	svn2cl --authors=authors.xml --group-by-day --reparagraph \
		--strip-prefix=trunk

__version__.py: Makefile
	echo "# Automatically generated, do not edit" > $@
	echo "__version__ = '$(VERSION)'" >> $@

__isocodes__.py:
	tools/generate-isocodes.py > $@

# Makefile ends here