Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
197 lines (176 loc) · 4.48 KB
/
Copy pathMakefile
File metadata and controls
197 lines (176 loc) · 4.48 KB
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
188
189
190
191
192
193
194
195
196
197
CC ?= cc
PREFIX ?= /usr
SYSCONFDIR ?= /etc
LOCALSTATEDIR ?= /var
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(DATADIR)/man
DINITSRVDIR ?= $(LIBDIR)/dinit.d
DINITCNFDIR ?= $(SYSCONFDIR)/dinit.d
SEEDRNGDIR ?= $(LOCALSTATEDIR)/lib
BIN_PROGRAMS = modules-load dbus-wait-for seedrng
MAN5 = locale.conf.5 vconsole.conf.5
MAN8 = modules-load.8
CONF_FILES = \
console.conf \
agetty-default.conf \
network-online.conf \
seedrng.conf
SERVICEDIR = boot.d
SERVICES = \
agetty \
boot \
cgroups \
cleanup \
crypttab \
dmesg \
fsck \
fsck-root \
getty \
hostname \
hwclock \
static-devnodes \
locale \
modules \
net-lo \
network \
network-pre \
pseudofs \
random-seed \
recovery \
root-ro \
sbin-merge \
single \
swap \
sysctl \
system \
udevd \
udevd-early \
udev-settle \
udev-trigger
TARGETS = \
early-console.target \
early-devices.target \
early-fs-fstab.target \
early-fs-local.target \
early-fs-pre.target \
early-keyboard.target \
early-modules.target \
early-prepare.target \
early-root-rw.target \
local.target \
login.target \
network.target \
network-online.target \
pre-local.target \
pre-network.target \
time-sync.target
SCRIPTS = \
agetty \
agetty-default \
cgroups \
cleanup \
crypttab \
dmesg \
fsck \
hostname \
hwclock \
locale \
net-online \
pseudofs \
rclocal \
remount \
sbin-merge \
static-devnodes \
udevd \
udev-trigger \
vconsole
TTY_SERVICES = \
getty@tty1 \
getty@tty2 \
getty@tty3 \
getty@tty4 \
getty@tty5 \
getty@tty6
CFLAGS ?= -O2 -pipe
CFLAGS += -Wall -Wextra -pedantic
all: bin man
bin/dbus-wait-for: bin/dbus-wait-for.c
$(CC) -o bin/dbus-wait-for bin/dbus-wait-for.c $(CFLAGS) `pkg-config --libs --cflags dbus-1`
bin/seedrng: bin/seedrng.c
$(CC) -o bin/seedrng bin/seedrng.c $(CFLAGS) -DLOCALSTATEDIR="\"$(SEEDRNGDIR)\""
bin: bin/dbus-wait-for bin/seedrng
# there has to be a better way
man/modules-load.8: man/modules-load.8.scd
scdoc < $< > $@
man/locale.conf.5: man/locale.conf.5.scd
scdoc < $< > $@
man/vconsole.conf.5: man/vconsole.conf.5.scd
scdoc < $< > $@
man: man/locale.conf.5 man/vconsole.conf.5 man/modules-load.8
install:
install -d $(DESTDIR)$(BINDIR)
install -d $(DESTDIR)$(LIBDIR)
install -d $(DESTDIR)$(DATADIR)
install -d $(DESTDIR)$(SYSCONFDIR)
install -d $(DESTDIR)$(MANDIR)
install -d $(DESTDIR)$(DINITSRVDIR)
install -d $(DESTDIR)$(DINITCNFDIR)/config
install -d $(DESTDIR)$(LIBDIR)/dinit
install -d $(DESTDIR)$(DINITSRVDIR)/boot.d
install -d $(DESTDIR)$(DINITCNFDIR)/boot.d
install -d $(DESTDIR)$(LOCALSTATEDIR)/log/dinit
# placeholder
touch $(DESTDIR)$(DINITCNFDIR)/boot.d/.KEEP
# config files
install -m 644 config/hwclock.conf $(DESTDIR)$(SYSCONFDIR)/hwclock.conf; \
for conf in $(CONF_FILES); do \
install -m 644 config/$$conf $(DESTDIR)$(DINITCNFDIR)/config; \
done
# scripts
for script in $(SCRIPTS); do \
install -m 755 scripts/$$script $(DESTDIR)$(LIBDIR)/dinit; \
done
# programs
for prog in $(BIN_PROGRAMS); do \
install -m 755 bin/$$prog $(DESTDIR)$(LIBDIR)/dinit; \
done
# manpages
for man in $(MAN5); do \
install -Dm644 man/$$man $(DESTDIR)$(MANDIR)/man5/$$man; \
done
for man in $(MAN8); do \
install -Dm644 man/$$man $(DESTDIR)$(MANDIR)/man8/$$man; \
done
# services
for srv in $(SERVICES); do \
install -m 644 services/$$srv $(DESTDIR)$(DINITSRVDIR); \
done
# targets
for srv in $(TARGETS); do \
install -m 644 services/$$srv $(DESTDIR)$(DINITSRVDIR); \
done
# getty services
for srv in $(TTY_SERVICES); do \
sed "s|@DINITSRVDIR[@]|$(DINITSRVDIR)|g" services/$$srv.in > $(DESTDIR)$(DINITCNFDIR)/$$srv; \
chmod 644 $(DESTDIR)$(DINITCNFDIR)/$$srv; \
done
# install default service
ln -sf ../agetty $(DESTDIR)$(DINITSRVDIR)/boot.d/agetty
ln -sf ../udevd $(DESTDIR)$(DINITSRVDIR)/boot.d/udevd
# shutdown hook
install -Dm755 misc/shutdown-hook $(DESTDIR)$(LIBDIR)/dinit/shutdown-hook
# misc
install -Dm755 misc/01-dinit-env.sh $(DESTDIR)$(SYSCONFDIR)/X11/xinit/xinitrc.d/01-dinit-env.sh
install -Dm644 misc/50-default.conf $(DESTDIR)$(LIBDIR)/sysctl.d/50-default.conf
install -Dm644 misc/dinit.logrotate $(DESTDIR)$(SYSCONFDIR)/logrotate.d/dinit
install -Dm644 misc/dinit-rc.tmpfiles $(DESTDIR)$(LIBDIR)/tmpfiles.d/dinit-rc.conf
install -Dm644 misc/crypt.awk $(DESTDIR)$(DINITSRVDIR)/crypt.awk
install -Dm644 misc/dracut.conf $(DESTDIR)$(LIBDIR)/dracut/10-dinit-noid.conf
clean:
rm -f bin/seedrng
rm -f bin/dbus-wait-for
rm -f man/*.8
rm -f man/*.5
.PHONY: all clean