Loading...
# =========================================================================== # Module versions # =========================================================================== .PHONY: __modversions __modversions: include .config include scripts/Makefile.lib # __modules := $(shell head -q -n1 /dev/null $(wildcard $(MODVERDIR)/*.mod)) modules := $(patsubst %.o,%.ko,$(wildcard $(__modules:.ko=.o))) ifneq ($(filter-out $(modules),$(__modules)),) $(warning Trouble: $(__modules) ) $(warning *** Uh-oh, you have stale module entries. You messed with SUBDIRS,) $(warning do not complain if something goes wrong.) endif __modversions: $(modules) @: # The final module link quiet_cmd_ld_ko_o = LD [M] $@ cmd_ld_ko_o = $(LD) $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \ $(filter-out FORCE,$^) $(modules): %.ko :%.o %.mod.o FORCE $(call if_changed,ld_ko_o) targets += $(modules) # Compile version info for unresolved symbols quiet_cmd_cc_o_c = CC $@ cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \ -c -o $@ $< $(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE $(call if_changed_dep,cc_o_c) targets += $(modules:.ko=.mod.o) # All the .mod.c files are generated using the helper "modpost" .PHONY: __modpost $(modules:.ko=.mod.c): __modpost ; # Extract all checksums for all exported symbols quiet_cmd_modpost = MODPOST cmd_modpost = scripts/modpost $(filter-out FORCE,$^) __modpost: $(wildcard vmlinux) $(modules:.ko=.o) FORCE $(call if_changed,modpost) targets += __modpost # Add FORCE to the prequisites of a target to force it to be always rebuilt. # --------------------------------------------------------------------------- .PHONY: FORCE FORCE: # Read all saved command lines and dependencies for the $(targets) we # may be building above, using $(if_changed{,_dep}). As an # optimization, we don't need to read them if the target does not # exist, we will rebuild anyway in that case. targets := $(wildcard $(sort $(targets))) cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) ifneq ($(cmd_files),) include $(cmd_files) endif |