Blame view
arch/um/Makefile
4.89 KB
4f1933620
|
1 2 3 4 |
# # This file is included by the global makefile so that you can add your own # architecture-specific flags and dependencies. # |
4c9e13851
|
5 |
# Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) |
1da177e4c
|
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# Licensed under the GPL # ARCH_DIR := arch/um OS := $(shell uname -s) # We require bash because the vmlinux link and loader script cpp use bash # features. SHELL := /bin/bash filechk_gen_header = $< core-y += $(ARCH_DIR)/kernel/ \ $(ARCH_DIR)/drivers/ \ $(ARCH_DIR)/os-$(OS)/ |
8569c9140
|
20 |
MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/shared/skas |
1da177e4c
|
21 |
|
42fda6638
|
22 |
include $(srctree)/$(ARCH_DIR)/Makefile-skas |
1da177e4c
|
23 |
|
22409f9c8
|
24 25 |
SHARED_HEADERS := $(ARCH_DIR)/include/shared ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS) |
aa7bd9424
|
26 |
ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)/shared |
fd7aab9c1
|
27 |
ifneq ($(KBUILD_SRC),) |
22409f9c8
|
28 |
ARCH_INCLUDE += -I$(SHARED_HEADERS) |
fd7aab9c1
|
29 |
endif |
aa7bd9424
|
30 |
KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH) |
1da177e4c
|
31 |
|
98105d47d
|
32 33 |
# -Dvmap=kernel_vmap prevents anything from referencing the libpcap.o symbol so # named - it's a common symbol in libpcap, so we get a binary which crashes. |
fd7481047
|
34 |
# |
98105d47d
|
35 36 37 38 |
# Same things for in6addr_loopback and mktime - found in libc. For these two we # only get link-time error, luckily. # # These apply to USER_CFLAGS to. |
1da177e4c
|
39 |
|
260c0cb88
|
40 |
KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ |
98105d47d
|
41 |
$(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ |
818f6ef40
|
42 43 |
-Din6addr_loopback=kernel_in6addr_loopback \ -Din6addr_any=kernel_in6addr_any |
fd7481047
|
44 |
|
222d394d3
|
45 |
KBUILD_AFLAGS += $(ARCH_INCLUDE) |
1da177e4c
|
46 |
|
d45e44d4b
|
47 |
USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\ |
a0f97e06a
|
48 |
$(patsubst -I%,,$(KBUILD_CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \ |
260c0cb88
|
49 |
$(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 |
d45e44d4b
|
50 51 52 53 54 |
include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) #This will adjust *FLAGS accordingly to the platform. include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) |
ecc354a90
|
55 |
|
1de1502c9
|
56 |
KBUILD_CPPFLAGS += -I$(srctree)/arch/$(HEADER_ARCH)/include |
ecc354a90
|
57 58 |
# -Derrno=kernel_errno - This turns all kernel references to errno into # kernel_errno to separate them from the libc errno. This allows -fno-common |
a0f97e06a
|
59 |
# in KBUILD_CFLAGS. Otherwise, it would cause ld to complain about the two different |
ecc354a90
|
60 |
# errnos. |
98105d47d
|
61 |
# These apply to kernelspace only. |
f15cf5151
|
62 63 64 |
# # strip leading and trailing whitespace to make the USER_CFLAGS removal of these # defines more robust |
ecc354a90
|
65 |
|
f15cf5151
|
66 67 |
KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES)) |
a0f97e06a
|
68 |
KBUILD_CFLAGS += $(KERNEL_DEFINES) |
1da177e4c
|
69 |
|
4f1933620
|
70 |
PHONY += linux |
1da177e4c
|
71 72 73 74 |
all: linux linux: vmlinux |
a4b741e38
|
75 |
@echo ' LINK $@' |
cb8aa3d29
|
76 |
$(Q)ln -f $< $@ |
1da177e4c
|
77 78 79 80 |
define archhelp echo '* linux - Binary kernel image (./linux) - for backward' echo ' compatibility only, this creates a hard link to the' |
4b3f686d4
|
81 |
echo ' real kernel binary, the "vmlinux" binary you' |
1da177e4c
|
82 83 |
echo ' find in the kernel root.' endef |
61bee2044
|
84 |
KBUILD_KCONFIG := arch/um/Kconfig.$(HEADER_ARCH) |
1da177e4c
|
85 |
|
22409f9c8
|
86 87 |
archprepare: $(SHARED_HEADERS)/user_constants.h archprepare: $(SHARED_HEADERS)/kern_constants.h |
1da177e4c
|
88 89 90 |
LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib |
275e6e1ee
|
91 92 93 |
CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \ $(call cc-option, -fno-stack-protector,) \ $(call cc-option, -fno-stack-protector-all,) |
51b563fc9
|
94 95 96 97 |
# Options used by linker script export LDS_START := $(START) export LDS_ELF_ARCH := $(ELF_ARCH) export LDS_ELF_FORMAT := $(ELF_FORMAT) |
1da177e4c
|
98 |
|
4c9e13851
|
99 |
# The wrappers will select whether using "malloc" or the kernel allocator. |
1da177e4c
|
100 |
LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc |
260c0cb88
|
101 |
LD_FLAGS_CMDLINE = $(foreach opt,$(LDFLAGS),-Wl,$(opt)) |
0ba7fe03b
|
102 103 |
CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE) |
1da177e4c
|
104 105 106 107 |
define cmd_vmlinux__ $(CC) $(CFLAGS_vmlinux) -o $@ \ -Wl,-T,$(vmlinux-lds) $(vmlinux-init) \ -Wl,--start-group $(vmlinux-main) -Wl,--end-group \ |
776cfebb4
|
108 |
-lutil \ |
75473c1d3
|
109 |
$(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o \ |
1da177e4c
|
110 111 |
FORCE ,$^) ; rm -f linux endef |
4c9e13851
|
112 113 |
# When cleaning we don't include .config, so we don't include # TT or skas makefiles and don't clean skas_ptregs.h. |
87e299e5c
|
114 |
CLEAN_FILES += linux x.i gmon.out \ |
22409f9c8
|
115 116 |
$(SHARED_HEADERS)/user_constants.h \ $(SHARED_HEADERS)/kern_constants.h |
1da177e4c
|
117 |
|
1da177e4c
|
118 |
archclean: |
1da177e4c
|
119 120 |
@find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ -o -name '*.gcov' \) -type f -print | xargs rm -f |
1da177e4c
|
121 |
# Generated files |
4ee189a92
|
122 |
|
cb8aa3d29
|
123 124 |
$(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s: FORCE $(Q)$(MAKE) $(build)=$(ARCH_DIR)/sys-$(SUBARCH) $@ |
4ee189a92
|
125 |
|
f64a227b6
|
126 127 |
define filechk_gen-asm-offsets (set -e; \ |
f64a227b6
|
128 129 130 131 132 133 134 135 |
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;}"; \ |
ecba97d4a
|
136 |
echo ""; ) |
f64a227b6
|
137 |
endef |
22409f9c8
|
138 |
$(SHARED_HEADERS)/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s |
8d0b9dc9b
|
139 |
$(call filechk,gen-asm-offsets) |
22409f9c8
|
140 141 |
$(SHARED_HEADERS)/kern_constants.h: $(Q)mkdir -p $(dir $@) |
559df2e02
|
142 |
$(Q)echo '#include "../../../../include/generated/asm-offsets.h"' >$@ |
1da177e4c
|
143 |
|
ec82c32d4
|
144 |
export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH |