diff --git a/src/prorab.mk b/src/prorab.mk index d810729..dec54a0 100644 --- a/src/prorab.mk +++ b/src/prorab.mk @@ -849,6 +849,12 @@ $(.RECIPEPREFIX)$(a)rm -rf $(prorab_this_obj_dir) $(eval prorab_ldflags := $(this_ldflags) $(prorab_private_ldflags)) $(eval prorab_ldlibs := $(this_ldlibs)) + # Find libraries specified as a path to a static or shared library file. + # These will be added as dependencies of the final binary being built. + $(eval prorab_private_dep_libs := $(filter %.a,$(prorab_ldlibs)) $(filter %$(dot_so),$(prorab_ldlibs))) + $(eval prorab_private_dep_libs := $(foreach deplib,$(prorab_private_dep_libs),$(if $(filter /%,$(deplib)),$(deplib),$(d)$(deplib))) ) + $(eval prorab_private_dep_libs := $(abspath $(prorab_private_dep_libs))) + $(eval prorab_ldargs_file := $(prorab_this_obj_dir)ldargs.txt) $(call prorab-private-args-file-rules, $(prorab_ldargs_file),$(this_cc) $(prorab_ldflags) $(prorab_ldlibs)) @@ -862,7 +868,7 @@ $(.RECIPEPREFIX)$(a)rm -rf $(prorab_this_obj_dir) # this is needed to avoid problems when adding dependencies to the symbolic link name, thus the dependency will effectively be added # to the binary name. # this is why we build the binary and create symbolic link in the same recepie. - $(prorab_this_name): $(prorab_this_objs) $(prorab_ldargs_file) $(prorab_objs_file) + $(prorab_this_name): $(prorab_this_objs) $(prorab_ldargs_file) $(prorab_objs_file) $(prorab_private_dep_libs) $(.RECIPEPREFIX)@test -t 1 && printf "\e[0;31mlink\e[0m $(patsubst $(prorab_root_dir)%,%,$(prorab_private_this_binary_name))\n" || printf "link $(patsubst $(prorab_root_dir)%,%,$(prorab_private_this_binary_name))\n" $(.RECIPEPREFIX)$(a)mkdir -p $(d)$(prorab_private_out_dir) $(.RECIPEPREFIX)$(a)(cd $(d) && $(this_cc) $(prorab_ldflags) $$(filter %.o,$$^) $(prorab_ldlibs) -o "$(prorab_private_this_binary_name)") diff --git a/tests/cli_args_paths/prj/app/makefile b/tests/cli_args_paths/prj/app/makefile index 67a5944..f4eae32 100644 --- a/tests/cli_args_paths/prj/app/makefile +++ b/tests/cli_args_paths/prj/app/makefile @@ -13,12 +13,8 @@ this_cflags += -I ../lib this_cxxflags += -ffile-prefix-map=$(d)= this_cflags += -ffile-prefix-map=$(d)= -this_ldflags += -L ../lib/out - -this_ldlibs += -lstdc++ -lstuff +this_ldlibs += -lstdc++ ../lib/out/libstuff$(dot_so) $(eval $(prorab-build-app)) -$(eval $(call prorab-depend, $(prorab_this_name), ../lib/out/libstuff$(dot_so) )) - $(eval $(call prorab-include, ../lib/makefile)) diff --git a/tests/lib_depends_on_lib/src/lib2/makefile b/tests/lib_depends_on_lib/src/lib2/makefile index 34515fa..b525755 100644 --- a/tests/lib_depends_on_lib/src/lib2/makefile +++ b/tests/lib_depends_on_lib/src/lib2/makefile @@ -12,8 +12,8 @@ this_cxxflags += -fPIC this_no_install := true -$(eval $(prorab-build-lib)) +this_ldlibs += ../lib1/build/liblib1$(dot_so) -$(eval $(call prorab-depend, $(prorab_this_name), ../lib1/build/liblib1$(dot_so))) +$(eval $(prorab-build-lib)) $(eval $(call prorab-include, ../lib1/makefile)) diff --git a/wiki/Reference.adoc b/wiki/Reference.adoc index f6a48ea..e001efa 100644 --- a/wiki/Reference.adoc +++ b/wiki/Reference.adoc @@ -529,7 +529,7 @@ $(eval $(prorab-build-app)) - `this_asflags` - assembler flags. Defaults to `$(ASFLAGS)`. Relative to `$(d)`. - `this_as_supports_deps_gen` - enable dependency rules generation from `.include` assembler directives. Defaults to `true`. - `this_ldflags` - linker flags. Defaults to `$(LDFLAGS)`. Relative to `$(d)`. -- `this_ldlibs` - linker libraries. Defaults to `$(LDLIBS) $(LIBS)`. Relative to `$(d)`. +- `this_ldlibs` - linker libraries as they are passed to the linker. Defaults to `$(LDLIBS) $(LIBS)`. Relative to `$(d)`. All libraries specified as a path to a file will be added as dependencies of the final binary which is being built. - `this_cppflags` - preprocessor flags. Defaults to `$(CPPFLAGS)`. Relative to `$(d)`. - `this_out_dir` - output directory. This is where all the build artefacts are to be stored. Relative to `$(d)`. Defaults to `./`. - `this_no_install` - disable `install` targets. Can be `true` or `false`. Defaults to `false`. @@ -651,7 +651,7 @@ $(eval $(prorab-build-lib)) - `this_asflags` - assembler flags. Defaults to `$(ASFLAGS)`. Relative to `$(d)`. - `this_as_supports_deps_gen` - enable dependency rules generation for `.include` assembler directives. Defaults to `true`. - `this_ldflags` - linker flags. Defaults to `$(LDFLAGS)`. Relative to `$(d)`. -- `this_ldlibs` - linker libraries. Defaults to `$(LDLIBS) $(LIBS)`. Relative to `$(d)`. +- `this_ldlibs` - linker libraries as they are passed to the linker. Defaults to `$(LDLIBS) $(LIBS)`. Relative to `$(d)`. All libraries specified as a path to a file will be added as dependencies of the final binary which is being built. - `this_cppflags` - preprocessor flags. Defaults to `$(CPPFLAGS)`. Relative to `$(d)`. - `this_out_dir` - output directory. This is where all the build artefacts are to be stored. Relative to `$(d)`. Defaults to `./`. - `this_no_install` - disable `install` targets. Can be `true` or `false`. Defaults to `false`.