diff --git a/depends/Makefile b/depends/Makefile index f5fb5b865f..fc763bedeb 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -22,6 +22,12 @@ host:=$(HOST) host_toolchain:=$(HOST)- endif +ifneq ($(DEBUG),) +release_type=debug +else +release_type=release +endif + base_build_dir=$(BASEDIR)/work/build base_staging_dir=$(BASEDIR)/work/staging canonical_host:=$(shell ./config.sub $(HOST)) @@ -103,12 +109,14 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_ -e 's|@STRIP@|$(toolchain_path)$(host_STRIP)|' \ -e 's|@build_os@|$(build_os)|' \ -e 's|@host_os@|$(host_os)|' \ - -e 's|@CFLAGS@|$(host_CFLAGS)|' \ - -e 's|@CXXFLAGS@|$(host_CXXFLAGS)|' \ - -e 's|@LDFLAGS@|$(host_LDFLAGS)|' \ + -e 's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \ + -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \ + -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \ + -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \ -e 's|@no_qt@|$(NO_QT)|' \ -e 's|@no_wallet@|$(NO_WALLET)|' \ -e 's|@no_upnp@|$(NO_UPNP)|' \ + -e 's|@debug@|$(DEBUG)|' \ $< > $@ $(AT)touch $@ diff --git a/depends/config.site.in b/depends/config.site.in index 1df04eec3f..abd814ea65 100644 --- a/depends/config.site.in +++ b/depends/config.site.in @@ -81,4 +81,7 @@ fi if test -n "@CXXFLAGS@"; then export CXXFLAGS="@CXXFLAGS@ $CXXFLAGS" fi +if test -n "@CPPFLAGS@"; then + export CPPFLAGS="@CPPFLAGS@ $CPPFLAGS" +fi export LDFLAGS="-L$prefix/lib @LDFLAGS@ $LDFLAGS" diff --git a/depends/funcs.mk b/depends/funcs.mk index 28bfb85492..c1fc0a0e33 100644 --- a/depends/funcs.mk +++ b/depends/funcs.mk @@ -8,10 +8,10 @@ $(1)_ar=$($($(1)_type)_AR) $(1)_ranlib=$($($(1)_type)_RANLIB) $(1)_libtool=$($($(1)_type)_LIBTOOL) $(1)_nm=$($($(1)_type)_NM) -$(1)_cflags=$($($(1)_type)_CFLAGS) -$(1)_cxxflags=$($($(1)_type)_CXXFLAGS) -$(1)_ldflags=$($($(1)_type)_LDFLAGS) -L$($($(1)_type)_prefix)/lib -$(1)_cppflags:=-I$($($(1)_type)_prefix)/include +$(1)_cflags=$($($(1)_type)_CFLAGS) $($($(1)_type)_$(release_type)_CFLAGS) +$(1)_cxxflags=$($($(1)_type)_CXXFLAGS) $($($(1)_type)_$(release_type)_CXXFLAGS) +$(1)_ldflags=$($($(1)_type)_LDFLAGS) $($($(1)_type)_$(release_type)_LDFLAGS) -L$($($(1)_type)_prefix)/lib +$(1)_cppflags=$($($(1)_type)_CPPFLAGS) $($($(1)_type)_$(release_type)_CPPFLAGS) -I$($($(1)_type)_prefix)/include $(1)_recipe_hash:= endef @@ -38,7 +38,7 @@ define int_get_build_id $(eval $(1)_dependencies += $($(1)_$(host_arch)_$(host_os)_dependencies) $($(1)_$(host_os)_dependencies)) $(eval $(1)_all_dependencies:=$(call int_get_all_dependencies,$(1),$($($(1)_type)_native_toolchain) $($(1)_dependencies))) $(foreach dep,$($(1)_all_dependencies),$(eval $(1)_build_id_deps+=$(dep)-$($(dep)_version)-$($(dep)_recipe_hash))) -$(eval $(1)_build_id_long:=$(1)-$($(1)_version)-$($(1)_recipe_hash) $($(1)_build_id_deps)) +$(eval $(1)_build_id_long:=$(1)-$($(1)_version)-$($(1)_recipe_hash)-$(release_type) $($(1)_build_id_deps)) $(eval $(1)_build_id:=$(shell echo -n "$($(1)_build_id_long)" | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH))) final_build_id_long+=$($(package)_build_id_long) @@ -83,33 +83,40 @@ endef define int_config_attach_build_config $(eval $(call $(1)_set_vars,$(1))) -$(1)_cflags+=$($(1)_cflags_$(host_arch)) -$(1)_cflags+=$($(1)_cflags_$(host_os)) -$(1)_cflags+=$($(1)_cflags_$(host_arch)_$(host_os)) - -$(1)_cxxflags+=$($(1)_cxxflags_$(host_arch)) -$(1)_cxxflags+=$($(1)_cxxflags_$(host_os)) -$(1)_cxxflags+=$($(1)_cxxflags_$(host_arch)_$(host_os)) - -$(1)_cppflags+=$($(1)_cppflags_$(host_arch)) -$(1)_cppflags+=$($(1)_cppflags_$(host_os)) -$(1)_cppflags+=$($(1)_cppflags_$(host_arch)_$(host_os)) - -$(1)_ldflags+=$($(1)_ldflags_$(host_arch)) -$(1)_ldflags+=$($(1)_ldflags_$(host_os)) -$(1)_ldflags+=$($(1)_ldflags_$(host_arch)_$(host_os)) - -$(1)_build_opts+=$$($(1)_build_opts_$(host_arch)) -$(1)_build_opts+=$$($(1)_build_opts_$(host_os)) -$(1)_build_opts+=$$($(1)_build_opts_$(host_arch)_$(host_os)) - -$(1)_config_opts+=$$($(1)_config_opts_$(host_arch)) -$(1)_config_opts+=$$($(1)_config_opts_$(host_os)) -$(1)_config_opts+=$$($(1)_config_opts_$(host_arch)_$(host_os)) - -$(1)_config_env+=$($(1)_config_env_$(host_arch)) -$(1)_config_env+=$($(1)_config_env_$(host_os)) -$(1)_config_env+=$($(1)_config_env_$(host_arch)_$(host_os)) +$(1)_cflags+=$($(1)_cflags_$(release_type)) +$(1)_cflags+=$($(1)_cflags_$(host_arch)) $($(1)_cflags_$(host_arch)_$(release_type)) +$(1)_cflags+=$($(1)_cflags_$(host_os)) $($(1)_cflags_$(host_os)_$(release_type)) +$(1)_cflags+=$($(1)_cflags_$(host_arch)_$(host_os)) $($(1)_cflags_$(host_arch)_$(host_os)_$(release_type)) + +$(1)_cxxflags+=$($(1)_cxxflags_$(release_type)) +$(1)_cxxflags+=$($(1)_cxxflags_$(host_arch)) $($(1)_cxxflags_$(host_arch)_$(release_type)) +$(1)_cxxflags+=$($(1)_cxxflags_$(host_os)) $($(1)_cxxflags_$(host_os)_$(release_type)) +$(1)_cxxflags+=$($(1)_cxxflags_$(host_arch)_$(host_os)) $($(1)_cxxflags_$(host_arch)_$(host_os)_$(release_type)) + +$(1)_cppflags+=$($(1)_cppflags_$(release_type)) +$(1)_cppflags+=$($(1)_cppflags_$(host_arch)) $($(1)_cppflags_$(host_arch)_$(release_type)) +$(1)_cppflags+=$($(1)_cppflags_$(host_os)) $($(1)_cppflags_$(host_os)_$(release_type)) +$(1)_cppflags+=$($(1)_cppflags_$(host_arch)_$(host_os)) $($(1)_cppflags_$(host_arch)_$(host_os)_$(release_type)) + +$(1)_ldflags+=$($(1)_ldflags_$(release_type)) +$(1)_ldflags+=$($(1)_ldflags_$(host_arch)) $($(1)_ldflags_$(host_arch)_$(release_type)) +$(1)_ldflags+=$($(1)_ldflags_$(host_os)) $($(1)_ldflags_$(host_os)_$(release_type)) +$(1)_ldflags+=$($(1)_ldflags_$(host_arch)_$(host_os)) $($(1)_ldflags_$(host_arch)_$(host_os)_$(release_type)) + +$(1)_build_opts+=$$($(1)_build_opts_$(release_type)) +$(1)_build_opts+=$$($(1)_build_opts_$(host_arch)) $$($(1)_build_opts_$(host_arch)_$(release_type)) +$(1)_build_opts+=$$($(1)_build_opts_$(host_os)) $$($(1)_build_opts_$(host_os)_$(release_type)) +$(1)_build_opts+=$$($(1)_build_opts_$(host_arch)_$(host_os)) $$($(1)_build_opts_$(host_arch)_$(host_os)_$(release_type)) + +$(1)_config_opts+=$$($(1)_config_opts_$(release_type)) +$(1)_config_opts+=$$($(1)_config_opts_$(host_arch)) $$($(1)_config_opts_$(host_arch)_$(release_type)) +$(1)_config_opts+=$$($(1)_config_opts_$(host_os)) $$($(1)_config_opts_$(host_os)_$(release_type)) +$(1)_config_opts+=$$($(1)_config_opts_$(host_arch)_$(host_os)) $$($(1)_config_opts_$(host_arch)_$(host_os)_$(release_type)) + +$(1)_config_env+=$$($(1)_config_env_$(release_type)) +$(1)_config_env+=$($(1)_config_env_$(host_arch)) $($(1)_config_env_$(host_arch)_$(release_type)) +$(1)_config_env+=$($(1)_config_env_$(host_os)) $($(1)_config_env_$(host_os)_$(release_type)) +$(1)_config_env+=$($(1)_config_env_$(host_arch)_$(host_os)) $($(1)_config_env_$(host_arch)_$(host_os)_$(release_type)) $(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig $(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig diff --git a/depends/hosts/default.mk b/depends/hosts/default.mk index b9fe5d858a..6f60d6b3fd 100644 --- a/depends/hosts/default.mk +++ b/depends/hosts/default.mk @@ -11,13 +11,16 @@ default_host_NM = $(host_toolchain)nm define add_host_tool_func $(host_os)_$1?=$$(default_host_$1) $(host_arch)_$(host_os)_$1?=$$($(host_os)_$1) +$(host_arch)_$(host_os)_$(release_type)_$1?=$$($(host_os)_$1) host_$1=$$($(host_arch)_$(host_os)_$1) endef define add_host_flags_func $(host_arch)_$(host_os)_$1 += $($(host_os)_$1) +$(host_arch)_$(host_os)_$(release_type)_$1 += $($(host_os)_$(release_type)_$1) host_$1 = $$($(host_arch)_$(host_os)_$1) +host_$(release_type)_$1 = $$($(host_arch)_$(host_os)_$(release_type)_$1) endef $(foreach tool,CC CXX AR RANLIB STRIP NM LIBTOOL OTOOL INSTALL_NAME_TOOL,$(eval $(call add_host_tool_func,$(tool)))) -$(foreach flags,CFLAGS CXXFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags)))) +$(foreach flags,CFLAGS CXXFLAGS CPPFLAGS LDFLAGS, $(eval $(call add_host_flags_func,$(flags))))