]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
build: fixed fwhole-program, cleanup, flto fix
authorMarek Vavruša <marek.vavrusa@nic.cz>
Wed, 25 Nov 2015 23:40:01 +0000 (00:40 +0100)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Thu, 26 Nov 2015 14:34:39 +0000 (15:34 +0100)
.travis.yml
Makefile
daemon/daemon.mk
modules/modules.mk
platform.mk

index 9e391f46a8506cef09c7763cd43c09cced3d4b80..a606acc181e85af7bb207a826d6750db785c88a6 100644 (file)
@@ -30,9 +30,8 @@ env:
 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'
index 44f2313c5cc21880fa6838f049a84ce29af9b04c..c8bfb74324e647b868beb0d0ab6325581d5f46d5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,9 +3,9 @@ include platform.mk
 
 # 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
 
index 00e9f2334fb2d2f36a6597ed0fe96372dfdec06d..04005d389a83a92169ab48e5b2b2d7928c9cd65a 100644 (file)
@@ -11,22 +11,21 @@ kresd_SOURCES := \
        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))
index 48b383091fee7957cb6bc404ef3dd8250c7f09ce..57493a2030838787fd5ec853e3546328578ea85e 100644 (file)
@@ -55,11 +55,14 @@ define make_go_module
 $(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)),)
index 995308b32bcf7058b482eb03b1ee1ef89f0c228a..5c972ca6b193b177010575d13b31626619adcfed 100644 (file)
@@ -1,4 +1,7 @@
-# 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
@@ -72,7 +75,10 @@ else
        $(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)
@@ -144,4 +150,3 @@ endef
 define find_gopkg
        HAS_$(1) := $(shell go list $(2) > /dev/null 2>&1 && echo yes || echo no)
 endef
-