-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
116 lines (94 loc) · 2.74 KB
/
Makefile
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
ifeq ($(prefix),)
prefix := /usr/local
endif
ifeq ($(exec_prefix),)
exec_prefix := $(prefix)
endif
ifeq ($(bindir),)
bindir := $(exec_prefix)/bin
endif
ifeq ($(libdir),)
libdir := $(exec_prefix)/lib
endif
ifeq ($(datarootdir),)
datarootdir := $(prefix)/share
endif
ifeq ($(mandir),)
mandir := $(datarootdir)/man
endif
ifeq ($(python),)
python := python
endif
all: bin test doc
man1 := $(patsubst doc/%.1.rst,doc/_build/man/%.1,$(wildcard doc/*.1.rst))
man1_installed := $(patsubst doc/_build/man/%,$(DESTDIR)$(mandir)/man1/%,$(man1))
man8 := $(patsubst doc/%.8.rst,doc/_build/man/%.8,$(wildcard doc/*.8.rst))
man8_installed := $(patsubst doc/_build/man/%,$(DESTDIR)$(mandir)/man8/%,$(man8))
scriptdirs := bin $(wildcard lib/*-skel)
scripts := $(foreach dir,$(scriptdirs),$(wildcard $(dir)/*))
scripts_installed := \
$(patsubst bin/%,$(DESTDIR)$(bindir)/%,$(filter bin/%,$(scripts))) \
$(patsubst lib/%,$(DESTDIR)$(libdir)/podluck/%,$(filter lib/%,$(scripts)))
doc/_build/man/% : doc/%.rst
${MAKE} -C doc man
bin: $(scripts)
# empty for now
lint: bin
shellcheck $(scripts)
test: bin
PATH="$(shell pwd)/bin:${PATH}" $(python) -m test
doc: $(man1) $(man8)
clean:
${MAKE} -C doc clean
-rm -rf dist
-rm -rf build
# Install rule for executables/scripts
$(DESTDIR)$(bindir)/% : bin/%
install -m 0755 -D $< $@
# Install rule for hook scripts
$(DESTDIR)$(libdir)/podluck/% : lib/%
install -m 0755 -D $< $@
# Install rule for manpages
$(DESTDIR)$(mandir)/man1/% : doc/_build/man/%
install -m 0644 -D $< $@
# Install rule for manpages
$(DESTDIR)$(mandir)/man8/% : doc/_build/man/%
install -m 0644 -D $< $@
install-doc: doc $(man1_installed) $(man8_installed)
install-bin: bin $(scripts_installed)
install: install-bin install-doc
uninstall:
-rm -f $(man1_installed)
-rm -f $(man8_installed)
-rm -f $(scripts_installed)
-rm -f $(DESTDIR)$(mandir)/man8/podluck-build-daily@.service.8
-rm -f $(DESTDIR)$(mandir)/man8/podluck-build-weekly@.service.8
-rm -f $(DESTDIR)$(mandir)/man8/podluck-build-daily@.timer.8
-rm -f $(DESTDIR)$(mandir)/man8/podluck-build-weekly@.timer.8
-rm -f $(DESTDIR)$(libdir)/podluck/git-hooks/post-receive
-rmdir $(DESTDIR)$(libdir)/podluck/git-hooks
-rmdir $(DESTDIR)$(libdir)/podluck
dist-bin:
-rm -rf build
${MAKE} DESTDIR=build prefix=/ install
mkdir -p dist
tar --owner=root:0 --group=root:0 -czf dist/podluck-dist.tar.gz -C build .
dist-src:
mkdir -p dist
git archive -o dist/podluck-src.tar.gz HEAD
dist: dist-src dist-bin
cd dist && md5sum podluck-*.tar.gz > md5sum.txt
cd dist && sha1sum podluck-*.tar.gz > sha1sum.txt
cd dist && sha256sum podluck-*.tar.gz > sha256sum.txt
.PHONY: \
all \
clean \
dist \
dist-bin \
dist-src \
install \
install-bin \
install-doc \
lint \
test \
uninstall \