kbuild: support 'userldlibs' syntax
This syntax is useful to specify libraries linked to all userspace programs in the Makefile. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
1bfaa37fd3
commit
5f56cb030e
|
@ -937,6 +937,10 @@ Example::
|
||||||
# net/bpfilter/Makefile
|
# net/bpfilter/Makefile
|
||||||
bpfilter_umh-userldflags += -static
|
bpfilter_umh-userldflags += -static
|
||||||
|
|
||||||
|
To specify libraries linked to a userspace program, you can use
|
||||||
|
``<executable>-userldlibs``. The ``userldlibs`` syntax specifies libraries
|
||||||
|
linked to all userspace programs created in the current Makefile.
|
||||||
|
|
||||||
When linking bpfilter_umh, it will be passed the extra option -static.
|
When linking bpfilter_umh, it will be passed the extra option -static.
|
||||||
|
|
||||||
From command line, :ref:`USERCFLAGS and USERLDFLAGS <userkbuildflags>` will also be used.
|
From command line, :ref:`USERCFLAGS and USERLDFLAGS <userkbuildflags>` will also be used.
|
||||||
|
|
|
@ -19,19 +19,19 @@ user-cobjs := $(addprefix $(obj)/, $(user-cobjs))
|
||||||
user_ccflags = -Wp,-MMD,$(depfile) $(KBUILD_USERCFLAGS) $(userccflags) \
|
user_ccflags = -Wp,-MMD,$(depfile) $(KBUILD_USERCFLAGS) $(userccflags) \
|
||||||
$($(target-stem)-userccflags)
|
$($(target-stem)-userccflags)
|
||||||
user_ldflags = $(KBUILD_USERLDFLAGS) $(userldflags) $($(target-stem)-userldflags)
|
user_ldflags = $(KBUILD_USERLDFLAGS) $(userldflags) $($(target-stem)-userldflags)
|
||||||
|
user_ldlibs = $(userldlibs) $($(target-stem)-userldlibs)
|
||||||
|
|
||||||
# Create an executable from a single .c file
|
# Create an executable from a single .c file
|
||||||
quiet_cmd_user_cc_c = CC [U] $@
|
quiet_cmd_user_cc_c = CC [U] $@
|
||||||
cmd_user_cc_c = $(CC) $(user_ccflags) $(user_ldflags) -o $@ $< \
|
cmd_user_cc_c = $(CC) $(user_ccflags) $(user_ldflags) -o $@ $< \
|
||||||
$($(target-stem)-userldlibs)
|
$(user_ldlibs)
|
||||||
$(user-csingle): $(obj)/%: $(src)/%.c FORCE
|
$(user-csingle): $(obj)/%: $(src)/%.c FORCE
|
||||||
$(call if_changed_dep,user_cc_c)
|
$(call if_changed_dep,user_cc_c)
|
||||||
|
|
||||||
# Link an executable based on list of .o files
|
# Link an executable based on list of .o files
|
||||||
quiet_cmd_user_ld = LD [U] $@
|
quiet_cmd_user_ld = LD [U] $@
|
||||||
cmd_user_ld = $(CC) $(user_ldflags) -o $@ \
|
cmd_user_ld = $(CC) $(user_ldflags) -o $@ \
|
||||||
$(addprefix $(obj)/, $($(target-stem)-objs)) \
|
$(addprefix $(obj)/, $($(target-stem)-objs)) $(user_ldlibs)
|
||||||
$($(target-stem)-userldlibs)
|
|
||||||
$(user-cmulti): FORCE
|
$(user-cmulti): FORCE
|
||||||
$(call if_changed,user_ld)
|
$(call if_changed,user_ld)
|
||||||
$(call multi_depend, $(user-cmulti), , -objs)
|
$(call multi_depend, $(user-cmulti), , -objs)
|
||||||
|
|
Loading…
Reference in New Issue