diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 62 |
1 files changed, 52 insertions, 10 deletions
@@ -179,9 +179,46 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ | |||
179 | # Alternatively CROSS_COMPILE can be set in the environment. | 179 | # Alternatively CROSS_COMPILE can be set in the environment. |
180 | # Default value for CROSS_COMPILE is not to prefix executables | 180 | # Default value for CROSS_COMPILE is not to prefix executables |
181 | # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile | 181 | # Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile |
182 | # | ||
183 | # To force ARCH and CROSS_COMPILE settings include kernel.* files | ||
184 | # in the kernel tree - do not patch this file. | ||
182 | export KBUILD_BUILDHOST := $(SUBARCH) | 185 | export KBUILD_BUILDHOST := $(SUBARCH) |
183 | ARCH ?= $(SUBARCH) | 186 | |
184 | CROSS_COMPILE ?= | 187 | # Kbuild save the ARCH and CROSS_COMPILE setting in kernel.* files. |
188 | # Restore these settings and check that user did not specify | ||
189 | # conflicting values. | ||
190 | |||
191 | saved_arch := $(shell cat include/generated/kernel.arch 2> /dev/null) | ||
192 | saved_cross := $(shell cat include/generated/kernel.cross 2> /dev/null) | ||
193 | |||
194 | ifneq ($(CROSS_COMPILE),) | ||
195 | ifneq ($(saved_cross),) | ||
196 | ifneq ($(CROSS_COMPILE),$(saved_cross)) | ||
197 | $(error CROSS_COMPILE changed from \ | ||
198 | "$(saved_cross)" to \ | ||
199 | to "$(CROSS_COMPILE)". \ | ||
200 | Use "make mrproper" to fix it up) | ||
201 | endif | ||
202 | endif | ||
203 | else | ||
204 | CROSS_COMPILE := $(saved_cross) | ||
205 | endif | ||
206 | |||
207 | ifneq ($(ARCH),) | ||
208 | ifneq ($(saved_arch),) | ||
209 | ifneq ($(saved_arch),$(ARCH)) | ||
210 | $(error ARCH changed from \ | ||
211 | "$(saved_arch)" to "$(ARCH)". \ | ||
212 | Use "make mrproper" to fix it up) | ||
213 | endif | ||
214 | endif | ||
215 | else | ||
216 | ifneq ($(saved_arch),) | ||
217 | ARCH := $(saved_arch) | ||
218 | else | ||
219 | ARCH := $(SUBARCH) | ||
220 | endif | ||
221 | endif | ||
185 | 222 | ||
186 | # Architecture as present in compile.h | 223 | # Architecture as present in compile.h |
187 | UTS_MACHINE := $(ARCH) | 224 | UTS_MACHINE := $(ARCH) |
@@ -315,6 +352,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy | |||
315 | OBJDUMP = $(CROSS_COMPILE)objdump | 352 | OBJDUMP = $(CROSS_COMPILE)objdump |
316 | AWK = awk | 353 | AWK = awk |
317 | GENKSYMS = scripts/genksyms/genksyms | 354 | GENKSYMS = scripts/genksyms/genksyms |
355 | INSTALLKERNEL := installkernel | ||
318 | DEPMOD = /sbin/depmod | 356 | DEPMOD = /sbin/depmod |
319 | KALLSYMS = scripts/kallsyms | 357 | KALLSYMS = scripts/kallsyms |
320 | PERL = perl | 358 | PERL = perl |
@@ -353,7 +391,8 @@ KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) | |||
353 | 391 | ||
354 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION | 392 | export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION |
355 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC | 393 | export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC |
356 | export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE | 394 | export CPP AR NM STRIP OBJCOPY OBJDUMP |
395 | export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE | ||
357 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS | 396 | export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS |
358 | 397 | ||
359 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS | 398 | export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS |
@@ -444,6 +483,11 @@ ifeq ($(config-targets),1) | |||
444 | include $(srctree)/arch/$(SRCARCH)/Makefile | 483 | include $(srctree)/arch/$(SRCARCH)/Makefile |
445 | export KBUILD_DEFCONFIG KBUILD_KCONFIG | 484 | export KBUILD_DEFCONFIG KBUILD_KCONFIG |
446 | 485 | ||
486 | # save ARCH & CROSS_COMPILE settings | ||
487 | $(shell mkdir -p include/generated && \ | ||
488 | echo $(ARCH) > include/generated/kernel.arch && \ | ||
489 | echo $(CROSS_COMPILE) > include/generated/kernel.cross) | ||
490 | |||
447 | config: scripts_basic outputmakefile FORCE | 491 | config: scripts_basic outputmakefile FORCE |
448 | $(Q)mkdir -p include/linux include/config | 492 | $(Q)mkdir -p include/linux include/config |
449 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ | 493 | $(Q)$(MAKE) $(build)=scripts/kconfig $@ |
@@ -571,6 +615,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) | |||
571 | # revert to pre-gcc-4.4 behaviour of .eh_frame | 615 | # revert to pre-gcc-4.4 behaviour of .eh_frame |
572 | KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) | 616 | KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) |
573 | 617 | ||
618 | # conserve stack if available | ||
619 | KBUILD_CFLAGS += $(call cc-option,-fconserve-stack) | ||
620 | |||
574 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments | 621 | # Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments |
575 | # But warn user when we do so | 622 | # But warn user when we do so |
576 | warn-assign = \ | 623 | warn-assign = \ |
@@ -591,12 +638,12 @@ endif | |||
591 | 638 | ||
592 | # Use --build-id when available. | 639 | # Use --build-id when available. |
593 | LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ | 640 | LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ |
594 | $(call ld-option, -Wl$(comma)--build-id,)) | 641 | $(call cc-ldoption, -Wl$(comma)--build-id,)) |
595 | LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) | 642 | LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID) |
596 | LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) | 643 | LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID) |
597 | 644 | ||
598 | ifeq ($(CONFIG_STRIP_ASM_SYMS),y) | 645 | ifeq ($(CONFIG_STRIP_ASM_SYMS),y) |
599 | LDFLAGS_vmlinux += -X | 646 | LDFLAGS_vmlinux += $(call ld-option, -X,) |
600 | endif | 647 | endif |
601 | 648 | ||
602 | # Default kernel image to build when no specific target is given. | 649 | # Default kernel image to build when no specific target is given. |
@@ -980,11 +1027,6 @@ prepare0: archprepare FORCE | |||
980 | # All the preparing.. | 1027 | # All the preparing.. |
981 | prepare: prepare0 | 1028 | prepare: prepare0 |
982 | 1029 | ||
983 | # Leave this as default for preprocessing vmlinux.lds.S, which is now | ||
984 | # done in arch/$(ARCH)/kernel/Makefile | ||
985 | |||
986 | export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH) | ||
987 | |||
988 | # The asm symlink changes when $(ARCH) changes. | 1030 | # The asm symlink changes when $(ARCH) changes. |
989 | # Detect this and ask user to run make mrproper | 1031 | # Detect this and ask user to run make mrproper |
990 | # If asm is a stale symlink (point to dir that does not exist) remove it | 1032 | # If asm is a stale symlink (point to dir that does not exist) remove it |