Delete duplicate local definition of global variables.
[linux-2.6/linux-mips.git] / scripts / Makefile.modpost
blob9416ae154422d8f1b9ba7e85e819eaf6413c5223
1 # ===========================================================================
2 # Module versions
3 # ===========================================================================
5 .PHONY: __modversions
6 __modversions:
8 include .config
9 include scripts/Makefile.lib
13 __modules := $(shell cat /dev/null $(wildcard $(MODVERDIR)/*.mod))
14 modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o)))
16 ifneq ($(filter-out $(modules),$(__modules)),)
17   $(warning *** Uh-oh, you have stale module entries. You messed with SUBDIRS,)
18   $(warning     do not complain if something goes wrong.)
19 endif
21 __modversions: $(modules)
22         @:
24 # The final module link
26 quiet_cmd_ld_ko_o = LD [M]  $@
27       cmd_ld_ko_o = $(LD) $(LDFLAGS) $(LDFLAGS_MODULE) -o $@            \
28                           $(filter-out FORCE,$^)
30 $(modules): %.ko :%.o %.mod.o FORCE
31         $(call if_changed,ld_ko_o)
33 targets += $(modules)
35 # Compile version info for unresolved symbols
37 quiet_cmd_cc_o_c = CC      $@
38       cmd_cc_o_c = $(CC) -Wp,-MD,$(depfile) $(CFLAGS) $(CFLAGS_MODULE)  \
39                    -c -o $@ $<
41 $(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE
42         $(call if_changed_dep,cc_o_c)
44 targets += $(modules:.ko=.mod.o)
46 # All the .mod.c files are generated using the helper "modpost"
48 .PHONY: __modpost
50 $(modules:.ko=.mod.c): __modpost ;
52 # Extract all checksums for all exported symbols
54 quiet_cmd_modpost = MODPOST
55       cmd_modpost = scripts/modpost $(filter-out FORCE,$^)
57 __modpost: $(wildcard vmlinux) $(modules:.ko=.o) FORCE
58         $(call if_changed,modpost)
60 targets += __modpost
62 # Add FORCE to the prequisites of a target to force it to be always rebuilt.
63 # ---------------------------------------------------------------------------
65 .PHONY: FORCE
67 FORCE:
69 # Read all saved command lines and dependencies for the $(targets) we
70 # may be building above, using $(if_changed{,_dep}). As an
71 # optimization, we don't need to read them if the target does not
72 # exist, we will rebuild anyway in that case.
74 targets := $(wildcard $(sort $(targets)))
75 cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
77 ifneq ($(cmd_files),)
78   include $(cmd_files)
79 endif