--- ./arch/um/Makefile.user_obj 2003-12-13 18:36:36.000000000 +0100 +++ ./arch/um/Makefile 2003-12-24 18:18:22.000000000 +0100 @@ -13,10 +13,6 @@ # EXTRAVERSION... MODLIB := $(INSTALL_MOD_PATH)/lib/modules/$(KERNELRELEASE) -ifeq ($(CONFIG_DEBUG_INFO),y) -CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS)) -endif - core-y += $(ARCH_DIR)/kernel/ \ $(ARCH_DIR)/drivers/ \ $(ARCH_DIR)/sys-$(SUBARCH)/ @@ -129,13 +125,18 @@ USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \ $(MODE_INCLUDE) -# To get a definition of F_SETSIG -USER_CFLAGS += -D_GNU_SOURCE +#From main Makefile, these options are set after including the ARCH makefile. +#So copy them here. +ifndef CONFIG_FRAME_POINTER +USER_CFLAGS += -fomit-frame-pointer +endif ifdef CONFIG_DEBUG_INFO -USER_CFLAGS += -g +USER_CFLAGS += -g endif +# To get a definition of F_SETSIG +USER_CFLAGS += -D_GNU_SOURCE CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/uml.lds.s \ $(ARCH_DIR)/dyn_link.ld.s $(ARCH_DIR)/include/uml-config.h \ --- ./fs/hostfs/Makefile.user_obj 2003-12-19 18:40:23.000000000 +0100 +++ ./fs/hostfs/Makefile 2003-12-24 16:47:25.000000000 +0100 @@ -15,15 +15,10 @@ obj-y = obj-$(CONFIG_HOSTFS) += hostfs.o -SINGLE_OBJS = $(foreach f,$(patsubst %.o,%,$(obj-y) $(obj-m)),$($(f)-objs)) +# Here we aren't in arch/um, so list explicitly files. +UML_USER_OBJS := hostfs_user.o -USER_OBJS := $(filter %_user.o,$(obj-y) $(obj-m) $(SINGLE_OBJS)) -USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) - -USER_CFLAGS += -DSTAT64_INO_FIELD=$(STAT64_INO_FIELD) - -$(USER_OBJS) : %.o: %.c - $(CC) $(CFLAGS_$(notdir $@)) $(USER_CFLAGS) -c -o $@ $< +CFLAGS_hostfs_user.o += -DSTAT64_INO_FIELD=$(STAT64_INO_FIELD) clean: --- ./scripts/Makefile.lib.user_obj 2003-10-01 21:25:17.000000000 +0200 +++ ./scripts/Makefile.lib 2003-12-24 16:39:18.000000000 +0100 @@ -136,8 +136,22 @@ basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname)))) +#For UML + +#UML_USER_OBJS += $(foreach i,$(_UML_USER_OBJS),$(filter-out $(subst arch/um,,$(i)),$(i))) +#UML_USER_OBJS += $(_UML_USER_OBJS) + +#With filter-out we add only files if dir is not changed by subst, i.e. is not in arch/um + +_UML_USER_OBJS = $(filter %_user.o,$(obj-y) $(obj-m) $(multi-objs)) +UML_USER_OBJS += $(if $(filter-out $(subst arch/um,,$(obj)),$(obj)),\ + $(_UML_USER_OBJS)) + +is_user_obj = $(findstring $(@F),$(UML_USER_OBJS)) + +_c_flags = $(if $(is_user_obj),$(USER_CFLAGS),$(CFLAGS) $(EXTRA_CFLAGS)) \ + $(CFLAGS_$(*F).o) -_c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) _hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o) _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o) @@ -165,10 +179,17 @@ __hostcxx_flags = $(call flags,_hostcxx_flags) endif -c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ +__kernel_c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ $(__c_flags) $(modkern_cflags) \ $(basename_flags) $(modname_flags) +#We must strip the NOSTDINC and -D__KERNEL__ (else we mess up /usr/include/asm/*) +#and can strip the -DKBUILD... stuff and the -DMODULE, as we don't include +#linux headers. +__umUser_c_flags = -Wp,-MD,$(depfile) $(__c_flags) + +c_flags = $(if $(is_user_obj), $(__umUser_c_flags), $(__kernel_c_flags)) + a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ $(__a_flags) $(modkern_aflags) --- ./scripts/Makefile.build.user_obj 2003-10-10 16:09:28.000000000 +0200 +++ ./scripts/Makefile.build 2003-12-23 17:22:07.000000000 +0100 @@ -125,7 +125,7 @@ # The C file is compiled and updated dependency information is generated. # (See cmd_cc_o_c + relevant part of rule_cc_o_c) -quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ +quiet_cmd_cc_o_c = $(if $(is_user_obj),USR-)CC $(quiet_modtag) $@ ifndef CONFIG_MODVERSIONS cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<