Commit cc4749dc authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Use consistently FORCE instead of dummy

FORCE is the de-facto standard name for a prequisite to force
recompilation, so instead of using a mix of 'dummy','FORCE' and
'FORCE_RECOMPILE' use 'FORCE' everywhere.

Also, move figuring out the path relative to the top level dir
into Rules.make, instead of calling an external script. 
parent 6f31fe5a
......@@ -12,16 +12,16 @@ EPS-parportbook := $(patsubst %.fig, %.eps, $(IMG-parportbook))
PNG-parportbook := $(patsubst %.fig, %.png, $(IMG-parportbook))
C-procfs-example = procfs_example.sgml
$(TOPDIR)/scripts/docgen: dummy
$(TOPDIR)/scripts/docgen: FORCE
chmod 755 $(TOPDIR)/scripts/docgen
$(TOPDIR)/scripts/gen-all-syms: dummy
$(TOPDIR)/scripts/gen-all-syms: FORCE
chmod 755 $(TOPDIR)/scripts/gen-all-syms
$(TOPDIR)/scripts/kernel-doc: dummy
$(TOPDIR)/scripts/kernel-doc: FORCE
chmod 755 $(TOPDIR)/scripts/kernel-doc
$(TOPDIR)/scripts/docproc: dummy
$(TOPDIR)/scripts/docproc: FORCE
$(MAKE) -C $(TOPDIR)/scripts docproc
$(BOOKS): $(TOPDIR)/scripts/docgen $(TOPDIR)/scripts/gen-all-syms \
......
......@@ -209,7 +209,7 @@ define rule_link_vmlinux
$(NM) vmlinux | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > System.map
endef
vmlinux: $(CONFIGURATION) $(vmlinux-objs) dummy
vmlinux: $(CONFIGURATION) $(vmlinux-objs) FORCE
$(call if_changed_rule,link_vmlinux)
# The actual objects are generated when descending,
......@@ -219,7 +219,7 @@ $(sort $(vmlinux-objs)): $(SUBDIRS) ;
# Handle descending into subdirectories listed in $(SUBDIRS)
$(SUBDIRS): dummy include/linux/version.h include/config/MARKER
$(SUBDIRS): FORCE include/linux/version.h include/config/MARKER
@$(MAKE) -C $@
# Configuration
......@@ -327,7 +327,7 @@ else # CONFIG_MODULES
# ---------------------------------------------------------------------------
# Modules not configured
modules modules_install: dummy
modules modules_install: FORCE
@echo
@echo "The present kernel configuration has modules disabled."
@echo "Type 'make config' and enable loadable module support."
......@@ -474,13 +474,13 @@ checkincludes:
# Generate tags for editors
TAGS: dummy
TAGS: FORCE
{ find include/asm-${ARCH} -name '*.h' -print ; \
find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print ; \
find $(SUBDIRS) init -name '*.[ch]' ; } | grep -v SCCS | etags -
# Exuberant ctags works better with -I
tags: dummy
tags: FORCE
CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_NOVERS"`; \
ctags $$CTAGSF `find include/asm-$(ARCH) -name '*.h'` && \
find include -type d \( -name "asm-*" -o -name config \) -prune -o -name '*.h' -print | xargs ctags $$CTAGSF -a && \
......
......@@ -26,7 +26,25 @@ unexport subdir-n
unexport subdir-
unexport mod-subdirs
# Some standard vars
comma := ,
empty :=
space := $(empty) $(empty)
# Figure out paths
# ---------------------------------------------------------------------------
# Find the path relative to the toplevel dir, $(RELDIR), and express
# the toplevel dir as a relative path from this dir, $(TOPDIR_REL)
ifeq ($(findstring $(TOPDIR),$(CURDIR)),)
# Can only happen when something is built out of tree
RELDIR := $(CURDIR)
TOPDIR_REL := $(TOPDIR)
else
RELDIR := $(subst $(TOPDIR)/,,$(CURDIR))
TOPDIR_REL := $(subst $(space),,$(foreach d,$(subst /, ,$(RELDIR)),../))
endif
# Figure out what we need to build from the various variables
# ===========================================================================
......@@ -123,17 +141,17 @@ c_flags = $(CFLAGS) $(modkern_cflags) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) -DKBUILD
cmd_cc_s_c = $(CC) $(c_flags) -S $< -o $@
%.s: %.c dummy
%.s: %.c FORCE
$(call if_changed,cmd_cc_s_c)
cmd_cc_i_c = $(CPP) $(c_flags) $< > $@
%.i: %.c dummy
%.i: %.c FORCE
$(call if_changed,cmd_cc_i_c)
cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
%.o: %.c dummy
%.o: %.c FORCE
$(call if_changed,cmd_cc_o_c)
# Compile assembler sources (.S)
......@@ -152,12 +170,12 @@ a_flags = $(AFLAGS) $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o)
cmd_as_s_S = $(CPP) $(a_flags) $< > $@
%.s: %.S dummy
%.s: %.S FORCE
$(call if_changed,cmd_as_s_S)
cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
%.o: %.S dummy
%.o: %.S FORCE
$(call if_changed,cmd_as_o_S)
# FIXME
......@@ -193,7 +211,7 @@ cmd_link_o_target = $(if $(strip $(obj-y)),\
$(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $(obj-y), $^),\
rm -f $@; $(AR) rcs $@)
$(O_TARGET): $(obj-y) dummy
$(O_TARGET): $(obj-y) FORCE
$(call if_changed,cmd_link_o_target)
endif # O_TARGET
......@@ -203,7 +221,7 @@ endif # O_TARGET
ifdef L_TARGET
cmd_link_l_target = rm -f $@; $(AR) $(EXTRA_ARFLAGS) rcs $@ $(obj-y)
$(L_TARGET): $(obj-y) dummy
$(L_TARGET): $(obj-y) FORCE
$(call if_changed,cmd_link_l_target)
endif
......@@ -218,16 +236,16 @@ cmd_link_multi = $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(filter $($(basename $@)-objs)
# foo.o: $(foo-objs)
# but that's not so easy, so we rather make all composite objects depend
# on the set of all their parts
$(multi-used-y) : %.o: $(multi-objs-y) dummy
$(multi-used-y) : %.o: $(multi-objs-y) FORCE
$(call if_changed,cmd_link_multi)
$(multi-used-m) : %.o: $(multi-objs-m) dummy
$(multi-used-m) : %.o: $(multi-objs-m) FORCE
$(call if_changed,cmd_link_multi)
#
# This make dependencies quickly
#
fastdep: dummy
fastdep: FORCE
$(TOPDIR)/scripts/mkdep $(CFLAGS) $(EXTRA_CFLAGS) -- $(wildcard *.[chS]) > .depend
ifdef ALL_SUB_DIRS
$(MAKE) $(patsubst %,_sfdep_%,$(ALL_SUB_DIRS)) _FASTDEP_ALL_SUB_DIRS="$(ALL_SUB_DIRS)"
......@@ -243,50 +261,46 @@ endif
# A rule to make subdirectories
#
subdir-list = $(sort $(patsubst %,_subdir_%,$(SUB_DIRS)))
sub_dirs: dummy $(subdir-list)
sub_dirs: FORCE $(subdir-list)
ifdef SUB_DIRS
$(subdir-list) : dummy
$(subdir-list) : FORCE
@$(MAKE) -C $(patsubst _subdir_%,%,$@)
endif
#
# A rule to make modules
#
ifneq "$(strip $(obj-m))" ""
MOD_DESTDIR := $(shell $(CONFIG_SHELL) $(TOPDIR)/scripts/pathdown.sh)
endif
ifneq "$(strip $(MOD_SUB_DIRS))" ""
.PHONY: $(patsubst %,_modsubdir_%,$(MOD_SUB_DIRS))
$(patsubst %,_modsubdir_%,$(MOD_SUB_DIRS)) : dummy
$(patsubst %,_modsubdir_%,$(MOD_SUB_DIRS)) : FORCE
@$(MAKE) -C $(patsubst _modsubdir_%,%,$@) modules
.PHONY: $(patsubst %,_modinst_%,$(MOD_SUB_DIRS))
$(patsubst %,_modinst_%,$(MOD_SUB_DIRS)) : dummy
$(patsubst %,_modinst_%,$(MOD_SUB_DIRS)) : FORCE
@$(MAKE) -C $(patsubst _modinst_%,%,$@) modules_install
endif
.PHONY: modules
modules: $(obj-m) dummy \
modules: $(obj-m) FORCE \
$(patsubst %,_modsubdir_%,$(MOD_SUB_DIRS))
.PHONY: _modinst__
_modinst__: dummy
_modinst__: FORCE
ifneq "$(strip $(obj-m))" ""
mkdir -p $(MODLIB)/kernel/$(MOD_DESTDIR)
cp $(obj-m) $(MODLIB)/kernel/$(MOD_DESTDIR)
mkdir -p $(MODLIB)/kernel/$(RELDIR)
cp $(obj-m) $(MODLIB)/kernel/$(RELDIR)
endif
.PHONY: modules_install
modules_install: _modinst__ \
$(patsubst %,_modinst_%,$(MOD_SUB_DIRS))
#
# FIXME: This is usually called FORCE, to express what it's used for
#
.PHONY: dummy
dummy:
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
.PHONY: FORCE
FORCE:
#
# This is useful for testing
......@@ -307,12 +321,9 @@ active-objs := $(sort $(multi-objs) $(obj-y) $(obj-m))
ifdef CONFIG_MODVERSIONS
ifneq "$(strip $(export-objs))" ""
MODINCL = $(TOPDIR)/include/linux/modules
MODCURDIR = $(subst $(TOPDIR)/,,$(shell /bin/pwd))
MODPREFIX = $(subst /,-,$(MODCURDIR))__
MODINCL := $(TOPDIR)/include/linux/modules
MODPREFIX := $(subst /,-,$(RELDIR))__
# The -w option (enable warnings) for genksyms will return here in 2.1
# So where has it gone?
#
# Added the SMP separator to stop module accidents between uniprocessor
# and SMP Intel boxes - AC - from bits by Michael Chastain
......
......@@ -55,7 +55,7 @@ main.o: ksize.h
bootp.o: ksize.h
ksize.h: vmlinux.nh dummy
ksize.h: vmlinux.nh FORCE
echo "#define KERNEL_SIZE `ls -l vmlinux.nh | awk '{print $$5}'`" > $@T
ifdef INITRD
[ -f $(INITRD) ] || exit 1
......@@ -98,4 +98,4 @@ clean:
dep:
dummy:
FORCE:
......@@ -209,7 +209,7 @@ archsymlinks:
vmlinux: arch/arm/vmlinux.lds
arch/arm/vmlinux.lds: $(LDSCRIPT) dummy
arch/arm/vmlinux.lds: $(LDSCRIPT) FORCE
@sed 's/TEXTADDR/$(TEXTADDR)/;s/DATAADDR/$(DATAADDR)/' $(LDSCRIPT) >$@
bzImage zImage zinstall Image bootpImage install: vmlinux
......
......@@ -82,10 +82,10 @@ cramfs:
clinux: vmlinux.bin decompress.bin rescue.bin
decompress.bin: dummy
decompress.bin: FORCE
@make -C arch/cris/boot/compressed decompress.bin
rescue.bin: dummy
rescue.bin: FORCE
@make -C arch/cris/boot/rescue rescue.bin
zImage: vmlinux.bin
......
......@@ -107,8 +107,6 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/i386/vmlinux.lds
FORCE: ;
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper archdep
......
......@@ -106,8 +106,6 @@ arch/$(ARCH)/vmlinux.lds: arch/$(ARCH)/vmlinux.lds.S FORCE
$(CPP) -D__ASSEMBLY__ -C -P -I$(HPATH) -I$(HPATH)/asm-$(ARCH) \
-traditional arch/$(ARCH)/vmlinux.lds.S > $@
FORCE: ;
compressed: vmlinux
$(OBJCOPY) --strip-all vmlinux vmlinux-tmp
gzip vmlinux-tmp
......
......@@ -33,11 +33,11 @@ offsets.h: print_offsets
comma := ,
print_offsets: print_offsets.c FORCE_RECOMPILE
print_offsets: print_offsets.c FORCE
$(CC) $(CFLAGS) -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) \
print_offsets.c -o $@
FORCE_RECOMPILE:
FORCE:
else
......
......@@ -47,6 +47,4 @@ mrproper:
rm -f addinitrd
rm -f elf2ecoff
dummy:
include $(TOPDIR)/Rules.make
......@@ -35,6 +35,4 @@ clean:
mrproper:
rm -f vmlinux.ecoff addinitrd elf2ecoff
dummy:
include $(TOPDIR)/Rules.make
......@@ -7,7 +7,7 @@
HOSTCFLAGS += -I$(TOPDIR)/arch/$(ARCH)/boot/include
all: dummy
all: FORCE
# Simple programs with 1 file and no extra CFLAGS
UTILS = addnote hack-coff mkprep mknote mkbugboot mktree \
......
......@@ -30,7 +30,7 @@ BTLIBS := $(CORE_FILES_NO_BTFIX) $(FILESYSTEMS) \
# build would work, but this fails because $(HEAD) cannot work
# properly as it will cause head.o to be built with the implicit
# rules not the ones in kernel/Makefile. Someone please fix. --DaveM
vmlinux.o: dummy
vmlinux.o: FORCE
$(LD) -r $(patsubst %,$(TOPDIR)/%,$(BTOBJS)) \
--start-group \
$(patsubst %,$(TOPDIR)/%,$(BTLIBS)) \
......
......@@ -37,7 +37,7 @@ endif
head.o: head.S
$(CC) $(AFLAGS) -ansi -c $*.S -o $*.o
check_asm: dummy
check_asm: FORCE
@if [ ! -r $(HPATH)/asm/asm_offsets.h ] ; then \
touch $(HPATH)/asm/asm_offsets.h ; \
fi
......
......@@ -74,8 +74,6 @@ MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux: arch/x86_64/vmlinux.lds
FORCE: ;
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper archdep checkoffset
......
......@@ -14,12 +14,10 @@ $(TARGET): offset.h
.PHONY : offset.h all modules modules_install
offset.h: offset.sed offset.c FORCE_RECOMPILE
offset.h: offset.sed offset.c FORCE
$(CC) $(CFLAGS) -S -o offset.tmp offset.c
sed -n -f offset.sed < offset.tmp > offset.h
FORCE_RECOMPILE:
clean:
rm -f offset.[hs] $(TARGET).new offset.tmp
......
......@@ -102,5 +102,5 @@ FORE200E_FW_CHANGED := $(filter-out $(FORE200E_FW_UP_TO_DATE), \
fore200e_pca_fw.c fore200e_sba_fw.c)
ifneq ($(FORE200E_FW_CHANGED),)
$(FORE200E_FW_CHANGED): dummy
$(FORE200E_FW_CHANGED): FORCE
endif
......@@ -15,8 +15,8 @@ version.o: ../include/linux/compile.h
# compile.h changes depending on hostname, generation number, etc,
# so we regenerate it always.
# mkcompile_h will make sure to only update the
# actualy file if its content has changed.
# actual file if its content has changed.
../include/linux/compile.h: ../include/linux/version.h dummy
../include/linux/compile.h: FORCE
@echo Generating $@
@. ../scripts/mkcompile_h $@ "$(ARCH)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)"
......@@ -5,7 +5,7 @@ TAIL=tail.tk
# on soundscript. This runs fairly fast, and I can't find all the
# Config.in files to depend on anyways. So I'll force it to remake.
kconfig.tk: dummy
kconfig.tk: FORCE
kconfig.tk: ${TOPDIR}/Makefile ${TOPDIR}/arch/${ARCH}/config.in \
tkparse ${HEADER} ${TAIL}
......
#!/bin/sh
UP=
DN=${PWD:?}
TP=${TOPDIR:?}
while [ ! $TP/$UP/. -ef $DN ] ;do
UP=`basename $PWD`/$UP
cd ..
if [ "$PWD" = "/" ]; then echo "Lost"; exit 1; fi
done
echo $UP
exit 0
......@@ -239,5 +239,5 @@ FILES_BOOT_CHANGED := $(strip \
maui_boot.h pss_boot.h trix_boot.h))
ifneq ($(FILES_BOOT_CHANGED),)
$(FILES_BOOT_CHANGED): dummy
$(FILES_BOOT_CHANGED): FORCE
endif
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