blob: 2e35baeb0afb122ad8b39a4eb24798b72caa79c7 (
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
|
# SPDX-License-Identifier: BSD-3-Clause
# @configure_input@
MAKEFLAGS += -R -r
UNITY = @UNITY@
srcdir = @srcdir@
abs_builddir = @abs_builddir@
prefix = @prefix@
exec_prefix = @exec_prefix@
datarootdir = @datarootdir@
sbindir = @sbindir@
sysconfdir = @sysconfdir@
localstatedir = @localstatedir@
mandir = @mandir@
systemdsystemunitdir = @systemdsystemunitdir@
default_seed_path_dir = @default_seed_path_dir@
CC = @CC@
CFLAGS = @CFLAGS@
override CFLAGS += -UNDEBUG -I$(abs_builddir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
VPATH := $(srcdir)
SRC := src/id.c src/load.c src/main.c src/random-seed.c src/save.c src/sha2.c src/util.c
OBJ := $(SRC:.c=.o)
DEP := $(SRC:.c=.d)
TEST_FILE := random-seed.test
all: random-seed systemd/random-seed.service systemd/random-seed-save.service
$(srcdir)/configure: $(srcdir)/aclocal.m4 $(srcdir)/autogen.sh $(srcdir)/configure.ac
cd $(srcdir); ./autogen.sh
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
Makefile: config.status Makefile.in
./config.status
config.h: config.status config.h.in
./config.status
ifneq ($(UNITY),)
random-seed: random-seed.o
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
random-seed.o: CPPFLAGS+=-I$(srcdir)/src
random-seed.c: Makefile
for f in $(SRC); do \
printf '#include "%s"\n' "$$f"; \
done > $@
-include random-seed.d
else
random-seed: $(OBJ)
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
-include $(DEP)
endif
%.o: %.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
%: %.in Makefile
@mkdir -p $(@D)
sed -e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@default_seed_path_dir[@]|$(default_seed_path_dir)|g' \
$< > $@
install: all
install -D -m755 random-seed $(DESTDIR)$(sbindir)/random-seed
install -D -m644 $(srcdir)/doc/random-seed.8 $(DESTDIR)$(mandir)/man8/random-seed.8
ifneq ($(systemdsystemunitdir),)
install -D -m644 systemd/random-seed.service $(DESTDIR)$(systemdsystemunitdir)/random-seed.service
install -D -m644 $(srcdir)/systemd/random-seed-save.service $(DESTDIR)$(systemdsystemunitdir)/random-seed-save.service
install -D -m644 $(srcdir)/systemd/random-seed-save.timer $(DESTDIR)$(systemdsystemunitdir)/random-seed-save.timer
endif
test: $(TEST_FILE)
$(TEST_FILE): random-seed
$(TEST_WRAPPER) ./random-seed save $(TEST_FILE)
$(TEST_WRAPPER) ./random-seed load $(TEST_FILE) || [ $$? = 15 ]
clean:
rm -f random-seed random-seed.c random-seed.d random-seed.o systemd/random-seed.service systemd/random-seed-save.service $(OBJ) $(DEP) $(TEST_FILE)
rmdir systemd 2>/dev/null || true
.PHONY: all install test clean random-seed.test
.INTERMEDIATE: $(TEST_FILE)
|