Merge tag 'v3.10.69' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / um / Makefile
CommitLineData
4f193362
PS
1#
2# This file is included by the global makefile so that you can add your own
3# architecture-specific flags and dependencies.
4#
4c9e1385 5# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
1da177e4
LT
6# Licensed under the GPL
7#
8
9ARCH_DIR := arch/um
10OS := $(shell uname -s)
11# We require bash because the vmlinux link and loader script cpp use bash
12# features.
13SHELL := /bin/bash
14
15filechk_gen_header = $<
16
17core-y += $(ARCH_DIR)/kernel/ \
18 $(ARCH_DIR)/drivers/ \
19 $(ARCH_DIR)/os-$(OS)/
20
8569c914 21MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/shared/skas
1da177e4 22
7bbe7204
AV
23HEADER_ARCH := $(SUBARCH)
24
25# Additional ARCH settings for x86
26ifeq ($(SUBARCH),i386)
27 HEADER_ARCH := x86
28endif
29ifeq ($(SUBARCH),x86_64)
30 HEADER_ARCH := x86
12783aa0 31 KBUILD_CFLAGS += -mcmodel=large
7bbe7204
AV
32endif
33
5c48b108
AV
34HOST_DIR := arch/$(HEADER_ARCH)
35
42fda663 36include $(srctree)/$(ARCH_DIR)/Makefile-skas
5c48b108
AV
37include $(srctree)/$(HOST_DIR)/Makefile.um
38
39core-y += $(HOST_DIR)/um/
1da177e4 40
22409f9c
AV
41SHARED_HEADERS := $(ARCH_DIR)/include/shared
42ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS)
5c48b108
AV
43ARCH_INCLUDE += -I$(srctree)/$(HOST_DIR)/um/shared
44KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um
1da177e4 45
98105d47
PBG
46# -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so
47# named - it's a common symbol in libpcap, so we get a binary which crashes.
fd748104 48#
98105d47
PBG
49# Same things for in6addr_loopback and mktime - found in libc. For these two we
50# only get link-time error, luckily.
51#
52# These apply to USER_CFLAGS to.
1da177e4 53
dc5be20a 54KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
98105d47 55 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \
818f6ef4 56 -Din6addr_loopback=kernel_in6addr_loopback \
2c51a4bc 57 -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
fd748104 58
222d394d 59KBUILD_AFLAGS += $(ARCH_INCLUDE)
1da177e4 60
d45e44d4 61USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
a0f97e06 62 $(patsubst -I%,,$(KBUILD_CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \
4d45db9c 63 $(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 -idirafter include
d45e44d4 64
d45e44d4
AM
65#This will adjust *FLAGS accordingly to the platform.
66include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
ecc354a9 67
c9b284b2 68KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/include \
abbf1590
DH
69 -I$(srctree)/$(HOST_DIR)/include/uapi \
70 -I$(HOST_DIR)/include/generated \
71 -I$(HOST_DIR)/include/generated/uapi
1de1502c 72
ecc354a9
PBG
73# -Derrno=kernel_errno - This turns all kernel references to errno into
74# kernel_errno to separate them from the libc errno. This allows -fno-common
a0f97e06 75# in KBUILD_CFLAGS. Otherwise, it would cause ld to complain about the two different
ecc354a9 76# errnos.
98105d47 77# These apply to kernelspace only.
f15cf515
JD
78#
79# strip leading and trailing whitespace to make the USER_CFLAGS removal of these
80# defines more robust
ecc354a9 81
f15cf515
JD
82KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
83 -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES))
a0f97e06 84KBUILD_CFLAGS += $(KERNEL_DEFINES)
1da177e4 85
4f193362 86PHONY += linux
1da177e4
LT
87
88all: linux
89
90linux: vmlinux
a4b741e3 91 @echo ' LINK $@'
cb8aa3d2 92 $(Q)ln -f $< $@
1da177e4
LT
93
94define archhelp
95 echo '* linux - Binary kernel image (./linux) - for backward'
96 echo ' compatibility only, this creates a hard link to the'
4b3f686d 97 echo ' real kernel binary, the "vmlinux" binary you'
1da177e4
LT
98 echo ' find in the kernel root.'
99endef
100
5c48b108 101KBUILD_KCONFIG := $(HOST_DIR)/um/Kconfig
1da177e4 102
c9b284b2 103archheaders:
79320bcb 104 $(Q)$(MAKE) -C '$(srctree)' KBUILD_SRC= \
dc5be20a 105 ARCH=$(HEADER_ARCH) O='$(objtree)' archheaders
c9b284b2 106
4de1c5f6 107archprepare: include/generated/user_constants.h
1da177e4
LT
108
109LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
110LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib
111
275e6e1e
PBG
112CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \
113 $(call cc-option, -fno-stack-protector,) \
114 $(call cc-option, -fno-stack-protector-all,)
115
51b563fc
SR
116# Options used by linker script
117export LDS_START := $(START)
118export LDS_ELF_ARCH := $(ELF_ARCH)
119export LDS_ELF_FORMAT := $(ELF_FORMAT)
1da177e4 120
4c9e1385 121# The wrappers will select whether using "malloc" or the kernel allocator.
1da177e4
LT
122LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
123
260c0cb8 124LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt))
0ba7fe03 125
1f2bfbd0
SR
126# Used by link-vmlinux.sh which has special support for um link
127export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
1da177e4 128
4c9e1385
JD
129# When cleaning we don't include .config, so we don't include
130# TT or skas makefiles and don't clean skas_ptregs.h.
9e636452 131CLEAN_FILES += linux x.i gmon.out
1da177e4 132
1da177e4 133archclean:
1da177e4
LT
134 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
135 -o -name '*.gcov' \) -type f -print | xargs rm -f
136
1da177e4 137# Generated files
4ee189a9 138
392f4b7d 139$(HOST_DIR)/um/user-offsets.s: __headers FORCE
5c48b108 140 $(Q)$(MAKE) $(build)=$(HOST_DIR)/um $@
4ee189a9 141
f64a227b
SR
142define filechk_gen-asm-offsets
143 (set -e; \
f64a227b
SR
144 echo "/*"; \
145 echo " * DO NOT MODIFY."; \
146 echo " *"; \
147 echo " * This file was generated by arch/$(ARCH)/Makefile"; \
148 echo " *"; \
149 echo " */"; \
150 echo ""; \
151 sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \
ecba97d4 152 echo ""; )
f64a227b
SR
153endef
154
5c48b108 155include/generated/user_constants.h: $(HOST_DIR)/um/user-offsets.s
8d0b9dc9
AV
156 $(call filechk,gen-asm-offsets)
157
5c48b108 158export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS DEV_NULL_PATH