MAKEFILES = $(TOPDIR)/.config
GENKSYMS = /sbin/genksyms
DEPMOD = /sbin/depmod
+PERL = perl
MODFLAGS = -DMODULE
CFLAGS_MODULE = $(MODFLAGS)
AFLAGS_MODULE =
CFLAGS_KERNEL =
AFLAGS_KERNEL =
-PERL = perl
+EXPORT_FLAGS =
export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HPATH HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE MAKEFILES GENKSYMS PERL
+export CPPFLAGS EXPORT_FLAGS
+export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
+export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
+
all: do-it-all
#
-fomit-frame-pointer -fno-strict-aliasing -fno-common
AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
+ifdef CONFIG_MODULES
+EXPORT_FLAGS := -DEXPORT_SYMTAB
+endif
+
INIT =init/init.o
CORE_FILES =kernel/kernel.o mm/mm.o fs/fs.o ipc/ipc.o
NETWORKS =net/network.o
include arch/$(ARCH)/Makefile
-export CPPFLAGS
-export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
-export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
-
export NETWORKS DRIVERS LIBS HEAD LDFLAGS LINKFLAGS MAKEBOOT ASFLAGS
# boot target
__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 $($(basename $(m))-objs), $(m))))
-__multi-used-m := $(sort $(foreach m,$(__obj-m), $(if $($(basename $(m))-objs), $(m))))
+__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))))
# FIXME: Rip this out later
# Backwards compatibility: if a composite object is listed in
# Build list of the parts of our composite objects, our composite
# objects depend on those (obviously)
-multi-objs-y := $(foreach m, $(multi-used-y), $($(basename $(m))-objs))
-multi-objs-m := $(foreach m, $(multi-used-m), $($(basename $(m))-objs))
+multi-objs-y := $(foreach m, $(multi-used-y), $($(m:.o=-objs)))
+multi-objs-m := $(foreach m, $(multi-used-m), $($(m:.o=-objs)))
+# $(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)))
+real-objs-m := $(foreach m, $(obj-m), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m)))
# ==========================================================================
#
# Compile C sources (.c)
# ---------------------------------------------------------------------------
-# export_flags will be set to -DEXPORT_SYMBOL for objects in $(export-objs)
+$(export-objs): export_flags := $(EXPORT_FLAGS)
c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(export_flags)
%.o: %.c dummy
$(call if_changed,cmd_cc_o_c)
-
# Compile assembler sources (.S)
# ---------------------------------------------------------------------------
#
all_targets: $(O_TARGET) $(L_TARGET) sub_dirs
-# $(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)))
-# Do build these objects, we need to descend into the directories
+# To build objects in subdirs, we need to descend into the directories
$(subdir-obj-y): sub_dirs
#
ifneq "$(strip $(export-objs))" ""
$(export-objs): $(TOPDIR)/include/linux/modversions.h
-$(export-objs): export_flags := -DEXPORT_SYMTAB
endif