58 |
__build: |
__build: |
59 |
|
|
60 |
# Read .config if it exist, otherwise ignore |
# Read .config if it exist, otherwise ignore |
61 |
-include .config |
-include $(objtree)/.config |
62 |
|
|
63 |
# Generic Kbuild routines |
# Generic Kbuild routines |
64 |
include $(srctree)/scripts/Kbuild.include |
include $(srctree)/scripts/Kbuild.include |
66 |
# Defines used when compiling early userspace (klibc programs) |
# Defines used when compiling early userspace (klibc programs) |
67 |
# --------------------------------------------------------------------------- |
# --------------------------------------------------------------------------- |
68 |
|
|
69 |
KLIBCREQFLAGS := $(call cc-option, -fno-stack-protector, ) |
KLIBCREQFLAGS := $(call cc-option, -fno-stack-protector, ) \ |
70 |
|
$(call cc-option, -fwrapv, ) |
71 |
KLIBCARCHREQFLAGS := |
KLIBCARCHREQFLAGS := |
72 |
KLIBCOPTFLAGS := |
KLIBCOPTFLAGS := |
73 |
KLIBCWARNFLAGS := -W -Wall -Wno-sign-compare -Wno-unused-parameter |
KLIBCWARNFLAGS := -W -Wall -Wno-sign-compare -Wno-unused-parameter |
76 |
KLIBCLDFLAGS := |
KLIBCLDFLAGS := |
77 |
KLIBCCFLAGS := |
KLIBCCFLAGS := |
78 |
|
|
79 |
|
# Defaults for arch to override |
80 |
|
KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include |
81 |
|
|
82 |
# Arch specific definitions for klibc |
# Arch specific definitions for klibc |
83 |
include $(KLIBCSRC)/arch/$(KLIBCARCHDIR)/MCONFIG |
include $(srctree)/$(KLIBCSRC)/arch/$(KLIBCARCHDIR)/MCONFIG |
84 |
|
|
85 |
# include/asm-* architecture |
# include/asm-* architecture |
86 |
KLIBCASMARCH ?= $(KLIBCARCH) |
KLIBCASMARCH ?= $(KLIBCARCH) |
106 |
-I$(KLIBCOBJ)/../include \ |
-I$(KLIBCOBJ)/../include \ |
107 |
-I$(KLIBCINC) |
-I$(KLIBCINC) |
108 |
# kernel include paths |
# kernel include paths |
109 |
KLIBCKERNELSRC ?= $(srctree)/ |
KLIBCKERNELSRC ?= $(srctree) |
110 |
KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)include -I$(KLIBCKERNELSRC)arch/x86/include \ |
KLIBCKERNELOBJ ?= $(objtree) |
111 |
$(if $(KBUILD_SRC),-I$(KLIBCKERNELOBJ)include2 -I$(KLIBCKERNELOBJ)include -I$(srctree)/include) \ |
KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)/include \ |
112 |
|
$(if $(KBUILD_SRC),-I$(KLIBCKERNELOBJ)/include2 \ |
113 |
|
-I$(KLIBCKERNELOBJ)/include -I$(srctree)/include) \ |
114 |
$(KLIBCARCHINCFLAGS) |
$(KLIBCARCHINCFLAGS) |
115 |
|
|
116 |
# klibc definitions |
# klibc definitions |
143 |
export KLIBCCFLAGS KLIBCAFLAGS KLIBCLIBGCC KLIBCSHAREDFLAGS KLIBCSTRIPFLAGS |
export KLIBCCFLAGS KLIBCAFLAGS KLIBCLIBGCC KLIBCSHAREDFLAGS KLIBCSTRIPFLAGS |
144 |
export KLIBCCRT0 KLIBCLIBC SHLIBDIR |
export KLIBCCRT0 KLIBCLIBC SHLIBDIR |
145 |
|
|
|
# kernel configuration |
|
|
include .config |
|
|
|
|
146 |
# Add $(obj)/ for paths that is not absolute |
# Add $(obj)/ for paths that is not absolute |
147 |
objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) |
objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) |
148 |
|
|
149 |
# Kbuild file in the directory that is being build |
# Kbuild file in the directory that is being build |
150 |
include $(obj)/Kbuild |
include $(srctree)/$(obj)/Kbuild |
151 |
|
|
152 |
##### |
##### |
153 |
# static-y + shared-y handling |
# static-y + shared-y handling |
206 |
__klibccflags = $(KLIBCCFLAGS) $(EXTRA_KLIBCCFLAGS) $(KLIBCCFLAGS_$(*F).o) |
__klibccflags = $(KLIBCCFLAGS) $(EXTRA_KLIBCCFLAGS) $(KLIBCCFLAGS_$(*F).o) |
207 |
__klibcaflags = $(KLIBCAFLAGS) $(EXTRA_KLIBCAFLAGS) $(KLIBCAFLAGS_$(*F).o) |
__klibcaflags = $(KLIBCAFLAGS) $(EXTRA_KLIBCAFLAGS) $(KLIBCAFLAGS_$(*F).o) |
208 |
|
|
|
ifeq ($(KBUILD_SRC),) |
|
|
_klibccflags = $(__klibccflags) |
|
|
_klibcaflags = $(__klibcaflags) |
|
|
else |
|
209 |
_klibccflags = $(call flags,__klibccflags) |
_klibccflags = $(call flags,__klibccflags) |
210 |
_klibcaflags = $(call flags,__klibcaflags) |
_klibcaflags = $(call flags,__klibcaflags) |
|
endif |
|
211 |
|
|
212 |
klibccflags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(_klibccflags) |
klibccflags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(_klibccflags) |
213 |
klibcaflags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(_klibcaflags) |
klibcaflags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(_klibcaflags) |
413 |
# Shorthand for $(Q)$(MAKE) -f scripts/Kbuild.klibc obj |
# Shorthand for $(Q)$(MAKE) -f scripts/Kbuild.klibc obj |
414 |
# Usage: |
# Usage: |
415 |
# $(Q)$(MAKE) $(klibc)=dir |
# $(Q)$(MAKE) $(klibc)=dir |
416 |
klibc := -rR -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Kbuild.klibc obj |
klibc := -rR -f $(srctree)/scripts/Kbuild.klibc obj |