summaryrefslogtreecommitdiff
path: root/Makefile
blob: 60bb9db4eed6c8378770f3a5e5308d297691cae5 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
PKGNAME = createrepo
VERSION=$(shell awk '/Version:/ { print $$2 }' ${PKGNAME}.spec)
RELEASE=$(shell awk '/Release:/ { print $$2 }' ${PKGNAME}.spec)
CVSTAG=createrepo-$(subst .,_,$(VERSION)-$(RELEASE))
PYTHON=python
SUBDIRS = $(PKGNAME) bin docs
PYFILES = $(wildcard *.py)


SHELL = /bin/sh
top_srcdir = .
srcdir = .
prefix = /usr
exec_prefix = ${prefix}

bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin
libexecdir = ${exec_prefix}/libexec
datadir = ${prefix}/share
sysconfdir = ${prefix}/etc
sharedstatedir = ${prefix}/com
localstatedir = ${prefix}/var
libdir = ${exec_prefix}/lib
infodir = ${prefix}/info
docdir = 
includedir = ${prefix}/include
oldincludedir = /usr/include
mandir = ${prefix}/share/man

pkgdatadir = $(datadir)/$(PKGNAME)
pkglibdir = $(libdir)/$(PKGNAME)
pkgincludedir = $(includedir)/$(PKGNAME)
top_builddir = 

# all dirs
DIRS = $(DESTDIR)$(bindir) $(DESTDIR)$(sysconfdir)/bash_completion.d \
	$(DESTDIR)$(pkgdatadir) $(DESTDIR)$(mandir)


# INSTALL scripts 
INSTALL         = install -p --verbose 
INSTALL_BIN     = $(INSTALL) -m 755 
INSTALL_DIR     = $(INSTALL) -m 755 -d 
INSTALL_DATA    = $(INSTALL) -m 644 
INSTALL_MODULES = $(INSTALL) -m 755 -D 
RM              = rm -f

MODULES = $(srcdir)/genpkgmetadata.py \
	$(srcdir)/modifyrepo.py \
	$(srcdir)/mergerepo.py	\
	$(srcdir)/worker.py

.SUFFIXES: .py .pyc
.py.pyc: 
	python -c "import py_compile; py_compile.compile($*.py)"


all: $(MODULES)
	for subdir in $(SUBDIRS) ; do \
	  $(MAKE) -C $$subdir VERSION=$(VERSION) PKGNAME=$(PKGNAME) DESTDIR=$(DESTDIR); \
	done

check: 
	pychecker $(MODULES) || exit 0 

install: all installdirs
	$(INSTALL_MODULES) $(srcdir)/$(MODULES) $(DESTDIR)$(pkgdatadir)
	$(INSTALL_DATA) $(PKGNAME).bash $(DESTDIR)$(sysconfdir)/bash_completion.d
	for subdir in $(SUBDIRS) ; do \
	  $(MAKE) -C $$subdir install VERSION=$(VERSION) PKGNAME=$(PKGNAME); \
	done

installdirs:
	for dir in $(DIRS) ; do \
      $(INSTALL_DIR) $$dir ; \
	done


uninstall:
	for module in $(MODULES) ; do \
	  $(RM) $(pkgdatadir)/$$module ; \
	done
	for subdir in $(SUBDIRS) ; do \
	  $(MAKE) -C $$subdir uninstall VERSION=$(VERSION) PKGNAME=$(PKGNAME); \
	done

clean:
	$(RM)  *.pyc *.pyo
	for subdir in $(SUBDIRS) ; do \
	  $(MAKE) -C $$subdir clean VERSION=$(VERSION) PKGNAME=$(PKGNAME); \
	done

distclean: clean
	$(RM) -r .libs
	$(RM) core
	$(RM) *~
	for subdir in $(SUBDIRS) ; do \
	  $(MAKE) -C $$subdir distclean VERSION=$(VERSION) PKGNAME=$(PKGNAME); \
	done

pylint:
	@pylint --rcfile=test/createrepo-pylintrc *.py createrepo

pylint-short:
	@pylint -r n --rcfile=test/createrepo-pylintrc *.py createrepo

mostlyclean:
	$(MAKE) clean


maintainer-clean:
	$(MAKE) distclean
	$(RM) $(srcdir)/configure

changelog:
	git log --pretty --numstat --summary | git2cl  > ChangeLog

dist:
	olddir=`pwd`; \
	distdir=$(PKGNAME)-$(VERSION); \
	$(RM) -r .disttmp; \
	$(INSTALL_DIR) .disttmp; \
	$(INSTALL_DIR) .disttmp/$$distdir; \
	$(MAKE) distfiles
	distdir=$(PKGNAME)-$(VERSION); \
	cd .disttmp; \
	tar -cvz > ../$$distdir.tar.gz $$distdir; \
	cd $$olddir
	$(RM) -r .disttmp

daily:
	olddir=`pwd`; \
	distdir=$(PKGNAME); \
	$(RM) -r .disttmp; \
	$(INSTALL_DIR) .disttmp; \
	$(INSTALL_DIR) .disttmp/$$distdir; \
	$(MAKE) dailyfiles
	day=`/bin/date +%Y%m%d`; \
	distdir=$(PKGNAME); \
	tarname=$$distdir-$$day ;\
	cd .disttmp; \
	perl -pi -e "s/\#DATE\#/$$day/g" $$distdir/$(PKGNAME)-daily.spec; \
	echo $$day; \
	tar -cvz > ../$$tarname.tar.gz $$distdir; \
	cd $$olddir
	$(RM) -rf .disttmp

dailyfiles:
	distdir=$(PKGNAME); \
	cp \
	$(srcdir)/*.py \
	$(srcdir)/Makefile \
	$(srcdir)/ChangeLog \
	$(srcdir)/COPYING \
	$(srcdir)/COPYING.lib \
	$(srcdir)/README \
	$(srcdir)/$(PKGNAME).spec \
	$(srcdir)/$(PKGNAME).bash \
	$(top_srcdir)/.disttmp/$$distdir
	for subdir in $(SUBDIRS) ; do \
	  $(MAKE) -C $$subdir dailyfiles VERSION=$(VERSION) PKGNAME=$(PKGNAME); \
	done

distfiles:
	distdir=$(PKGNAME)-$(VERSION); \
	cp \
	$(srcdir)/*.py \
	$(srcdir)/Makefile \
	$(srcdir)/ChangeLog \
	$(srcdir)/COPYING \
	$(srcdir)/COPYING.lib \
	$(srcdir)/README \
	$(srcdir)/$(PKGNAME).spec \
	$(srcdir)/$(PKGNAME).bash \
	$(top_srcdir)/.disttmp/$$distdir
	for subdir in $(SUBDIRS) ; do \
	  $(MAKE) -C $$subdir distfiles VERSION=$(VERSION) PKGNAME=$(PKGNAME); \
	done

archive: dist

.PHONY: todo
todo:
	@echo ---------------===========================================
	@grep -n TODO\\\|FIXME `find . -type f` | grep -v grep
	@echo ---------------===========================================
.PHONY: all install install-strip uninstall clean distclean mostlyclean maintainer-clean info dvi dist distfiles check installcheck installdirs daily dailyfiles