diff --git a/doc/build_system.txt b/doc/build_system.txt index 80d3881306..de926c09f3 100644 --- a/doc/build_system.txt +++ b/doc/build_system.txt @@ -362,6 +362,20 @@ in its 'LIBS' declaration and refers to the tools relative to '$(BUILD_BASE_DIR)'. +Building additional custom targets accompanying library or program +================================================================== + +There are cases when it is important to build additional targets +besides standard files built for library or program. Of course there +is no problem with writing specific make rules for commands that +generate those target files but for them to be built a proper +dependency must be specified. To achieve it those additional targets +should be added to 'CUSTOM_TARGET_DEPS' variable like e.g. in +iwl_firmware library from dde_linux repository: + +! CUSTOM_TARGET_DEPS += $(addprefix $(BIN_DIR)/,$(IMAGES)) + + Automated integration and testing ################################# diff --git a/repos/base/mk/lib.mk b/repos/base/mk/lib.mk index 228fd119ee..0958e6626c 100644 --- a/repos/base/mk/lib.mk +++ b/repos/base/mk/lib.mk @@ -165,6 +165,11 @@ all: $(LIB_TAG) # $(LIB_TAG) $(OBJECTS): $(HOST_TOOLS) +# +# Trigger build of additional library specific targets +# +$(LIB_TAG): $(CUSTOM_TARGET_DEPS) + $(LIB_TAG): $(LIB_A) $(LIB_SO) $(LIB_CHECKED) $(ABI_SO) $(INSTALL_SO) $(DEBUG_SO) @touch $@ diff --git a/repos/base/mk/prg.mk b/repos/base/mk/prg.mk index 04caae01b2..58f57c759c 100644 --- a/repos/base/mk/prg.mk +++ b/repos/base/mk/prg.mk @@ -180,6 +180,11 @@ LINK_ITEMS_BRIEF := $(subst $(LIB_CACHE_DIR),$$libs,$(LINK_ITEMS)) # $(LINK_ITEMS) $(TARGET): $(HOST_TOOLS) +# +# Trigger build of additional program specific targets +# +$(TARGET): $(CUSTOM_TARGET_DEPS) + LD_CMD += -Wl,--whole-archive -Wl,--start-group LD_CMD += $(LINK_ITEMS_BRIEF) LD_CMD += $(EXT_OBJECTS)