Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 486a153f authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild

parents 9c8550ee f64a227b
Loading
Loading
Loading
Loading

Kbuild

0 → 100644
+48 −0
Original line number Diff line number Diff line
#
# Kbuild for top-level directory of the kernel
# This file takes care of the following:
# 1) Generate asm-offsets.h

#####
# 1) Generate asm-offsets.h 
#

offsets-file := include/asm-$(ARCH)/asm-offsets.h

always  := $(offsets-file)
targets := $(offsets-file)
targets += arch/$(ARCH)/kernel/asm-offsets.s

# Default sed regexp - multiline due to syntax constraints
define sed-y
	"/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
endef
# Override default regexp for specific architectures
sed-$(CONFIG_MIPS) := "/^@@@/s///p"

quiet_cmd_offsets = GEN     $@
define cmd_offsets
	cat $< | \
	(set -e; \
	 echo "#ifndef __ASM_OFFSETS_H__"; \
	 echo "#define __ASM_OFFSETS_H__"; \
	 echo "/*"; \
	 echo " * DO NOT MODIFY."; \
	 echo " *"; \
	 echo " * This file was generated by $(srctree)/Kbuild"; \
	 echo " *"; \
	 echo " */"; \
	 echo ""; \
	 sed -ne $(sed-y); \
	 echo ""; \
	 echo "#endif" ) > $@
endef

# We use internal kbuild rules to avoid the "is up to date" message from make
arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE
	$(Q)mkdir -p $(dir $@)
	$(call if_changed_dep,cc_s_c)

$(srctree)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild
	$(call cmd,offsets)
+11 −28
Original line number Diff line number Diff line
@@ -776,14 +776,14 @@ $(vmlinux-dirs): prepare-all scripts
# A multi level approach is used. prepare1 is updated first, then prepare0.
# prepare-all is the collection point for the prepare targets.

.PHONY: prepare-all prepare prepare0 prepare1 prepare2
.PHONY: prepare-all prepare prepare0 prepare1 prepare2 prepare3

# prepare2 is used to check if we are building in a separate output directory,
# prepare3 is used to check if we are building in a separate output directory,
# and if so do:
# 1) Check that make has not been executed in the kernel src $(srctree)
# 2) Create the include2 directory, used for the second asm symlink

prepare2:
prepare3:
ifneq ($(KBUILD_SRC),)
	@echo '  Using $(srctree) as source for kernel'
	$(Q)if [ -f $(srctree)/.config ]; then \
@@ -795,18 +795,21 @@ ifneq ($(KBUILD_SRC),)
	$(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm
endif

# prepare1 creates a makefile if using a separate output directory
prepare1: prepare2 outputmakefile
# prepare2 creates a makefile if using a separate output directory
prepare2: prepare3 outputmakefile

prepare0: prepare1 include/linux/version.h include/asm \
prepare1: prepare2 include/linux/version.h include/asm \
                   include/config/MARKER
ifneq ($(KBUILD_MODULES),)
	$(Q)rm -rf $(MODVERDIR)
	$(Q)mkdir -p $(MODVERDIR)
endif

prepare0: prepare prepare1 FORCE
	$(Q)$(MAKE) $(build)=$(srctree)

# All the preparing..
prepare-all: prepare0 prepare
prepare-all: prepare0

#	Leave this as default for preprocessing vmlinux.lds.S, which is now
#	done in arch/$(ARCH)/kernel/Makefile
@@ -949,26 +952,6 @@ modules modules_install: FORCE

endif # CONFIG_MODULES

# Generate asm-offsets.h 
# ---------------------------------------------------------------------------

define filechk_gen-asm-offsets
	(set -e; \
	 echo "#ifndef __ASM_OFFSETS_H__"; \
	 echo "#define __ASM_OFFSETS_H__"; \
	 echo "/*"; \
	 echo " * DO NOT MODIFY."; \
	 echo " *"; \
	 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
	 echo " *"; \
	 echo " */"; \
	 echo ""; \
	 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
	 echo ""; \
	 echo "#endif" )
endef


###
# Cleaning is done on three levels.
# make clean     Delete most generated files
@@ -991,7 +974,7 @@ MRPROPER_FILES += .config .config.old include/asm .version \
#
clean: rm-dirs  := $(CLEAN_DIRS)
clean: rm-files := $(CLEAN_FILES)
clean-dirs      := $(addprefix _clean_,$(vmlinux-alldirs))
clean-dirs      := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))

.PHONY: $(clean-dirs) clean archclean
$(clean-dirs):
+0 −11
Original line number Diff line number Diff line
@@ -108,20 +108,9 @@ $(boot)/vmlinux.gz: vmlinux
bootimage bootpfile bootpzfile: vmlinux
	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@


prepare: include/asm-$(ARCH)/asm_offsets.h

arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
				   include/config/MARKER

include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
	$(call filechk,gen-asm-offsets)

archclean:
	$(Q)$(MAKE) $(clean)=$(boot)

CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h

define archhelp
  echo '* boot		- Compressed kernel image (arch/alpha/boot/vmlinux.gz)'
  echo '  bootimage	- SRM bootable image (arch/alpha/boot/bootimage)'
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 */

#include <linux/config.h>
#include <asm/asm_offsets.h>
#include <asm/asm-offsets.h>
#include <asm/thread_info.h>
#include <asm/pal.h>
#include <asm/errno.h>
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@

#include <linux/config.h>
#include <asm/system.h>
#include <asm/asm_offsets.h>
#include <asm/asm-offsets.h>

.globl swapper_pg_dir
.globl _stext
Loading