aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 8faa035c0de8069432748c9ece9bb1c5f27177d8 (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
# vi: noet
PREFIX = usr
SYSCONFDIR = etc/apkvitrine
WEBAPPDIR = $(PREFIX)/share/webapps/apkvitrine

PYTHON = python3
DESTDIR = target

-include config.mk

PYLINT = pylint
SETUP.PY = $(PYTHON) src/setup.py
# These are needed by setup.py
export SYSCONFDIR WEBAPPDIR

PYLINT_TARGETS = \
	apkvitrine

CLEAN_TARGETS = \
	MANIFEST \
	apkvitrine.egg-info \
	build \
	dist \
	target

.PHONY: all
all:
	$(SETUP.PY) build

.PHONY: paths
paths:
	@printf 'CONF: SYSCONFDIR = "%s"\n' '$(SYSCONFDIR)'
	@sed -i \
		-e '/^_SYSCONFDIR = /s@= .*@= Path("/$(SYSCONFDIR)")@' \
		apkvitrine/__init__.py

.PHONY: install
install: paths all
	$(SETUP.PY) install \
		--root="$(DESTDIR)" \
		--prefix="/$(PREFIX)"
	mv "$(DESTDIR)/$(PREFIX)/bin/apkvitrine.cgi" \
		"$(DESTDIR)/$(WEBAPPDIR)"

.PHONY: clean
clean:
	rm -rf $(CLEAN_TARGETS)

#
# Maintainer targets:
#

.PHONY: dist
dist: clean
	$(SETUP.PY) sdist -u root -g root -t src/MANIFEST.in

.PHONY: pylint
pylint:
	-$(PYLINT) --rcfile src/pylintrc $(PYLINT_TARGETS)

.PHONY: lint
lint: pylint

.PHONY: setup
setup:
	@$(SETUP.PY) $(SETUP_ARGS)