# 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_dir = @DEFAULT_SEED_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 $@ $< systemd/random-seed.service systemd/random-seed-save.service: Makefile @mkdir -p $(@D) sed -e 's|@sbindir[@]|$(sbindir)|g' \ -e 's|@default_seed_dir[@]|$(default_seed_dir)|g' \ $(srcdir)/$@.in > $@ systemd/random-seed.service: systemd/random-seed.service.in systemd/random-seed-save.service: systemd/random-seed-save.service.in 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 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)