before_script:
- ./scripts/bootstrap-depends.sh ${HOME}/.local
script:
- - make -j2 install AMALG=yes COVERAGE=1 PREFIX=${HOME}/.local
+ - make -j2 install check AMALG=yes COVERAGE=1 PREFIX=${HOME}/.local
- ./daemon/kresd -h
- - make -j2 check COVERAGE=1 PREFIX=${HOME}/.local
- make -j2 check-integration COVERAGE=1 PREFIX=${HOME}/.local
after_success:
- test $TRAVIS_OS_NAME = linux && coveralls -i lib -i daemon -x ".c" --gcov-options '\-lp'
# Targets
all: info lib daemon modules
-install: lib-install modules-install daemon-install
+install: lib-install daemon-install modules-install
check: all tests
-clean: lib-clean modules-clean daemon-clean tests-clean doc-clean
+clean: lib-clean daemon-clean modules-clean tests-clean doc-clean
doc: doc-html
.PHONY: all install check clean doc info
daemon/main.c
# Embed resources
+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)
kresd_DEPEND := $(libkres)
kresd_LIBS := $(libkres_TARGET) $(libknot_LIBS) $(libdnssec_LIBS) $(libuv_LIBS) $(lua_LIBS)
-# Amalgamated build for smaller code
-ifeq ($(AMALG), yes)
-kresd_CFLAGS := -fwhole-program
-kresd.amalg.c: daemon/lua/sandbox.inc daemon/lua/config.inc
-endif
-
# Make binary
ifeq ($(HAS_lua)|$(HAS_libuv), yes|yes)
$(eval $(call make_bin,kresd,daemon))
$(eval $(call go_target,$(1),modules/$(1)))
endef
+# Filter CGO flags
+CGO_CFLAGS := $(filter-out -flto,$(BUILD_CFLAGS))
+
# Go target definition
define go_target
$(1) := $(2)/$(1)$(LIBEXT)
$(2)/$(1)$(LIBEXT): $$($(1)_SOURCES) $$($(1)_DEPEND)
- @echo " GO $(2)"; CGO_CFLAGS="$(BUILD_CFLAGS)" CGO_LDFLAGS="$$($(1)_LIBS) $(CFLAGS)" $(GO) build -buildmode=c-shared -o $$@ $$($(1)_SOURCES)
+ @echo " GO $(2)"; CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$$($(1)_LIBS) $(CFLAGS)" $(GO) build -buildmode=c-shared -o $$@ $$($(1)_SOURCES)
$(1)-clean:
$(RM) -r $(2)/$(1).h $(2)/$(1)$(LIBEXT)
ifeq ($$(strip $$($(1)_INSTALL)),)
-# Platform-specific
+# Platform-specific stuff
+# Don't touch this unless you're changing the way targets are compiled
+# You have been warned
+
CCLD := $(CC)
CGO := go tool cgo
GO := go
$(call quiet,CCLD,$$@) $(BUILD_CFLAGS) $$($(1)_CFLAGS) $$($(1)_OBJ) -o $$@ $(4) $$($(1)_LIBS) $(BUILD_LDFLAGS)
endif
$(1)-clean:
- $(RM) $$($(1)_OBJ) $$($(1)_DEP) $(2)/$(1)$(3) $(1).amalg.c $(1).amalg.o
+ $(RM) $$($(1)_OBJ) $$($(1)_DEP) $(2)/$(1)$(3)
+ifeq ($(6), yes)
+ $(RM) $(1).amalg.c $(1).amalg.o
+endif
$(1)-install: $(2)/$(1)$(3)
$(INSTALL) -d $(PREFIX)/$(5)
$(INSTALL) $$^ $(PREFIX)/$(5)
define find_gopkg
HAS_$(1) := $(shell go list $(2) > /dev/null 2>&1 && echo yes || echo no)
endef
-