From: <ke...@us...> - 2003-09-07 15:11:47
|
Update of /cvsroot/linux-vax/kernel-2.5/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv19699/scripts Modified Files: Makefile.build Log Message: Merge with 2.5.71 Index: Makefile.build =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/scripts/Makefile.build,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- Makefile.build 28 Aug 2003 22:32:22 -0000 1.13 +++ Makefile.build 7 Sep 2003 15:11:44 -0000 1.14 @@ -32,9 +32,7 @@ endif ifdef L_TARGET -ifneq ($(L_TARGET),lib.a) -$(warning kbuild: $(obj)/Makefile - L_TARGET := $(L_TARGET) target shall be renamed to lib.a. Please fix!) -endif +$(error kbuild: $(obj)/Makefile - Use of L_TARGET is replaced by lib-y in 2.5. Please fix!) endif ifdef list-multi @@ -47,21 +45,19 @@ # =========================================================================== -# If a Makefile does not define a L_TARGET, link an object called "built-in.o" - -ifdef L_TARGET -L_TARGET := $(obj)/$(L_TARGET) -else -ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-)),) -O_TARGET := $(obj)/built-in.o +ifneq ($(strip $(lib-y) $(lib-m) $(lib-n) $(lib-)),) +lib-target := $(obj)/lib.a endif + +ifneq ($(strip $(obj-y) $(obj-m) $(obj-n) $(obj-) $(lib-target)),) +builtin-target := $(obj)/built-in.o endif # We keep a list of all modules in $(MODVERDIR) touch-module = @echo $(@:.o=.ko) > $(MODVERDIR)/$(@F:.o=.mod) -__build: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(extra-y)) \ +__build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \ $(if $(KBUILD_MODULES),$(obj-m)) \ $(subdir-ym) $(always) @: @@ -71,55 +67,7 @@ quiet_cmd_checksrc = CHECK $< cmd_checksrc = $(CHECK) $(c_flags) $< ; endif - -# Module versioning -# --------------------------------------------------------------------------- - -ifdef CONFIG_MODVERSIONS - -# $(call if_changed_rule,vcc_o_c) does essentially the same as the -# normal $(call if_changed_dep,cc_o_c), i.e. compile an object file -# from a C file, keeping track of the command line and dependencies. -# -# However, actually it does: -# o compile a .tmp_<file>.o from <file>.c -# o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does -# not export symbols, we just rename .tmp_<file>.o to <file>.o and -# are done. -# o otherwise, we calculate symbol versions using the good old -# genksyms on the preprocessed source and postprocess them in a way -# that they are usable as a linker script -# o generate <file>.o from .tmp_<file>.o using the linker to -# replace the unresolved symbols __crc_exported_symbol with -# the actual value of the checksum generated by genksyms -quiet_cmd_vcc_o_c = CC $(quiet_modtag) $@ -cmd_vcc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< - -define rule_vcc_o_c - $(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \ - $(cmd_checksrc) \ - $(if $($(quiet)cmd_vcc_o_c),echo ' $($(quiet)cmd_vcc_o_c)';) \ - $(cmd_vcc_o_c); \ - \ - if ! $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ - mv $(@D)/.tmp_$(@F) $@; \ - else \ - $(CPP) -D__GENKSYMS__ $(c_flags) $< \ - | $(GENKSYMS) \ - > $(@D)/.tmp_$(@F:.o=.ver); \ - \ - $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ - -T $(@D)/.tmp_$(@F:.o=.ver); \ - rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ - fi; - \ - scripts/fixdep $(depfile) $@ '$(cmd_vcc_o_c)' > $(@D)/.$(@F).tmp; \ - rm -f $(depfile); \ - mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd -endef - -endif # Compile C sources (.c) # --------------------------------------------------------------------------- @@ -164,38 +112,66 @@ %.i: %.c FORCE $(call if_changed_dep,cc_i_c) +# C (.c) files +# 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) $@ + # define listing_o_c to get compiler listings from .c -> .o compilations listing_o_c = -Wa,-adnhls=$(subst $(comma),_,$(@D)/$(*F)).lst -g -quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ -cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< $(listing_o_c) +ifndef CONFIG_MODVERSIONS +cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< $(listing_o_c) + +else +# When module versioning is enabled the following steps are executed: +# o compile a .tmp_<file>.o from <file>.c +# o if .tmp_<file>.o doesn't contain a __ksymtab version, i.e. does +# not export symbols, we just rename .tmp_<file>.o to <file>.o and +# are done. +# o otherwise, we calculate symbol versions using the good old +# genksyms on the preprocessed source and postprocess them in a way +# that they are usable as a linker script +# o generate <file>.o from .tmp_<file>.o using the linker to +# replace the unresolved symbols __crc_exported_symbol with +# the actual value of the checksum generated by genksyms + +cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< +cmd_modversions = \ + if ! $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ + mv $(@D)/.tmp_$(@F) $@; \ + else \ + $(CPP) -D__GENKSYMS__ $(c_flags) $< \ + | $(GENKSYMS) \ + > $(@D)/.tmp_$(@F:.o=.ver); \ + \ + $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ + -T $(@D)/.tmp_$(@F:.o=.ver); \ + rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ + fi; +endif + define rule_cc_o_c - $(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \ - $(cmd_checksrc) \ - $(if $($(quiet)cmd_cc_o_c),echo ' $($(quiet)cmd_cc_o_c)';) \ - $(cmd_cc_o_c); \ - scripts/fixdep $(depfile) $@ '$(cmd_cc_o_c)' > $(@D)/.$(@F).tmp; \ - rm -f $(depfile); \ + $(if $($(quiet)cmd_checksrc),echo ' $($(quiet)cmd_checksrc)';) \ + $(cmd_checksrc) \ + $(if $($(quiet)cmd_cc_o_c),echo ' $($(quiet)cmd_cc_o_c)';) \ + $(cmd_cc_o_c); \ + $(cmd_modversions) \ + scripts/fixdep $(depfile) $@ '$(cmd_cc_o_c)' > $(@D)/.$(@F).tmp; \ + rm -f $(depfile); \ mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd endef # Built-in and composite module parts %.o: %.c FORCE -ifdef CONFIG_MODVERSIONS - $(call if_changed_rule,vcc_o_c) -else $(call if_changed_rule,cc_o_c) -endif # Single-part modules are special since we need to mark them in $(MODVERDIR) $(single-used-m): %.o: %.c FORCE -ifdef CONFIG_MODVERSIONS - $(call if_changed_rule,vcc_o_c) -else $(call if_changed_rule,cc_o_c) -endif $(touch-module) quiet_cmd_cc_lst_c = MKLST $@ @@ -226,7 +202,8 @@ %.o: %.S FORCE $(call if_changed_dep,as_o_S) -targets += $(real-objs-y) $(real-objs-m) $(extra-y) $(MAKECMDGOALS) $(always) +targets += $(real-objs-y) $(real-objs-m) $(lib-y) +targets += $(extra-y) $(MAKECMDGOALS) $(always) # Build the compiled-in targets # --------------------------------------------------------------------------- @@ -237,30 +214,30 @@ # # Rule to compile a set of .o files into one .o file # -ifdef O_TARGET +ifdef builtin-target quiet_cmd_link_o_target = LD $@ -# If the list of objects to link is empty, just create an empty O_TARGET +# If the list of objects to link is empty, just create an empty built-in.o cmd_link_o_target = $(if $(strip $(obj-y)),\ $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\ rm -f $@; $(AR) rcs $@) -$(O_TARGET): $(obj-y) FORCE +$(builtin-target): $(obj-y) FORCE $(call if_changed,link_o_target) -targets += $(O_TARGET) -endif # O_TARGET +targets += $(builtin-target) +endif # builtin-target # # Rule to compile a set of .o files into one .a file # -ifdef L_TARGET +ifdef lib-target quiet_cmd_link_l_target = AR $@ -cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y) +cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(lib-y) -$(L_TARGET): $(obj-y) FORCE +$(lib-target): $(lib-y) FORCE $(call if_changed,link_l_target) -targets += $(L_TARGET) +targets += $(lib-target) endif # |