kbuild: fix ia64 breakage after introducing make -rR

kbuild used $¤(*F to get filename of target without extension.
This was used in several places all over kbuild, but introducing
make -rR broke his for all cases where we specified full path to
target/prerequsite. It is assumed that make -rR disables old style
suffix-rules which is why is suddenly failed.

ia64 was impacted by this change because several div* routines in
arch/ia64/lib are build using explicit paths and then kbuild failed.

Thanks to David Mosberger-Tang <David.Mosberger@acm.org> for an explanation
what was the root-cause and for testing on ia64.

This patch also fixes two uses of $(*F) in arch/um

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>

+16 -10
+1 -1
Makefile
··· 1352 1353 a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \ 1354 $(NOSTDINC_FLAGS) $(CPPFLAGS) \ 1355 - $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) 1356 1357 quiet_cmd_as_o_S = AS $@ 1358 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
··· 1352 1353 a_flags = -Wp,-MD,$(depfile) $(AFLAGS) $(AFLAGS_KERNEL) \ 1354 $(NOSTDINC_FLAGS) $(CPPFLAGS) \ 1355 + $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) 1356 1357 quiet_cmd_as_o_S = AS $@ 1358 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
+2 -2
arch/um/scripts/Makefile.rules
··· 8 USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) 9 10 $(USER_OBJS:.o=.%): \ 11 - c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(*F).o) 12 $(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ 13 -Dunix -D__unix__ -D__$(SUBARCH)__ 14 ··· 17 UNPROFILE_OBJS := $(foreach file,$(UNPROFILE_OBJS),$(obj)/$(file)) 18 19 $(UNPROFILE_OBJS:.o=.%): \ 20 - c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS)) $(CFLAGS_$(*F).o) 21 $(UNPROFILE_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ 22 -Dunix -D__unix__ -D__$(SUBARCH)__ 23
··· 8 USER_OBJS := $(foreach file,$(USER_OBJS),$(obj)/$(file)) 9 10 $(USER_OBJS:.o=.%): \ 11 + c_flags = -Wp,-MD,$(depfile) $(USER_CFLAGS) $(CFLAGS_$(basetarget).o) 12 $(USER_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ 13 -Dunix -D__unix__ -D__$(SUBARCH)__ 14 ··· 17 UNPROFILE_OBJS := $(foreach file,$(UNPROFILE_OBJS),$(obj)/$(file)) 18 19 $(UNPROFILE_OBJS:.o=.%): \ 20 + c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS)) $(CFLAGS_$(basetarget).o) 21 $(UNPROFILE_OBJS) : CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ \ 22 -Dunix -D__unix__ -D__$(SUBARCH)__ 23
+4
scripts/Kbuild.include
··· 13 depfile = $(subst $(comma),_,$(@D)/.$(@F).d) 14 15 ### 16 # Escape single quote for use in echo statements 17 escsq = $(subst $(squote),'\$(squote)',$1) 18
··· 13 depfile = $(subst $(comma),_,$(@D)/.$(@F).d) 14 15 ### 16 + # filename of target with directory and extension stripped 17 + basetarget = $(basename $(notdir $@)) 18 + 19 + ### 20 # Escape single quote for use in echo statements 21 escsq = $(subst $(squote),'\$(squote)',$1) 22
+1 -1
scripts/Makefile.build
··· 117 $(obj-m) : quiet_modtag := [M] 118 119 # Default for not multi-part modules 120 - modname = $(*F) 121 122 $(multi-objs-m) : modname = $(modname-multi) 123 $(multi-objs-m:.o=.i) : modname = $(modname-multi)
··· 117 $(obj-m) : quiet_modtag := [M] 118 119 # Default for not multi-part modules 120 + modname = $(basetarget) 121 122 $(multi-objs-m) : modname = $(modname-multi) 123 $(multi-objs-m:.o=.i) : modname = $(modname-multi)
+4 -2
scripts/Makefile.host
··· 80 ##### 81 # Handle options to gcc. Support building with separate output directory 82 83 - _hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o) 84 - _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o) 85 86 ifeq ($(KBUILD_SRC),) 87 __hostc_flags = $(_hostc_flags)
··· 80 ##### 81 # Handle options to gcc. Support building with separate output directory 82 83 + _hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ 84 + $(HOSTCFLAGS_$(basetarget).o) 85 + _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ 86 + $(HOSTCXXFLAGS_$(basetarget).o) 87 88 ifeq ($(KBUILD_SRC),) 89 __hostc_flags = $(_hostc_flags)
+3 -3
scripts/Makefile.lib
··· 82 # than one module. In that case KBUILD_MODNAME will be set to foo_bar, 83 # where foo and bar are the name of the modules. 84 name-fix = $(subst $(comma),_,$(subst -,_,$1)) 85 - basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(*F)))" 86 modname_flags = $(if $(filter 1,$(words $(modname))),\ 87 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") 88 89 - _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) 90 - _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) 91 _cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) 92 93 # If building the kernel in a separate objtree expand all occurrences
··· 82 # than one module. In that case KBUILD_MODNAME will be set to foo_bar, 83 # where foo and bar are the name of the modules. 84 name-fix = $(subst $(comma),_,$(subst -,_,$1)) 85 + basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" 86 modname_flags = $(if $(filter 1,$(words $(modname))),\ 87 -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") 88 89 + _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o) 90 + _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) 91 _cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) 92 93 # If building the kernel in a separate objtree expand all occurrences
+1 -1
scripts/Makefile.modpost
··· 72 # Step 5), compile all *.mod.c files 73 74 # modname is set to make c_flags define KBUILD_MODNAME 75 - modname = $(*F) 76 77 quiet_cmd_cc_o_c = CC $@ 78 cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \
··· 72 # Step 5), compile all *.mod.c files 73 74 # modname is set to make c_flags define KBUILD_MODNAME 75 + modname = $(notdir $(@:.mod.o=)) 76 77 quiet_cmd_cc_o_c = CC $@ 78 cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \