Commit 17527296 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Allow for <mod>-y as well as <mod>-objs for multipart objects.

Traditionally, the individual components of a multipart module are
listed in <mod>-objs. Allow for using <mod>-y as well, as that turns
out to simplify declaring optional parts of multi-part modules, see
the converted examples in net/*/Makefile.

This change is backwards-compatible, i.e. not converted Makefiles
still work just fine.
parent 52d6eeb2
......@@ -8,7 +8,6 @@ obj-$(CONFIG_ATALK) += appletalk.o
appletalk-y := aarp.o ddp.o atalk_proc.o
appletalk-$(CONFIG_SYSCTL) += sysctl_net_atalk.o
appletalk-objs := $(appletalk-y)
include $(TOPDIR)/Rules.make
......@@ -11,7 +11,6 @@ ax25-y := ax25_addr.o ax25_dev.o ax25_iface.o ax25_in.o ax25_ip.o ax25_out.o \
ax25_subr.o ax25_timer.o ax25_uid.o af_ax25.o
ax25-$(CONFIG_AX25_DAMA_SLAVE) += ax25_ds_in.o ax25_ds_subr.o ax25_ds_timer.o
ax25-$(CONFIG_SYSCTL) += sysctl_net_ax25.o
ax25-objs := $(ax25-y)
include $(TOPDIR)/Rules.make
......@@ -4,8 +4,7 @@
obj-$(CONFIG_BT_RFCOMM) += rfcomm.o
rfcomm-y := core.o sock.o crc.o
rfcomm-y := core.o sock.o crc.o
rfcomm-$(CONFIG_BT_RFCOMM_TTY) += tty.o
rfcomm-objs := $(rfcomm-y)
include $(TOPDIR)/Rules.make
......@@ -5,7 +5,6 @@ decnet-y := af_decnet.o dn_nsp_in.o dn_nsp_out.o dn_route.o dn_dev.o dn_neigh.o
decnet-$(CONFIG_DECNET_ROUTER) += dn_fib.o dn_rules.o dn_table.o
decnet-$(CONFIG_DECNET_FW) += dn_fw.o
decnet-y += sysctl_net_decnet.o
decnet-objs := $(decnet-y)
include $(TOPDIR)/Rules.make
......@@ -6,6 +6,5 @@ obj-$(CONFIG_IPX) += ipx.o
ipx-y := af_ipx.o ipx_proc.o
ipx-$(CONFIG_SYSCTL) += sysctl_net_ipx.o
ipx-objs := $(ipx-y)
include $(TOPDIR)/Rules.make
......@@ -15,6 +15,5 @@ irda-y := iriap.o iriap_event.o irlmp.o irlmp_event.o irlmp_frame.o \
discovery.o parameters.o irsyms.o
irda-$(CONFIG_PROC_FS) += irproc.o
irda-$(CONFIG_SYSCTL) += irsysctl.o
irda-objs := $(irda-y)
include $(TOPDIR)/Rules.make
......@@ -18,7 +18,6 @@ llc-y := llc_if.o llc_c_ev.o llc_c_ac.o llc_mac.o llc_sap.o llc_s_st.o \
llc_main.o llc_s_ac.o llc_conn.o llc_c_st.o llc_stat.o llc_actn.o \
llc_s_ev.o llc_evnt.o llc_pdu.o llc_proc.o
llc-$(CONFIG_LLC_UI) += af_llc.o
llc-objs := $(llc-y)
# Objects that export symbols.
export-objs := llc_if.o
......
......@@ -7,7 +7,6 @@ obj-$(CONFIG_NETROM) += netrom.o
netrom-y := af_netrom.o nr_dev.o nr_in.o nr_loopback.o \
nr_out.o nr_route.o nr_subr.o nr_timer.o
netrom-$(CONFIG_SYSCTL) += sysctl_net_netrom.o
netrom-objs := $(netrom-y)
include $(TOPDIR)/Rules.make
......@@ -7,7 +7,6 @@ obj-$(CONFIG_ROSE) += rose.o
rose-y := af_rose.o rose_dev.o rose_in.o rose_link.o rose_loopback.o \
rose_out.o rose_route.o rose_subr.o rose_timer.o
rose-$(CONFIG_SYSCTL) += sysctl_net_rose.o
rose-objs := $(rose-y)
include $(TOPDIR)/Rules.make
......@@ -23,6 +23,4 @@ sctp-$(CONFIG_SYSCTL) += sysctl.o
sctp-$(subst m,y,$(CONFIG_IPV6)) += ipv6.o
sctp-objs := $(sctp-y)
include $(TOPDIR)/Rules.make
......@@ -13,6 +13,5 @@ sunrpc-y := clnt.o xprt.o sched.o \
sunrpc_syms.o cache.o
sunrpc-$(CONFIG_PROC_FS) += stats.o
sunrpc-$(CONFIG_SYSCTL) += sysctl.o
sunrpc-objs := $(sunrpc-y)
include $(TOPDIR)/Rules.make
......@@ -6,7 +6,6 @@ obj-$(CONFIG_UNIX) += unix.o
unix-y := af_unix.o garbage.o
unix-$(CONFIG_SYSCTL) += sysctl_net_unix.o
unix-objs := $(unix-y)
include $(TOPDIR)/Rules.make
......@@ -8,7 +8,6 @@ x25-y := af_x25.o x25_dev.o x25_facilities.o x25_in.o \
x25_link.o x25_out.o x25_route.o x25_subr.o \
x25_timer.o x25_proc.o
x25-$(CONFIG_SYSCTL) += sysctl_net_x25.o
x25-objs := $(x25-y)
include $(TOPDIR)/Rules.make
......@@ -77,21 +77,21 @@ __obj-y = $(filter-out export.o,$(obj-y))
__obj-m = $(filter-out export.o,$(obj-m))
# if $(foo-objs) exists, foo.o is a composite object
multi-used-y := $(sort $(foreach m,$(__obj-y), $(if $($(m:.o=-objs)), $(m))))
multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $($(m:.o=-objs)), $(m))))
multi-used-y := $(sort $(foreach m,$(__obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m))))
# Build list of the parts of our composite objects, our composite
# objects depend on those (obviously)
multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)))
multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)))
multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)) $($(m:.o=-y)))
multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)) $($(m:.o=-y)))
# $(subdir-obj-y) is the list of objects in $(obj-y) which do not live
# in the local directory
subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)))
# Replace multi-part objects by their individual parts, look at local dir only
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) $(EXTRA_TARGETS)
real-objs-m := $(foreach m, $(obj-m), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m)))
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(EXTRA_TARGETS)
real-objs-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
# Only build module versions for files which are selected to be built
export-objs := $(filter $(export-objs),$(real-objs-y) $(real-objs-m))
......@@ -249,7 +249,7 @@ endif
#
quiet_cmd_link_multi = LD $@
cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs)))),$^)
cmd_link_multi = $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(addprefix $(obj)/,$($(subst $(obj)/,,$(@:.o=-objs))) $($(subst $(obj)/,,$(@:.o=-y)))),$^)
# We would rather have a list of rules like
# foo.o: $(foo-objs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment