This repository has been archived by the owner on Sep 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
118 lines (86 loc) · 2.92 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
117
118
VERSION = 0.5
PKG = live-services
TOOLS = artools
SYSCONFDIR = /etc
ifdef PREFIX
PREFIX = /usr/local
endif
BINDIR = $(PREFIX)/bin
LIBDIR = $(PREFIX)/lib
DATADIR = $(PREFIX)/share
FMODE = -m0644
DMODE = -dm0755
BMODE = -m0755
RM = rm -f
M4 = m4 -P
CHAW = chmod a-w
CHX = chmod +x
BIN = \
bin/artix-live
LIBS = $(wildcard lib/*.sh)
SHARED = \
$(wildcard data/*.map) \
data/live.conf
RC = \
data/rc/gnupg-mount \
data/rc/pacman-init \
data/rc/artix-live
RUNIT_SVD = \
data/runit/live
RUNIT_SV = \
data/runit/pacman-init.run
GRUB_DEFAULT = \
data/grub2-portable-efi
GRUB_D = \
data/99_zzz-portable-efi
all: $(BIN) $(RC) $(RUNIT_SV) $(XBIN) $(GRUB_D)
EDIT = sed -e "s|@datadir[@]|$(DATADIR)/$(TOOLS)|g" \
-e "s|@sysconfdir[@]|$(SYSCONFDIR)/$(TOOLS)|g" \
-e "s|@libdir[@]|$(LIBDIR)/$(TOOLS)|g"
%: %.in Makefile
@echo "GEN $@"
@$(RM) "$@"
@$(M4) [email protected] | $(EDIT) >$@
@$(CHAW) "$@"
@$(CHX) "$@"
clean:
$(RM) $(BIN) $(RC) $(GRUB_D)
install_base:
install $(DMODE) $(DESTDIR)$(BINDIR)
install $(BMODE) $(BIN) $(DESTDIR)$(BINDIR)
install $(DMODE) $(DESTDIR)$(LIBDIR)/$(TOOLS)
install $(FMODE) $(LIBS) $(DESTDIR)$(LIBDIR)/$(TOOLS)
install $(DMODE) $(DESTDIR)$(DATADIR)/$(TOOLS)
install $(FMODE) $(SHARED) $(DESTDIR)$(DATADIR)/$(TOOLS)
install_rc:
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/init.d
install $(BMODE) $(RC) $(DESTDIR)$(SYSCONFDIR)/init.d
install_runit:
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/rc/sysinit
install $(DMODE) $(DESTDIR)$(LIBDIR)/rc/sv.d
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/runit/sv/pacman-init
install $(BMODE) $(RUNIT_SVD) $(DESTDIR)$(LIBDIR)/rc/sv.d
ln -sf $(LIBDIR)/rc/sv.d/live $(DESTDIR)$(SYSCONFDIR)/rc/sysinit/98-live
install $(BMODE) $(RUNIT_SV) $(DESTDIR)$(SYSCONFDIR)/runit/sv/pacman-init/run
install_portable_efi:
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/default
install $(BMODE) $(GRUB_DEFAULT) $(DESTDIR)$(SYSCONFDIR)/default
install $(DMODE) $(DESTDIR)$(SYSCONFDIR)/grub.d
install $(BMODE) $(GRUB_D) $(DESTDIR)$(SYSCONFDIR)/grub.d
uninstall_base:
for f in $(notdir $(BIN)); do $(RM) $(DESTDIR)$(BINDIR)/$$f; done
for f in $(notdir $(SHARED)); do $(RM) $(DESTDIR)$(DATADIR)/$(TOOLS)/$$f; done
for f in $(notdir $(LIBS)); do $(RM) $(DESTDIR)$(LIBDIR)/$(TOOLS)/$$f; done
uninstall_portable_efi:
for f in $(notdir $(GRUB_DEFAULT)); do $(RM) $(DESTDIR)$(SYSCONFDIR)/default/$$f; done
for f in $(notdir $(GRUB_D)); do $(RM) $(DESTDIR)$(SYSCONFDIR)/grub.d/$$f; done
uninstall_rc:
for f in $(notdir $(RC)); do $(RM) $(DESTDIR)$(SYSCONFDIR)/init.d/$$f; done
uninstall_runit:
for f in $(notdir $(RUNIT_SV)); do $(RM) $(DESTDIR)$(SYSCONFDIR)/runit/sv/$$f; done
install: install_base install_rc install_portable_efi
uninstall: uninstall_base uninstall_rc uninstall_runit uninstall_portable_efi
dist:
git archive --format=tar --prefix=$(PKG)-$(VERSION)/ $(VERSION) | gzip -9 > $(PKG)-$(VERSION).tar.gz
gpg --detach-sign --use-agent $(PKG)-$(VERSION).tar.gz
.PHONY: all clean install uninstall dist