Commit 5ba4c0ef authored by Marek Vavruša's avatar Marek Vavruša

build: cleanup moduledir install, cleanup AMALG= for tests

parent db04c011
......@@ -73,6 +73,11 @@ info:
$(info [$(HAS_socket_wrapper)] socket_wrapper (lib))
$(info )
# Moduledir
$(PREFIX)/$(MODULEDIR):
$(INSTALL) -d $(PREFIX)/$(MODULEDIR)
moduledir: $(PREFIX)/$(MODULEDIR)
# Sub-targets
include lib/lib.mk
include daemon/daemon.mk
......
......@@ -9,26 +9,27 @@ kresd_SOURCES := \
daemon/bindings.c \
daemon/ffimodule.c \
daemon/main.c
kresd_DIST := daemon/lua/kres.lua daemon/lua/trust_anchors.lua
# Embed resources
# Embedded resources
%.inc: %.lua
@$(call quiet,XXD,$<) $< > $@
ifeq ($(AMALG), yes)
kresd.amalg.c: daemon/lua/sandbox.inc daemon/lua/config.inc
else
daemon/engine.o: daemon/lua/sandbox.inc daemon/lua/config.inc
endif
%.inc: %.lua
@$(call quiet,XXD,$<) $< > $@
# Installed FFI bindings
bindings-install: daemon/lua/kres.lua daemon/lua/trust_anchors.lua
$(INSTALL) -d $(PREFIX)/$(MODULEDIR)
$(INSTALL) -m 0644 $^ $(PREFIX)/$(MODULEDIR)
bindings-install: $(kresd_DIST) moduledir
$(INSTALL) -m 0644 $(kresd_DIST) $(PREFIX)/$(MODULEDIR)
kresd_DEPEND := $(libkres)
kresd_LIBS := $(libkres_TARGET) $(libknot_LIBS) $(libdnssec_LIBS) $(libuv_LIBS) $(lua_LIBS)
# Make binary
ifeq ($(HAS_lua)|$(HAS_libuv), yes|yes)
$(eval $(call make_bin,kresd,daemon))
$(eval $(call make_bin,kresd,daemon,yes))
endif
# Targets
......
......@@ -53,7 +53,7 @@ libkres_LIBS := $(libknot_LIBS) $(libdnssec_LIBS)
libkres_TARGET := -L$(abspath lib) -lkres
# Make library
$(eval $(call make_static,libkres,lib))
$(eval $(call make_static,libkres,lib,yes))
# Targets
lib: $(libkres)
......
......@@ -32,6 +32,7 @@ endif
# Make C module
define make_c_module
$(1)-install: moduledir
$(eval $(call make_module,$(1),modules/$(1)))
endef
......@@ -44,9 +45,8 @@ endef
define lua_target
$(1) := $$(addprefix $(2)/,$$($(1)_SOURCES))
$(1)-clean:
$(1)-install: $$(addprefix $(2)/,$$($(1)_SOURCES))
$(INSTALL) -d $(PREFIX)/$(MODULEDIR)
$(INSTALL) -m 0644 $$^ $(PREFIX)/$(MODULEDIR)
$(1)-install: $$(addprefix $(2)/,$$($(1)_SOURCES)) moduledir
$(INSTALL) -m 0644 $$(addprefix $(2)/,$$($(1)_SOURCES)) $(PREFIX)/$(MODULEDIR)
.PHONY: $(1) $(1)-install $(1)-clean
endef
......@@ -73,7 +73,7 @@ $(1)-dist: $$($(1)_INSTALL)
$(INSTALL) -d $(PREFIX)/$(MODULEDIR)/$(1)
$(INSTALL) -m 0644 $$^ $(PREFIX)/$(MODULEDIR)/$(1)
endif
$(1)-install: $(2)/$(1)$(LIBEXT) $(1)-dist
$(1)-install: $(2)/$(1)$(LIBEXT) $(1)-dist moduledir
$(INSTALL) $(2)/$(1)$(LIBEXT) $(PREFIX)/$(MODULEDIR)
.PHONY: $(1)-clean $(1)-install $(1)-dist
endef
......
......@@ -80,8 +80,10 @@ ifeq ($(6), yes)
$(RM) $(1).amalg.c $(1).amalg.o
endif
$(1)-install: $(2)/$(1)$(3)
ifneq ($(5),$(MODULEDIR))
$(INSTALL) -d $(PREFIX)/$(5)
$(INSTALL) $$^ $(PREFIX)/$(5)
endif
$(INSTALL) $(2)/$(1)$(3) $(PREFIX)/$(5)
ifneq ($$(strip $$($(1)_HEADERS)),)
$(INSTALL) -d $(PREFIX)/$(INCLUDEDIR)/$(1)
$(INSTALL) -m 644 $$($(1)_HEADERS) $(PREFIX)/$(INCLUDEDIR)/$(1)
......@@ -89,21 +91,12 @@ endif
.PHONY: $(1)-clean $(1)-install
endef
# Make targets (name,path)
make_bin = $(call make_target,$(1),$(2),$(BINEXT),$(BINFLAGS),$(BINDIR),yes)
make_lib = $(call make_target,$(1),$(2),$(LIBEXT),-$(LIBTYPE),$(LIBDIR),yes)
make_module = $(call make_target,$(1),$(2),$(LIBEXT),-$(LIBTYPE),$(MODULEDIR),no)
make_shared = $(call make_target,$(1),$(2),$(MODEXT),-$(MODTYPE),$(LIBDIR),yes)
make_static = $(call make_target,$(1),$(2),$(AREXT),-$(ARTYPE),$(LIBDIR),yes)
# Evaluate library
define have_lib
ifeq ($$(strip $$($(1)_LIBS)),)
HAS_$(1) := no
else
HAS_$(1) := yes
endif
endef
# Make targets (name,path,amalgable yes|no)
make_bin = $(call make_target,$(1),$(2),$(BINEXT),$(BINFLAGS),$(BINDIR),$(3))
make_lib = $(call make_target,$(1),$(2),$(LIBEXT),-$(LIBTYPE),$(LIBDIR),$(3))
make_module = $(call make_target,$(1),$(2),$(LIBEXT),-$(LIBTYPE),$(MODULEDIR),$(3))
make_shared = $(call make_target,$(1),$(2),$(MODEXT),-$(MODTYPE),$(LIBDIR),$(3))
make_static = $(call make_target,$(1),$(2),$(AREXT),-$(ARTYPE),$(LIBDIR),$(3))
# Find library (pkg-config)
define find_lib
......@@ -121,7 +114,11 @@ define find_alt
$(1)_LIBS := $(shell pkg-config --libs $(2) --silence-errors)
endif
endif
$(call have_lib,$(1),$(3))
ifeq ($$(strip $$($(1)_LIBS)),)
HAS_$(1) := no
else
HAS_$(1) := yes
endif
endef
# Find binary
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment