Commit 69964a47 authored by Sam Ravnborg's avatar Sam Ravnborg Committed by Kai Germaschewski

kbuild: $(build) and $(clean) macros for make invocation

The former macro $(descend ...) hide for make the fact that a recursively make was
invoked. The replacement $(Q)$(MAKE) -f scripts/Makefile.build obj=dir was too verbose.
  
Introduced $(build) and $(clean) allowing the following syntax:
$(Q)$(MAKE) $(build)=arch/i386/boot target
and similar for clean.
  
Introduced $(build) and $(clean) in general, and for i386 architecture.
parent 527efc05
......@@ -203,7 +203,7 @@ scripts/docproc scripts/fixdep scripts/split-include : scripts ;
.PHONY: scripts
scripts:
$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts
$(Q)$(MAKE) $(build)=scripts
# Objects we will link into vmlinux / subdirs we need to visit
# ---------------------------------------------------------------------------
......@@ -315,7 +315,7 @@ define rule_vmlinux__
echo ' Generating build number'
. $(src)/scripts/mkversion > .tmp_version
mv -f .tmp_version .version
$(Q)$(MAKE) -f scripts/Makefile.build obj=init
$(Q)$(MAKE) $(build)=init
)
$(call cmd,vmlinux__)
echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
......@@ -385,7 +385,7 @@ $(sort $(vmlinux-objs)): $(SUBDIRS) ;
.PHONY: $(SUBDIRS)
$(SUBDIRS): .hdepend prepare
$(Q)$(MAKE) -f scripts/Makefile.build obj=$@
$(Q)$(MAKE) $(build)=$@
# Things we need done before we descend to build or make
# module versions are listed in "prepare"
......@@ -408,17 +408,17 @@ targets += arch/$(ARCH)/vmlinux.lds.s
# ---------------------------------------------------------------------------
%.s: %.c scripts FORCE
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
$(Q)$(MAKE) $(build)=$(@D) $@
%.i: %.c scripts FORCE
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
$(Q)$(MAKE) $(build)=$(@D) $@
%.o: %.c scripts FORCE
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
$(Q)$(MAKE) $(build)=$(@D) $@
%.lst: %.c scripts FORCE
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
$(Q)$(MAKE) $(build)=$(@D) $@
%.s: %.S scripts FORCE
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
$(Q)$(MAKE) $(build)=$(@D) $@
%.o: %.S scripts FORCE
$(Q)$(MAKE) -f scripts/Makefile.build obj=$(@D) $@
$(Q)$(MAKE) $(build)=$(@D) $@
# FIXME: The asm symlink changes when $(ARCH) changes. That's
# hard to detect, but I suppose "make mrproper" is a good idea
......@@ -439,7 +439,7 @@ include/config/MARKER: scripts/split-include include/linux/autoconf.h
# with it and forgot to run make oldconfig
include/linux/autoconf.h: .config
$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/kconfig scripts/kconfig/conf
$(Q)$(MAKE) $(build)=scripts/kconfig scripts/kconfig/conf
./scripts/kconfig/conf -s arch/$(ARCH)/Kconfig
# Generate some files
......@@ -657,13 +657,13 @@ ifeq ($(filter-out $(noconfig_targets),$(MAKECMDGOALS)),)
make_with_config
scripts/kconfig/conf scripts/kconfig/mconf scripts/kconfig/qconf: scripts/fixdep FORCE
$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/kconfig $@
$(Q)$(MAKE) $(build)=scripts/kconfig $@
xconfig: scripts/kconfig/qconf
./scripts/kconfig/qconf arch/$(ARCH)/Kconfig
menuconfig: scripts/kconfig/mconf
$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/lxdialog
$(Q)$(MAKE) $(build)=scripts/lxdialog
./scripts/kconfig/mconf arch/$(ARCH)/Kconfig
config: scripts/kconfig/conf
......@@ -719,7 +719,7 @@ MRPROPER_DIRS += \
clean-dirs += $(ALL_SUBDIRS) Documentation/DocBook scripts
$(addprefix _clean_,$(clean-dirs)):
$(Q)$(MAKE) -f scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
quiet_cmd_rmclean = RM $$(CLEAN_FILES)
cmd_rmclean = rm -f $(CLEAN_FILES)
......@@ -819,7 +819,7 @@ help:
# Documentation targets
# ---------------------------------------------------------------------------
sgmldocs psdocs pdfdocs htmldocs: scripts
$(Q)$(MAKE) -f scripts/Makefile.build obj=Documentation/DocBook $@
$(Q)$(MAKE) $(build)=Documentation/DocBook $@
# Scripts to check various things for consistency
# ---------------------------------------------------------------------------
......@@ -907,9 +907,20 @@ define update-if-changed
mv -f $@.tmp $@; \
fi
endef
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
# Usage:
# $(Q)$(MAKE) $(build)=dir
build := -f scripts/Makefile.build obj
# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
# Usage:
# $(Q)$(MAKE) $(clean)=dir
clean := -f scripts/Makefile.clean obj
# $(call descend,<dir>,<target>)
# Recursively call a sub-make in <dir> with target <target>
# Usage is deprecated, because make do not see this as an invocation of make.
descend =$(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2)
FORCE:
......@@ -83,7 +83,7 @@ drivers-$(CONFIG_OPROFILE) += arch/i386/oprofile/
CFLAGS += $(mflags-y)
AFLAGS += $(mflags-y)
makeboot =$(Q)$(MAKE) -f scripts/Makefile.build obj=arch/i386/boot $(1)
boot := arch/i386/boot
.PHONY: zImage bzImage compressed zlilo bzlilo zdisk bzdisk install \
clean archclean archmrproper
......@@ -94,20 +94,18 @@ BOOTIMAGE=arch/i386/boot/bzImage
zImage zlilo zdisk: BOOTIMAGE=arch/i386/boot/zImage
zImage bzImage: vmlinux
$(call makeboot,$(BOOTIMAGE))
$(Q)$(MAKE) $(build)=$(boot) $(BOOTIMAGE)
compressed: zImage
zlilo bzlilo: vmlinux
$(call makeboot,BOOTIMAGE=$(BOOTIMAGE) zlilo)
$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zlilo
zdisk bzdisk: vmlinux
$(call makeboot,BOOTIMAGE=$(BOOTIMAGE) zdisk)
$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zdisk
install: vmlinux
$(call makeboot,BOOTIMAGE=$(BOOTIMAGE) install)
$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) install
archclean:
$(Q)$(MAKE) -f scripts/Makefile.clean obj=arch/i386/boot
archmrproper:
$(Q)$(MAKE) $(clean)=arch/i386/boot
......@@ -286,7 +286,7 @@ targets += $(host-csingle) $(host-cmulti) $(host-cobjs)\
.PHONY: $(subdir-ym)
$(subdir-ym):
$(Q)$(MAKE) -f scripts/Makefile.build obj=$@
$(Q)$(MAKE) $(build)=$@
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------
......
......@@ -56,8 +56,13 @@ endif
.PHONY: $(subdir-ymn)
$(subdir-ymn):
$(Q)$(MAKE) -f scripts/Makefile.clean obj=$@
$(Q)$(MAKE) $(clean)=$@
# If quiet is set, only print short version of command
cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1))
# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir
# Usage:
# $(Q)$(MAKE) $(clean)=dir
clean := -f scripts/Makefile.clean obj
......@@ -244,5 +244,10 @@ endef
# $(call descend,<dir>,<target>)
# Recursively call a sub-make in <dir> with target <target>
# Usage is deprecated, because make do not see this as an invocation of make.
descend =$(Q)$(MAKE) -f scripts/Makefile.build obj=$(1) $(2)
# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=
# Usage:
# $(Q)$(MAKE) $(build)=dir
build := -f scripts/Makefile.build obj
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