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