diff --git a/tool/depot/build b/tool/depot/build index d3b9818b9a..3594dcf448 100755 --- a/tool/depot/build +++ b/tool/depot/build @@ -47,6 +47,9 @@ define HELP_MESSAGE problems. CCACHE=1 Compiler calls will use the C/C++ compiler cache. + + DBG=1 Build 'dbg' archives containing debug info files + in addition to the corresponding 'bin' archives. endef export GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../..) @@ -94,10 +97,19 @@ endif # # Generate makefile for archive-build stage # +# The target pattern rules are needed to make sure that 'build_bin_archive' +# is called only once for each bin/dbg archive pair. +# # determine binary-archive path within the depot _dst_bin_spec_path = $(call archive_user,$1)/bin/$(call bin_archive_spec,$1)/ -dst_archive_path = $(call _dst_bin_spec_path,$1)$(call bin_archive_recipe,$1)/$(call bin_archive_version,$1) +dst_bin_archive_path = $(call _dst_bin_spec_path,$1)$(call bin_archive_recipe,$1)/$(call bin_archive_version,$1) +dst_bin_archive_path_pattern = $(call _dst_bin_spec_path,$1)$(call bin_archive_recipe,$1)/% + +# determine debug-archive path within the depot +_dst_dbg_spec_path = $(call archive_user,$1)/dbg/$(call bin_archive_spec,$1)/ +dst_dbg_archive_path = $(call _dst_dbg_spec_path,$1)$(call bin_archive_recipe,$1)/$(call bin_archive_version,$1) +dst_dbg_archive_path_pattern = $(call _dst_dbg_spec_path,$1)$(call bin_archive_recipe,$1)/% BUILD_MK_FILE := $(DEPOT_DIR)/var/build.mk @@ -105,27 +117,38 @@ BUILD_MK_FILE := $(DEPOT_DIR)/var/build.mk wipe_existing_archives: $(VERBOSE)rm -rf $(addprefix $(DEPOT_DIR)/,\ - $(foreach A,${ARCHIVES(bin)},$(call dst_archive_path,$A))) + $(foreach A,${ARCHIVES(bin)},$(call dst_bin_archive_path,$A))) + $(VERBOSE)rm -rf $(addprefix $(DEPOT_DIR)/,\ + $(foreach A,${ARCHIVES(dbg)},$(call dst_dbg_archive_path,$A))) $(BUILD_MK_FILE): checked_source_archives_exist checked_no_uncategorized $(VERBOSE)mkdir -p $(dir $@) $(VERBOSE)( echo -e "all:\n"; \ echo "TOOL_DIR := $(GENODE_DIR)/tool"; \ $(foreach A,${ARCHIVES(bin)},\ - target=$(call dst_archive_path,$A); \ + bin_target=$(call dst_bin_archive_path,$A); \ + bin_target_pattern=$(call dst_bin_archive_path_pattern,$A); \ + dbg_target=$(call dst_dbg_archive_path,$A); \ + dbg_target_pattern=$(call dst_dbg_archive_path_pattern,$A); \ user=$(call archive_user,$A); \ recipe=$(call bin_archive_recipe,$A); \ version=$(call bin_archive_version,$A); \ spec=$(call bin_archive_spec,$A); \ echo ""; \ - echo "TARGETS += $$target"; \ - echo "TOOL($$target) := build_bin_archive"; \ - echo "ARGS($$target) := $$recipe/$$version USER=$$user SPEC=$$spec"; \ + echo "TARGETS += $$bin_target"; \ + echo "TOOL($$bin_target) := build_bin_archive"; \ + echo "ARGS($$bin_target) := $$recipe/$$version USER=$$user SPEC=$$spec"; \ + echo ""; \ + echo "ifneq (\$$(DBG),)"; \ + echo "TARGETS += $$dbg_target"; \ + echo "TOOL($$dbg_target) := build_bin_archive"; \ + echo "ARGS($$dbg_target) := $$recipe/$$version USER=$$user SPEC=$$spec"; \ + echo "endif"; \ + echo -e "\n$$bin_target_pattern $$dbg_target_pattern:"; \ + echo -e "\t\$$(MAKE) -f \$$(TOOL_DIR)/depot/mk/\$${TOOL(\$$@)}" \ + "\$${ARGS(\$$@)} CCACHE=\$$(CCACHE) VERBOSE=\$$(VERBOSE)\n"; \ ) \ echo -e "\nall: \$$(TARGETS)"; \ - echo -e "\n\$$(TARGETS):"; \ - echo -e "\t\$$(MAKE) -f \$$(TOOL_DIR)/depot/mk/\$${TOOL(\$$@)}" \ - "\$${ARGS(\$$@)} CCACHE=\$$(CCACHE) VERBOSE=\$$(VERBOSE)\n"; \ ) > $@ diff --git a/tool/depot/dependencies b/tool/depot/dependencies index 684ed21e95..2eaff8c0fc 100755 --- a/tool/depot/dependencies +++ b/tool/depot/dependencies @@ -53,6 +53,7 @@ include $(DEPOT_TOOL_DIR)/mk/dependencies.inc # select function for determining the archive version depending on archive type _archive_version(bin) = bin_archive_version +_archive_version(dbg) = bin_archive_version _archive_version(src) = archive_version _archive_version(api) = archive_version _archive_version(raw) = archive_version @@ -60,7 +61,7 @@ _archive_version(pkg) = archive_version _version_defined = ${call ${_archive_version(${call archive_type,$1})},$1} -NEEDED_ARCHIVES := $(foreach TYPE,pkg src raw api bin,${ARCHIVES(${TYPE})}) +NEEDED_ARCHIVES := $(foreach TYPE,pkg src raw api bin dbg,${ARCHIVES(${TYPE})}) # check for completeness of archive-path arguments NO_VERSION_ARCHIVES := $(sort $(foreach A,$(NEEDED_ARCHIVES),\ diff --git a/tool/depot/download b/tool/depot/download index 7be457d160..8815374a41 100755 --- a/tool/depot/download +++ b/tool/depot/download @@ -12,7 +12,10 @@ define HELP_MESSAGE usage: - $(firstword $(MAKEFILE_LIST)) {PUBLIC=} + $(firstword $(MAKEFILE_LIST)) {PUBLIC=} {DBG=1} + + With the optional 'DBG=1' argument, 'dbg' archives are downloaded + in addition to the corresponding 'bin' archives. endef diff --git a/tool/depot/mk/build_bin_archive b/tool/depot/mk/build_bin_archive index b449ee2c05..78f4d82263 100755 --- a/tool/depot/mk/build_bin_archive +++ b/tool/depot/mk/build_bin_archive @@ -12,12 +12,14 @@ define HELP_MESSAGE usage: - $(firstword $(MAKEFILE_LIST)) SPEC= USER= CCACHE= + $(firstword $(MAKEFILE_LIST)) SPEC= USER= CCACHE= DBG= name of the source archive to build build spec, e.g., x86_32, x86_64 identity of the archive creator compiler calls will use the C/C++ compiler cache if this is 1 + build 'dbg' archives containing debug info files in addition + to the corresponding 'bin' archives if this is 1 endef @@ -52,6 +54,7 @@ REP_DIR := $(RECIPE_DIR:/recipes/src/$(ARCHIVE)=) DEPOT_API_DIR := $(DEPOT_DIR)/$(USER)/api DEPOT_SRC_DIR := $(DEPOT_DIR)/$(USER)/src DEPOT_BIN_DIR := $(DEPOT_DIR)/$(USER)/bin +DEPOT_DBG_DIR := $(DEPOT_DIR)/$(USER)/dbg # @@ -119,8 +122,9 @@ endif # Define build-directory location # -DEPOT_ARCHIVE_DIR := $(DEPOT_BIN_DIR)/$(SPEC)/$(VERSIONED_ARCHIVE) -DEPOT_ARCHIVE_BUILD_DIR := $(addsuffix .build,$(DEPOT_ARCHIVE_DIR)) +DEPOT_BIN_ARCHIVE_DIR := $(DEPOT_BIN_DIR)/$(SPEC)/$(VERSIONED_ARCHIVE) +DEPOT_DBG_ARCHIVE_DIR := $(DEPOT_DBG_DIR)/$(SPEC)/$(VERSIONED_ARCHIVE) +DEPOT_ARCHIVE_BUILD_DIR := $(addsuffix .build,$(DEPOT_BIN_ARCHIVE_DIR)) # @@ -209,18 +213,28 @@ $(DEPOT_ARCHIVE_BUILD_DIR)/bin: $(BUILD_CONF) $(SPECS_CONF) $(TOOLS_CONF) $(BUIL $(VERBOSE)$(MAKE) -C $(DEPOT_ARCHIVE_BUILD_DIR) $(BUILD_ARG) ||\ ( $(RM_BUILD_DIR_CMD); false ) +$(DEPOT_ARCHIVE_BUILD_DIR)/debug: $(DEPOT_ARCHIVE_BUILD_DIR)/bin # -# Extract build results from build directory into binary-archive directory +# Extract build results from build directory into binary-archive and +# debug-archive directories # -$(DEPOT_ARCHIVE_DIR): $(DEPOT_ARCHIVE_BUILD_DIR)/bin +$(DEPOT_BIN_ARCHIVE_DIR): $(DEPOT_ARCHIVE_BUILD_DIR)/bin $(VERBOSE)mkdir -p $@ $(VERBOSE)find $< -maxdepth 0 -not -empty -exec cp -rL $ {PUBLIC_DIR=} + $(firstword $(MAKEFILE_LIST)) {PUBLIC_DIR=} {DBG=1} The denotes the archives (and implicitly their dependencies) to publish from the depot to the public directory. @@ -24,6 +24,9 @@ define HELP_MESSAGE The optional 'PUBLIC_DIR' argument defines the location of the public directory. If not specified, '/public/' is used. + With the optional 'DBG=1' argument, 'dbg' archives are published + in addition to the corresponding 'bin' archives. + endef export GENODE_DIR := $(realpath $(dir $(MAKEFILE_LIST))/../..) @@ -43,6 +46,7 @@ include $(DEPOT_TOOL_DIR)/mk/front_end.inc ifneq ($(MAKECMDGOALS),) DEPENDENCIES_CMD := $(DEPOT_TOOL_DIR)/dependencies DEPOT_DIR="$(DEPOT_DIR)" \ DEPOT_TOOL_DIR="$(DEPOT_TOOL_DIR)" \ + DBG="$(DBG)" \ $(MAKECMDGOALS) DEPENDENCIES_RESULT := $(shell $(DEPENDENCIES_CMD) 2> /dev/null || true) endif