daemon.mk 1.44 KB
Newer Older
1
kresd_SOURCES := \
2 3
	daemon/io.c          \
	daemon/network.c     \
4
	daemon/engine.c      \
Marek Vavruša's avatar
Marek Vavruša committed
5
	daemon/worker.c      \
6
	daemon/bindings.c    \
7
	daemon/ffimodule.c   \
Marek Vavruša's avatar
Marek Vavruša committed
8
	daemon/main.c
9

10
kresd_DIST := daemon/lua/kres.lua daemon/lua/trust_anchors.lua
Marek Vavruša's avatar
Marek Vavruša committed
11

12 13 14
# Embedded resources
%.inc: %.lua
	@$(call quiet,XXD,$<) $< > $@
15 16 17
ifeq ($(AMALG), yes)
kresd.amalg.c: daemon/lua/sandbox.inc daemon/lua/config.inc
else
18
daemon/engine.o: daemon/lua/sandbox.inc daemon/lua/config.inc
19
endif
20

21
# Installed FFI bindings
22 23
bindings-install: $(kresd_DIST) $(DESTDIR)$(MODULEDIR)
	$(INSTALL) -m 0644 $(kresd_DIST) $(DESTDIR)$(MODULEDIR)
24

25
kresd_CFLAGS := -fPIE
26
kresd_DEPEND := $(libkres) $(contrib)
27 28 29 30 31 32 33 34
kresd_LIBS := $(libkres_TARGET) $(contrib_TARGET) $(libknot_LIBS) \
              $(libzscanner_LIBS) $(libdnssec_LIBS) $(libuv_LIBS) $(lua_LIBS)

# Enable systemd
ifeq ($(HAS_libsystemd), yes)
kresd_CFLAGS += -DHAS_SYSTEMD
kresd_LIBS += $(libsystemd_LIBS)
endif
Marek Vavruša's avatar
Marek Vavruša committed
35 36

# Make binary
37
ifeq ($(HAS_lua)|$(HAS_libuv), yes|yes)
38
$(eval $(call make_sbin,kresd,daemon,yes))
39
endif
40 41

# Targets
42
date := $(shell date +%F)
43
daemon: $(kresd)
44
daemon-install: kresd-install bindings-install
45 46
ifneq ($(SED),)
	$(SED) -e "s/@VERSION@/$(MAJOR).$(MINOR).$(PATCH)/" -e "s/@DATE@/$(date)/" doc/kresd.8.in > doc/kresd.8
47
	$(INSTALL) -d -m 0755 $(DESTDIR)$(PREFIX)/share/man/man8/
48 49
	$(INSTALL) -m 0644 doc/kresd.8 $(DESTDIR)$(PREFIX)/share/man/man8/
endif
50
daemon-clean: kresd-clean
51 52
	@$(RM) daemon/lua/*.inc

53
.PHONY: daemon daemon-install daemon-clean