aboutsummaryrefslogtreecommitdiff
blob: c77b5c841d135f7595998141cdf48f3db4fa5963 (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
# Some make targets for testing / distribution

DESTDIR  := /
DESTTREE := $(DESTDIR)usr/

DATADIR  := $(DESTTREE)share
BINDIR   := $(DESTTREE)bin
CONFDIR  := $(DESTDIR)etc

BUILDDIR := ./tmp


PYMOD_FILE_LIST := ./roverlay_files.list

MANIFEST      := MANIFEST
MANIFEST_TMP  := $(MANIFEST).tmp

MANIFEST_GEN  := ./scripts/create_manifest.sh

SETUP_PY      := ./setup.py
PKG_DISTDIR   := ./release

LOGDIR        := ./log

ROVERLAY_MAIN := ./roverlay.py

PYVER         :=
PYTHON        := python$(PYVER)
PYDOC_SH       = ./scripts/do_pydoc.sh

RST_HTML       = ./scripts/roverlay_rst2html.sh

SRC_DOCDIR    := ./doc

SELFDOC       := $(SRC_DOCDIR)/pydoc

.PHONY: default \
	clean clean-log _pyclean _pydoc_clean distclean \
	docs pydoc htmldoc \
	check test \
	generate-files \
		generate-doc generate-manifest \
	release dist \
	compress-config \
	install-all install \
		install-roverlay install-pymodules \
		install-data install-config-common \
		install-config-compressed install-config \
	uninstall-all uninstall \
		uninstall-roverlay uninstall-pymodules

default:
	@false

check:
	@true

test: ./run_tests.sh
	./run_tests.sh

clean:
	rm -rf ./build/ $(BUILDDIR)/

clean-log:
	rm -rf -- $(LOGDIR)

_pyclean:
	find . -name "*.pyc" -or -name "*.pyo" -delete

_pydoc_clean:
	rm -f -- $(SELFDOC)/*.html
	! test -d $(SELFDOC) || rmdir --ignore-fail-on-non-empty -- $(SELFDOC)/

distclean: clean _pyclean _pydoc_clean

$(BUILDDIR):
	@install -d $(BUILDDIR)

# generates selfdocs (using pydoc) in $(SELFDOC)/
$(SELFDOC):
	-mkdir $(SELFDOC)
	ln -snfT -- ../../roverlay $(SELFDOC)/roverlay
	$(PYDOC_SH) $(SELFDOC)

# alias to $(SELFDOC)
pydoc: $(SELFDOC)

htmldoc: $(SRC_DOCDIR)/rst/usage.rst
	@install -d $(SRC_DOCDIR)/html
	$(RST_HTML) $(SRC_DOCDIR)/rst/usage.rst $(SRC_DOCDIR)/html/usage.html

generate-doc: htmldoc

generate-manifest: $(MANIFEST_GEN)
	$(MANIFEST_GEN) > $(MANIFEST_TMP)
	mv -- $(MANIFEST_TMP) $(MANIFEST)

generate-files: generate-doc generate-manifest


# creates a src tarball (.tar.bz2)
#  !!! does not include config files
release: generate-files
	@echo "Note: the release tarball does not include any config files!"
	@install -d $(PKG_DISTDIR)
	./$(SETUP_PY) sdist --dist-dir=$(PKG_DISTDIR) --formats=bztar

dist: distclean release

compress-config: $(BUILDDIR)
	@install -d $(BUILDDIR)/config
	cp -vLr -p --no-preserve=ownership config/simple-deprules.d $(BUILDDIR)/config/
	bzip2 $(BUILDDIR)/config/simple-deprules.d/*
	bzip2 -k -c config/license.map >  $(BUILDDIR)/config/license.map

install-roverlay: ./roverlay.py
	install -T -D -- ./roverlay.py $(BINDIR)/roverlay

install-pymodules: ./setup.py
	$(PYTHON) ./setup.py install --record $(PYMOD_FILE_LIST)

install-config-common:
	install -m 0755 -d $(CONFDIR)/roverlay
	install -m 0644 -t $(CONFDIR)/roverlay \
		config/description_fields.conf config/repo.list
	install -m 0644 -T \
		config/R-overlay.conf.install $(CONFDIR)/roverlay/R-overlay.conf

install-config-compressed: install-config-common
	cp -vLr -p --no-preserve=ownership \
		$(BUILDDIR)/config/simple-deprules.d $(BUILDDIR)/config/license.map \
		$(CONFDIR)/roverlay/

install-config: install-config-common
	cp -vLr -p --no-preserve=ownership \
		config/simple-deprules.d config/license.map \
		$(CONFDIR)/roverlay/


# license.map deprules

install-data:
	install -m 0755 -d \
		$(DATADIR)/roverlay/shlib $(DATADIR)/roverlay/hooks \
		$(DATADIR)/roverlay/eclass $(DATADIR)/roverlay/mako_templates

	install -m 0644 -t $(DATADIR)/roverlay/hooks files/hooks/*.sh
	install -m 0644 -t $(DATADIR)/roverlay/shlib files/shlib/*.sh
	chmod 0775 $(DATADIR)/roverlay/hooks/mux.sh

	install -m 0644 -t $(DATADIR)/roverlay/eclass files/eclass/*.eclass

	install -m 0644 -t $(DATADIR)/roverlay/mako_templates \
		files/mako_templates/*.*

install: install-pymodules install-roverlay

install-all: install

uninstall-roverlay:
	rm -vf -- $(BINDIR)/roverlay

uninstall-pymodules: $(PYMOD_FILE_LIST)
	xargs rm -vrf < $(PYMOD_FILE_LIST)

uinstall:
	@false

uninstall-all: uninstall