Commit d782495d authored by Kai Germaschewski's avatar Kai Germaschewski

Merge linux-isdn@linux-isdn.bkbits.net:linux-2.5.make

into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.make
parents 3150c862 0ced6457
...@@ -225,7 +225,7 @@ define rule_link_vmlinux ...@@ -225,7 +225,7 @@ define rule_link_vmlinux
echo Generating build number echo Generating build number
. scripts/mkversion > .tmpversion . scripts/mkversion > .tmpversion
mv -f .tmpversion .version mv -f .tmpversion .version
$(MAKE) -C init +$(MAKE) -C init
$(call cmd,cmd_link_vmlinux) $(call cmd,cmd_link_vmlinux)
$(cmd_link_vmlinux) $(cmd_link_vmlinux)
echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd echo 'cmd_$@ := $(cmd_link_vmlinux)' > $(@D)/.$(@F).cmd
...@@ -243,14 +243,14 @@ $(sort $(vmlinux-objs)): $(SUBDIRS) ; ...@@ -243,14 +243,14 @@ $(sort $(vmlinux-objs)): $(SUBDIRS) ;
# Handle descending into subdirectories listed in $(SUBDIRS) # Handle descending into subdirectories listed in $(SUBDIRS)
.PHONY: $(SUBDIRS) .PHONY: $(SUBDIRS)
$(SUBDIRS): .hdepend prepare include/config/MARKER $(SUBDIRS): .hdepend prepare
@$(MAKE) -C $@ @$(MAKE) -C $@
# Things we need done before we descend to build or make # Things we need done before we descend to build or make
# module versions are listed in "prepare" # module versions are listed in "prepare"
.PHONY: prepare .PHONY: prepare
prepare: include/linux/version.h include/asm prepare: include/linux/version.h include/asm include/config/MARKER
# Single targets # Single targets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -353,7 +353,7 @@ include/linux/modversions.h: scripts/fixdep prepare FORCE ...@@ -353,7 +353,7 @@ include/linux/modversions.h: scripts/fixdep prepare FORCE
@( echo "#ifndef _LINUX_MODVERSIONS_H";\ @( echo "#ifndef _LINUX_MODVERSIONS_H";\
echo "#define _LINUX_MODVERSIONS_H"; \ echo "#define _LINUX_MODVERSIONS_H"; \
echo "#include <linux/modsetver.h>"; \ echo "#include <linux/modsetver.h>"; \
for f in `cd .tmp_export-objs; find modules -name \*.ver -print`; do \ for f in `cd .tmp_export-objs; find modules -name \*.ver -print | sort`; do \
echo "#include <linux/$${f}>"; \ echo "#include <linux/$${f}>"; \
done; \ done; \
echo "#endif"; \ echo "#endif"; \
...@@ -574,9 +574,8 @@ make_with_config: .config ...@@ -574,9 +574,8 @@ make_with_config: .config
# files removed with 'make clean' # files removed with 'make clean'
CLEAN_FILES += \ CLEAN_FILES += \
kernel/ksyms.lst include/linux/compile.h \ include/linux/compile.h \
vmlinux System.map \ vmlinux System.map \
.tmp* \
drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c \ drivers/char/consolemap_deftbl.c drivers/video/promcon_tbl.c \
drivers/char/conmakehash \ drivers/char/conmakehash \
drivers/char/drm/*-mod.c \ drivers/char/drm/*-mod.c \
...@@ -616,9 +615,11 @@ MRPROPER_FILES += \ ...@@ -616,9 +615,11 @@ MRPROPER_FILES += \
.hdepend scripts/split-include scripts/docproc \ .hdepend scripts/split-include scripts/docproc \
scripts/fixdep $(TOPDIR)/include/linux/modversions.h \ scripts/fixdep $(TOPDIR)/include/linux/modversions.h \
tags TAGS kernel.spec \ tags TAGS kernel.spec \
.tmpversion
# directories removed with 'make mrproper' # directories removed with 'make mrproper'
MRPROPER_DIRS += \ MRPROPER_DIRS += \
.tmp_export-objs \
include/config \ include/config \
$(TOPDIR)/include/linux/modules $(TOPDIR)/include/linux/modules
...@@ -631,7 +632,7 @@ clean: archclean ...@@ -631,7 +632,7 @@ clean: archclean
@find . \( -name \*.[oas] -o -name core -o -name .\*.cmd -o \ @find . \( -name \*.[oas] -o -name core -o -name .\*.cmd -o \
-name .\*.tmp -o -name .\*.d \) -type f -print \ -name .\*.tmp -o -name .\*.d \) -type f -print \
| grep -v lxdialog/ | xargs rm -f | grep -v lxdialog/ | xargs rm -f
@rm -rf $(CLEAN_FILES) @rm -f $(CLEAN_FILES)
@$(MAKE) -C Documentation/DocBook clean @$(MAKE) -C Documentation/DocBook clean
mrproper: clean archmrproper mrproper: clean archmrproper
......
...@@ -48,12 +48,9 @@ subdir- += $(__subdir-) ...@@ -48,12 +48,9 @@ subdir- += $(__subdir-)
obj-y := $(patsubst %/, %/built-in.o, $(obj-y)) obj-y := $(patsubst %/, %/built-in.o, $(obj-y))
obj-m := $(filter-out %/, $(obj-m)) obj-m := $(filter-out %/, $(obj-m))
# If a dir is selected in $(subdir-y) and also mentioned in $(mod-subdirs), # Subdirectories we need to descend into
# add it to $(subdir-m)
both-m := $(filter $(mod-subdirs), $(subdir-y))
subdir-ym := $(sort $(subdir-y) $(subdir-m)) subdir-ym := $(sort $(subdir-y) $(subdir-m))
subdir-ymn := $(sort $(subdir-ym) $(subdir-n) $(subdir-))
# export.o is never a composite object, since $(export-objs) has a # export.o is never a composite object, since $(export-objs) has a
# fixed meaning (== objects which EXPORT_SYMBOL()) # fixed meaning (== objects which EXPORT_SYMBOL())
...@@ -85,8 +82,112 @@ subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o) ...@@ -85,8 +82,112 @@ subdir-obj-y := $(foreach o,$(obj-y),$(if $(filter-out $(o),$(notdir $(o))),$(o)
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) $(EXTRA_TARGETS) real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) $(EXTRA_TARGETS)
real-objs-m := $(foreach m, $(obj-m), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m))) real-objs-m := $(foreach m, $(obj-m), $(if $($(m:.o=-objs)),$($(m:.o=-objs)),$(m)))
# Get things started. # Only build module versions for files which are selected to be built
export-objs := $(filter $(export-objs),$(real-objs-y) $(real-objs-m))
# We're called for one of three purposes:
# o fastdep: build module version files (.ver) for $(export-objs) in
# the current directory
# o modules_install: install the modules in the current directory
# o build: When no target is given, first_rule is the default and
# will build the built-in and modular objects in this dir
# (or a subset thereof, depending on $(KBUILD_MODULES),$(KBUILD_BUILTIN)
# When targets are given directly (like foo.o), we just build these
# targets (That happens when someone does make some/dir/foo.[ois])
ifeq ($(MAKECMDGOALS),fastdep)
# ===========================================================================
# Module versions
# ===========================================================================
ifeq ($(strip $(export-objs)),)
# If we don't export any symbols in this dir, just descend
# ---------------------------------------------------------------------------
fastdep: sub_dirs
@echo -n
else
# This sets version suffixes on exported symbols
# ---------------------------------------------------------------------------
MODVERDIR := $(TOPDIR)/include/linux/modules/$(RELDIR)
#
# Added the SMP separator to stop module accidents between uniprocessor
# and SMP Intel boxes - AC - from bits by Michael Chastain
#
ifdef CONFIG_SMP
genksyms_smp_prefix := -p smp_
else
genksyms_smp_prefix :=
endif
$(MODVERDIR)/$(real-objs-y:.o=.ver): modkern_cflags := $(CFLAGS_KERNEL)
$(MODVERDIR)/$(real-objs-m:.o=.ver): modkern_cflags := $(CFLAGS_MODULE)
$(MODVERDIR)/$(export-objs:.o=.ver): export_flags := -D__GENKSYMS__
c_flags = -Wp,-MD,$(@D)/.$(@F).d $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
-DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
$(export_flags)
# Our objects only depend on modversions.h, not on the individual .ver
# files (fix-dep filters them), so touch modversions.h if any of the .ver
# files changes
quiet_cmd_cc_ver_c = MKVER include/linux/modules/$(RELDIR)/$*.ver
define cmd_cc_ver_c
mkdir -p $(dir $@); \
$(CPP) $(c_flags) $< | $(GENKSYMS) $(genksyms_smp_prefix) \
-k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp; \
if [ ! -r $@ ] || cmp -s $@ $@.tmp; then \
touch $(TOPDIR)/include/linux/modversions.h; \
fi; \
mv -f $@.tmp $@
endef
$(MODVERDIR)/%.ver: %.c FORCE
@$(call if_changed_dep,cc_ver_c)
targets := $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
fastdep: $(targets) sub_dirs
@mkdir -p $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR)
@touch $(addprefix $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR)/,$(export-objs:.o=.ver))
endif # export-objs
else # ! fastdep
ifeq ($(MAKECMDGOALS),modules_install)
# ==========================================================================
# Installing modules
# ==========================================================================
.PHONY: modules_install
modules_install: sub_dirs
ifneq ($(obj-m),)
@echo Installing modules in $(MODLIB)/kernel/$(RELDIR)
@mkdir -p $(MODLIB)/kernel/$(RELDIR)
@cp $(obj-m) $(MODLIB)/kernel/$(RELDIR)
else
@echo -n
endif
else # ! modules_install
# ========================================================================== # ==========================================================================
# Building
# ==========================================================================
# If a Makefile does define neither O_TARGET nor L_TARGET,
# use a standard O_TARGET named "built-in.o"
ifndef O_TARGET ifndef O_TARGET
ifndef L_TARGET ifndef L_TARGET
...@@ -103,15 +204,9 @@ first_rule: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \ ...@@ -103,15 +204,9 @@ first_rule: $(if $(KBUILD_BUILTIN),$(O_TARGET) $(L_TARGET) $(EXTRA_TARGETS)) \
# Compile C sources (.c) # Compile C sources (.c)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# If we don't know if built-in or modular, assume built-in. # Default is built-in, unless we know otherwise
# Only happens in Makefiles which override the default first_rule:
modkern_cflags := $(CFLAGS_KERNEL) modkern_cflags := $(CFLAGS_KERNEL)
$(real-objs-y) : modkern_cflags := $(CFLAGS_KERNEL)
$(real-objs-y:.o=.i) : modkern_cflags := $(CFLAGS_KERNEL)
$(real-objs-y:.o=.s) : modkern_cflags := $(CFLAGS_KERNEL)
$(real-objs-y:.o=.lst): modkern_cflags := $(CFLAGS_KERNEL)
$(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE) $(real-objs-m) : modkern_cflags := $(CFLAGS_MODULE)
$(real-objs-m:.o=.i) : modkern_cflags := $(CFLAGS_MODULE) $(real-objs-m:.o=.i) : modkern_cflags := $(CFLAGS_MODULE)
$(real-objs-m:.o=.lst): modkern_cflags := $(CFLAGS_MODULE) $(real-objs-m:.o=.lst): modkern_cflags := $(CFLAGS_MODULE)
...@@ -121,22 +216,25 @@ $(export-objs:.o=.i) : export_flags := $(EXPORT_FLAGS) ...@@ -121,22 +216,25 @@ $(export-objs:.o=.i) : export_flags := $(EXPORT_FLAGS)
$(export-objs:.o=.s) : export_flags := $(EXPORT_FLAGS) $(export-objs:.o=.s) : export_flags := $(EXPORT_FLAGS)
$(export-objs:.o=.lst): export_flags := $(EXPORT_FLAGS) $(export-objs:.o=.lst): export_flags := $(EXPORT_FLAGS)
c_flags = $(CFLAGS) $(NOSTDINC_FLAGS) $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) $(export_flags) c_flags = -Wp,-MD,$(@D)/.$(@F).d $(CFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) \
-DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
$(export_flags)
quiet_cmd_cc_s_c = CC $(RELDIR)/$@ quiet_cmd_cc_s_c = CC $(RELDIR)/$@
cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $< cmd_cc_s_c = $(CC) $(c_flags) -S -o $@ $<
%.s: %.c FORCE %.s: %.c FORCE
$(call cmd,cmd_cc_s_c) $(call if_changed_dep,cc_s_c)
quiet_cmd_cc_i_c = CPP $(RELDIR)/$@ quiet_cmd_cc_i_c = CPP $(RELDIR)/$@
cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $<
%.i: %.c FORCE %.i: %.c FORCE
$(call cmd,cmd_cc_i_c) $(call if_changed_dep,cc_i_c)
quiet_cmd_cc_o_c = CC $(RELDIR)/$@ quiet_cmd_cc_o_c = CC $(RELDIR)/$@
cmd_cc_o_c = $(CC) -Wp,-MD,.$(subst /,_,$@).d $(c_flags) -c -o $@ $< cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
%.o: %.c FORCE %.o: %.c FORCE
$(call if_changed_dep,cc_o_c) $(call if_changed_dep,cc_o_c)
...@@ -145,36 +243,32 @@ quiet_cmd_cc_lst_c = Generating $(RELDIR)/$@ ...@@ -145,36 +243,32 @@ quiet_cmd_cc_lst_c = Generating $(RELDIR)/$@
cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && $(TOPDIR)/scripts/makelst $*.o $(TOPDIR)/System.map $(OBJDUMP) > $@ cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && $(TOPDIR)/scripts/makelst $*.o $(TOPDIR)/System.map $(OBJDUMP) > $@
%.lst: %.c FORCE %.lst: %.c FORCE
$(call cmd,cmd_cc_lst_c) $(call if_changed_dep,cc_lst_c)
# Compile assembler sources (.S) # Compile assembler sources (.S)
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# FIXME (s.a.)
modkern_aflags := $(AFLAGS_KERNEL) modkern_aflags := $(AFLAGS_KERNEL)
$(real-objs-y) : modkern_aflags := $(AFLAGS_KERNEL)
$(real-objs-y:.o=.s): modkern_aflags := $(AFLAGS_KERNEL)
$(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE) $(real-objs-m) : modkern_aflags := $(AFLAGS_MODULE)
$(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE) $(real-objs-m:.o=.s): modkern_aflags := $(AFLAGS_MODULE)
a_flags = $(AFLAGS) $(NOSTDINC_FLAGS) $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) a_flags = -Wp,-MD,$(@D)/.$(@F).d $(AFLAGS) $(NOSTDINC_FLAGS) \
$(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
quiet_cmd_as_s_S = CPP $(RELDIR)/$@ quiet_cmd_as_s_S = CPP $(RELDIR)/$@
cmd_as_s_S = $(CPP) $(a_flags) -o $@ $< cmd_as_s_S = $(CPP) $(a_flags) -o $@ $<
%.s: %.S FORCE %.s: %.S FORCE
$(call cmd,cmd_as_s_S) $(call if_changed_dep,as_s_S)
quiet_cmd_as_o_S = AS $(RELDIR)/$@ quiet_cmd_as_o_S = AS $(RELDIR)/$@
cmd_as_o_S = $(CC) -Wp,-MD,.$(subst /,_,$@).d $(a_flags) -c -o $@ $< cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
%.o: %.S FORCE %.o: %.S FORCE
$(call if_changed_dep,as_o_S) $(call if_changed_dep,as_o_S)
# If a Makefile does define neither O_TARGET nor L_TARGET, targets += $(real-objs-y) $(real-objs-m) $(EXTRA_TARGETS) $(MAKECMDGOALS)
# use a standard O_TARGET named "built-in.o"
# Build the compiled-in targets # Build the compiled-in targets
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -193,7 +287,9 @@ cmd_link_o_target = $(if $(strip $(obj-y)),\ ...@@ -193,7 +287,9 @@ cmd_link_o_target = $(if $(strip $(obj-y)),\
rm -f $@; $(AR) rcs $@) rm -f $@; $(AR) rcs $@)
$(O_TARGET): $(obj-y) FORCE $(O_TARGET): $(obj-y) FORCE
$(call if_changed,cmd_link_o_target) $(call if_changed,link_o_target)
targets += $(O_TARGET)
endif # O_TARGET endif # O_TARGET
# #
...@@ -204,7 +300,9 @@ quiet_cmd_link_l_target = AR $(RELDIR)/$@ ...@@ -204,7 +300,9 @@ quiet_cmd_link_l_target = AR $(RELDIR)/$@
cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y) cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y)
$(L_TARGET): $(obj-y) FORCE $(L_TARGET): $(obj-y) FORCE
$(call if_changed,cmd_link_l_target) $(call if_changed,link_l_target)
targets += $(L_TARGET)
endif endif
# #
...@@ -219,10 +317,12 @@ cmd_link_multi = $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs) ...@@ -219,10 +317,12 @@ cmd_link_multi = $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs)
# but that's not so easy, so we rather make all composite objects depend # but that's not so easy, so we rather make all composite objects depend
# on the set of all their parts # on the set of all their parts
$(multi-used-y) : %.o: $(multi-objs-y) FORCE $(multi-used-y) : %.o: $(multi-objs-y) FORCE
$(call if_changed,cmd_link_multi) $(call if_changed,link_multi)
$(multi-used-m) : %.o: $(multi-objs-m) FORCE $(multi-used-m) : %.o: $(multi-objs-m) FORCE
$(call if_changed,cmd_link_multi) $(call if_changed,link_multi)
targets += $(multi-used-y) $(multi-used-m)
# Compile programs on the host # Compile programs on the host
# =========================================================================== # ===========================================================================
...@@ -250,51 +350,26 @@ cmd_host_cc__o = $(HOSTCC) $(HOSTLDFLAGS) -o $@ $($@-objs) \ ...@@ -250,51 +350,26 @@ cmd_host_cc__o = $(HOSTCC) $(HOSTLDFLAGS) -o $@ $($@-objs) \
$(HOST_LOADLIBES) $(HOST_LOADLIBES)
$(host-progs-multi): %: $(host-progs-multi-objs) FORCE $(host-progs-multi): %: $(host-progs-multi-objs) FORCE
$(call if_changed,cmd_host_cc__o) $(call if_changed,host_cc__o)
# Descending when making module versions
# ---------------------------------------------------------------------------
fastdep-list := $(addprefix _sfdep_,$(subdir-ymn))
.PHONY: fastdep $(fastdep-list) targets += $(host-progs-single) $(host-progs-multi-objs) $(host-progs-multi)
fastdep: $(fastdep-list) endif # ! modules_install
endif # ! fastdep
$(fastdep-list): # ===========================================================================
@$(MAKE) -C $(patsubst _sfdep_%,%,$@) fastdep # Generic stuff
# ===========================================================================
# Descending when building
# ---------------------------------------------------------------------------
subdir-list := $(addprefix _subdir_,$(subdir-ym))
.PHONY: sub_dirs $(subdir-list)
sub_dirs: $(subdir-list)
$(subdir-list):
@$(MAKE) -C $(patsubst _subdir_%,%,$@)
# Descending and installing modules # Descending
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
modinst-list := $(addprefix _modinst_,$(subdir-ym)) .PHONY: sub_dirs $(subdir-ym)
.PHONY: modules_install _modinst_ $(modinst-list) sub_dirs: $(subdir-ym)
modules_install: $(modinst-list) $(subdir-ym):
ifneq ($(obj-m),) @$(MAKE) -C $@ $(MAKECMDGOALS)
@echo Installing modules in $(MODLIB)/kernel/$(RELDIR)
@mkdir -p $(MODLIB)/kernel/$(RELDIR)
@cp $(obj-m) $(MODLIB)/kernel/$(RELDIR)
else
@echo -n
endif
$(modinst-list):
@$(MAKE) -C $(patsubst _modinst_%,%,$@) modules_install
# Add FORCE to the prequisites of a target to force it to be always rebuilt. # Add FORCE to the prequisites of a target to force it to be always rebuilt.
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
...@@ -303,63 +378,12 @@ $(modinst-list): ...@@ -303,63 +378,12 @@ $(modinst-list):
FORCE: FORCE:
#
# This is useful for testing
# FIXME: really?
script:
$(SCRIPT)
# #
# This sets version suffixes on exported symbols # This sets version suffixes on exported symbols
# Separate the object into "normal" objects and "exporting" objects # Separate the object into "normal" objects and "exporting" objects
# Exporting objects are: all objects that define symbol tables # Exporting objects are: all objects that define symbol tables
# #
ifdef CONFIG_MODVERSIONS
ifneq "$(strip $(export-objs))" ""
MODVERDIR := $(TOPDIR)/include/linux/modules/$(RELDIR)
#
# Added the SMP separator to stop module accidents between uniprocessor
# and SMP Intel boxes - AC - from bits by Michael Chastain
#
ifdef CONFIG_SMP
genksyms_smp_prefix := -p smp_
else
genksyms_smp_prefix :=
endif
# We don't track dependencies for .ver files, so we FORCE to check
# them always (i.e. always at "make dep" time).
quiet_cmd_create_ver = Creating include/linux/modules/$(RELDIR)/$*.ver
cmd_create_ver = $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $< | \
$(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp
$(MODVERDIR)/%.ver: %.c FORCE
@mkdir -p $(dir $@)
@$(call cmd,cmd_create_ver)
@if [ -r $@ ] && cmp -s $@ $@.tmp; then \
rm -f $@.tmp; \
else \
touch $(TOPDIR)/include/linux/modversions.h; \
mv -f $@.tmp $@; \
fi
# updates .ver files but not modversions.h
fastdep: $(addprefix $(MODVERDIR)/,$(export-objs:.o=.ver))
ifneq ($(export-objs),)
@mkdir -p $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR)
@touch $(addprefix $(TOPDIR)/.tmp_export-objs/modules/$(RELDIR)/,$(export-objs:.o=.ver))
endif
endif # export-objs
endif # CONFIG_MODVERSIONS
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Check if command line has changed # Check if command line has changed
...@@ -391,9 +415,14 @@ endif # CONFIG_MODVERSIONS ...@@ -391,9 +415,14 @@ endif # CONFIG_MODVERSIONS
# which is saved in .<target>.o, to the current command line using # which is saved in .<target>.o, to the current command line using
# the two filter-out commands) # the two filter-out commands)
# read all saved command lines and dependencies # 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))
cmd_files := $(wildcard .*.cmd)
ifneq ($(cmd_files),) ifneq ($(cmd_files),)
include $(cmd_files) include $(cmd_files)
endif endif
...@@ -401,9 +430,12 @@ endif ...@@ -401,9 +430,12 @@ endif
# function to only execute the passed command if necessary # function to only execute the passed command if necessary
if_changed = $(if $(strip $? \ if_changed = $(if $(strip $? \
$(filter-out $($(1)),$(cmd_$(@F)))\ $(filter-out $(cmd_$(1)),$(cmd_$@))\
$(filter-out $(cmd_$(@F)),$($(1)))),\ $(filter-out $(cmd_$@),$(cmd_$(1)))),\
@$(if $($(quiet)$(1)),echo ' $($(quiet)$(1))' &&) $($(1)) && echo 'cmd_$@ := $($(1))' > $(@D)/.$(@F).cmd) @set -e; \
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
$(cmd_$(1)); \
echo 'cmd_$@ := $(cmd_$(1))' > $(@D)/.$(@F).cmd)
# execute the command and also postprocess generated .d dependencies # execute the command and also postprocess generated .d dependencies
...@@ -415,9 +447,9 @@ if_changed_dep = $(if $(strip $? \ ...@@ -415,9 +447,9 @@ if_changed_dep = $(if $(strip $? \
@set -e; \ @set -e; \
$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \ $(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))';) \
$(cmd_$(1)); \ $(cmd_$(1)); \
$(TOPDIR)/scripts/fixdep $(subst /,_,$@) $(TOPDIR) '$(cmd_$(1))' > .$(subst /,_,$@).tmp; \ $(TOPDIR)/scripts/fixdep $(@D)/.$(@F).d $@ $(TOPDIR) '$(cmd_$(1))' > $(@D)/.$(@F).tmp; \
rm -f .$(subst /,_,$@).d; \ rm -f $(@D)/.$(@F).d; \
mv -f .$(subst /,_,$@).tmp .$(subst /,_,$@).cmd ) mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)
# If quiet is set, only print short version of command # If quiet is set, only print short version of command
......
...@@ -61,9 +61,9 @@ ...@@ -61,9 +61,9 @@
* *
* It is invoked as * It is invoked as
* *
* fixdep <target> <topdir> <cmdline> * fixdep <depfile> <target> <topdir> <cmdline>
* *
* and will read the dependency file ".<target>.d". * and will read the dependency file <depfile>
* *
* The transformed dependency snipped is written to stdout. * The transformed dependency snipped is written to stdout.
* *
...@@ -112,29 +112,20 @@ ...@@ -112,29 +112,20 @@
#define INT_FIG_ ntohl(0x4649475f) #define INT_FIG_ ntohl(0x4649475f)
char *topdir; char *topdir;
char *target;
char *depfile;
char *cmdline;
void usage(void) void usage(void)
{ {
fprintf(stderr, "Usage: fixdep <target> <topdir> <cmdline>\n"); fprintf(stderr, "Usage: fixdep <depfile> <target> <topdir> <cmdline>\n");
exit(1); exit(1);
} }
void print_cmdline(char *target, char *cmdline) void print_cmdline(void)
{ {
char *s = strdup(target); printf("cmd_%s := %s\n\n", target, cmdline);
char *p = s;
if (!s) {
fprintf(stderr, "no mem!\n");
exit(2);
}
while ((p = strchr(p,'/')))
*p = '_';
printf("cmd_%s := %s\n\n", s, cmdline);
free(s);
} }
char * str_config = NULL; char * str_config = NULL;
...@@ -297,11 +288,11 @@ void parse_dep_file(void *map, size_t len) ...@@ -297,11 +288,11 @@ void parse_dep_file(void *map, size_t len)
p = strchr(m, ':'); p = strchr(m, ':');
if (!p) { if (!p) {
fprintf(stderr, "parse error at %d", __LINE__); fprintf(stderr, "fixdep: parse error\n");
exit(1); exit(1);
} }
memcpy(s, m, p-m); s[p-m] = 0; memcpy(s, m, p-m); s[p-m] = 0;
printf("%s: \\\n", s); printf("%s: \\\n", target);
m = p+1; m = p+1;
clear_config(); clear_config();
...@@ -326,22 +317,20 @@ void parse_dep_file(void *map, size_t len) ...@@ -326,22 +317,20 @@ void parse_dep_file(void *map, size_t len)
printf("\n"); printf("\n");
} }
void print_deps(char *target) void print_deps(void)
{ {
char filename[PATH_MAX];
struct stat st; struct stat st;
int fd; int fd;
void *map; void *map;
sprintf(filename, ".%s.d", target); fd = open(depfile, O_RDONLY);
fd = open(filename, O_RDONLY);
if (fd < 0) { if (fd < 0) {
perror(filename); perror(depfile);
exit(2); exit(2);
} }
fstat(fd, &st); fstat(fd, &st);
if (st.st_size == 0) { if (st.st_size == 0) {
fprintf(stderr,"%s is empty\n",filename); fprintf(stderr,"fixdep: %s is empty\n",depfile);
close(fd); close(fd);
return; return;
} }
...@@ -362,7 +351,7 @@ void traps(void) ...@@ -362,7 +351,7 @@ void traps(void)
char *test = "CONF"; char *test = "CONF";
if (*(int *)test != INT_CONF) { if (*(int *)test != INT_CONF) {
fprintf(stderr, "sizeof(int) != 4 or wrong endianess? %#x\n", fprintf(stderr, "fixdep: sizeof(int) != 4 or wrong endianess? %#x\n",
*(int *)test); *(int *)test);
exit(2); exit(2);
} }
...@@ -370,19 +359,18 @@ void traps(void) ...@@ -370,19 +359,18 @@ void traps(void)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
char *target, *cmdline;
traps(); traps();
if (argc != 4) if (argc != 5)
usage(); usage();
target = argv[1]; depfile = argv[1];
topdir = argv[2]; target = argv[2];
cmdline = argv[3]; topdir = argv[3];
cmdline = argv[4];
print_cmdline(target, cmdline); print_cmdline();
print_deps(target); print_deps();
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment