From: Marek VavruĊĦa Date: Wed, 25 Nov 2015 23:40:01 +0000 (+0100) Subject: build: fixed fwhole-program, cleanup, flto fix X-Git-Tag: v1.0.0-beta3~72^2~1^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db04c0117ab68d5f0cc587c0334913061028bddf;p=thirdparty%2Fknot-resolver.git build: fixed fwhole-program, cleanup, flto fix --- diff --git a/.travis.yml b/.travis.yml index 9e391f46a..a606acc18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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' diff --git a/Makefile b/Makefile index 44f2313c5..c8bfb7432 100644 --- 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 diff --git a/daemon/daemon.mk b/daemon/daemon.mk index 00e9f2334..04005d389 100644 --- a/daemon/daemon.mk +++ b/daemon/daemon.mk @@ -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)) diff --git a/modules/modules.mk b/modules/modules.mk index 48b383091..57493a203 100644 --- a/modules/modules.mk +++ b/modules/modules.mk @@ -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)),) diff --git a/platform.mk b/platform.mk index 995308b32..5c972ca6b 100644 --- a/platform.mk +++ b/platform.mk @@ -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 -