summaryrefslogtreecommitdiff
path: root/Makefile.in
blob: f52121edac0c3274bd477397e489e0710a615daf (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
# @configure_input@

VPATH = @abs_srcdir@
abs_srcdir = @abs_srcdir@

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 = -Wall -Wextra -pedantic @CFLAGS@ -UNDEBUG -include @abs_top_builddir@/config.h
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@

SRC := random-seed.c sha2.c util.c
OBJ := $(SRC:.c=.o)
TEST_FILE := random-seed.test

all: random-seed random-seed.service

random-seed: $(OBJ)

random-seed.o: random-seed.c musl-libgen-c.h util.h sha2.h

util.o: util.c util.h sha2.h

sha2.o: sha2.c sha2.h

random-seed.service: random-seed.service.in
	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 $(abs_srcdir)/random-seed.8 $(DESTDIR)$(mandir)/man8/random-seed.8
ifneq ($(systemdsystemunitdir),)
	install -D -m644 random-seed.service $(DESTDIR)$(systemdsystemunitdir)/random-seed.service
	install -D -m644 $(abs_srcdir)/random-seed-save.service $(DESTDIR)$(systemdsystemunitdir)/random-seed-save.service
	install -D -m644 $(abs_srcdir)/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) random-seed $(OBJ) $(DEP) $(TEST_FILE)

distclean: clean
	$(RM) -r aclocal.m4 autom4te.cache config.h config.h.in 'config.h.in~' config.log config.status configure Makefile

.PHONY: all install test clean random-seed.test
.INTERMEDIATE: $(TEST_FILE)