]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/conf/kern.pre.mk
Add ar5416RestoreChainMask() which will undo any AR5416 specific chainmask
[FreeBSD/FreeBSD.git] / sys / conf / kern.pre.mk
1 # $FreeBSD$
2
3 # Part of a unified Makefile for building kernels.  This part contains all
4 # of the definitions that need to be before %BEFORE_DEPEND.
5
6 .include <bsd.own.mk>
7
8 # backwards compat option for older systems.
9 MACHINE_CPUARCH?=${MACHINE_ARCH:C/mipse[lb]/mips/:C/armeb/arm/:C/powerpc64/powerpc/}
10
11 # Can be overridden by makeoptions or /etc/make.conf
12 KERNEL_KO?=     kernel
13 KERNEL?=        kernel
14 KODIR?=         /boot/${KERNEL}
15 LDSCRIPT_NAME?= ldscript.$M
16 LDSCRIPT?=      $S/conf/${LDSCRIPT_NAME}
17
18 M=      ${MACHINE_CPUARCH}
19
20 AWK?=           awk
21 LINT?=          lint
22 NM?=            nm
23 OBJCOPY?=       objcopy
24 SIZE?=          size
25
26 .if ${CC:T:Micc} == "icc"
27 COPTFLAGS?=     -O
28 .else
29 . if defined(DEBUG)
30 _MINUS_O=       -O
31 CTFFLAGS+=      -g
32 . else
33 _MINUS_O=       -O2
34 . endif
35 . if ${MACHINE_CPUARCH} == "amd64"
36 COPTFLAGS?=-O2 -frename-registers -pipe
37 . else
38 COPTFLAGS?=${_MINUS_O} -pipe
39 . endif
40 . if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
41 COPTFLAGS+= -fno-strict-aliasing
42 . endif
43 .endif
44 .if !defined(NO_CPU_COPTFLAGS)
45 . if ${CC:T:Micc} == "icc"
46 COPTFLAGS+= ${_ICC_CPUCFLAGS:C/(-x[^M^K^W]+)[MKW]+|-x[MKW]+/\1/}
47 . else
48 COPTFLAGS+= ${_CPUCFLAGS}
49 . endif
50 .endif
51 .if ${CC:T:Micc} == "icc"
52 C_DIALECT=
53 NOSTDINC= -X
54 .else
55 C_DIALECT= -std=c99
56 NOSTDINC= -nostdinc
57 .endif
58
59 INCLUDES= ${NOSTDINC} ${INCLMAGIC} -I. -I$S
60
61 # This hack lets us use the OpenBSD altq code without spamming a new
62 # include path into contrib'ed source files.
63 INCLUDES+= -I$S/contrib/altq
64
65 .if make(depend) || make(kernel-depend)
66
67 # ... and the same for ipfilter
68 INCLUDES+= -I$S/contrib/ipfilter
69
70 # ... and the same for pf
71 INCLUDES+= -I$S/contrib/pf
72
73 # ... and the same for ath
74 INCLUDES+= -I$S/dev/ath -I$S/dev/ath/ath_hal
75
76 # ... and the same for the NgATM stuff
77 INCLUDES+= -I$S/contrib/ngatm
78
79 # .. and the same for twa
80 INCLUDES+= -I$S/dev/twa
81
82 # ...  and XFS
83 INCLUDES+= -I$S/gnu/fs/xfs/FreeBSD -I$S/gnu/fs/xfs/FreeBSD/support -I$S/gnu/fs/xfs
84
85 # ...  and OpenSolaris
86 INCLUDES+= -I$S/contrib/opensolaris/compat
87
88 # ... and the same for cxgb
89 INCLUDES+= -I$S/dev/cxgb
90
91 .endif
92
93 CFLAGS= ${COPTFLAGS} ${C_DIALECT} ${DEBUG} ${CWARNFLAGS}
94 CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
95 .if ${CC:T:Micc} != "icc"
96 .if ${CC:T:Mclang} != "clang"
97 CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT}
98 .if ${MACHINE_CPUARCH} != "mips"
99 CFLAGS+= --param inline-unit-growth=100
100 CFLAGS+= --param large-function-growth=1000
101 .else
102 # XXX Actually a gross hack just for Octeon because of the Simple Executive.
103 CFLAGS+= --param inline-unit-growth=10000
104 CFLAGS+= --param large-function-growth=100000
105 CFLAGS+= --param max-inline-insns-single=10000
106 .endif
107 .endif
108 WERROR?= -Werror
109 .endif
110
111 # XXX LOCORE means "don't declare C stuff" not "for locore.s".
112 ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
113
114 .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
115 .if ${CC:T:Micc} == "icc" || ${CC:T:Mclang} == "clang"
116 .error "Profiling doesn't work with icc or clang yet"
117 .endif
118 CFLAGS+=        -DGPROF -falign-functions=16
119 .if ${PROFLEVEL} >= 2
120 CFLAGS+=        -DGPROF4 -DGUPROF
121 PROF=   -pg -mprofiler-epilogue
122 .else
123 PROF=   -pg
124 .endif
125 .endif
126 DEFINED_PROF=   ${PROF}
127
128 # Put configuration-specific C flags last (except for ${PROF}) so that they
129 # can override the others.
130 CFLAGS+=        ${CONF_CFLAGS}
131
132 # Optional linting. This can be overridden in /etc/make.conf.
133 LINTFLAGS=      ${LINTOBJKERNFLAGS}
134
135 NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
136 NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
137 PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC}
138 NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
139
140 NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \
141           ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c
142
143 NORMAL_CTFCONVERT= [ -z "${CTFCONVERT}" -o -n "${NO_CTF}" ] || \
144                    ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
145
146 NORMAL_LINT=    ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC}
147
148 GEN_CFILES= $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/}
149 SYSTEM_CFILES= config.c env.c hints.c vnode_if.c
150 SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
151 SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS}
152 SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o}
153 SYSTEM_OBJS+= hack.So
154 SYSTEM_CTFMERGE= [ -z "${CTFMERGE}" -o -n "${NO_CTF}" ] || ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SYSTEM_OBJS} vers.o
155 SYSTEM_LD= @${LD} -Bdynamic -T ${LDSCRIPT} \
156         -warn-common -export-dynamic -dynamic-linker /red/herring \
157         -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
158 SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
159         ${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}
160 SYSTEM_DEP+= ${LDSCRIPT}
161
162 # MKMODULESENV is set here so that port makefiles can augment
163 # them.
164
165 MKMODULESENV=   MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
166 MKMODULESENV+=  MACHINE_CPUARCH=${MACHINE_CPUARCH}
167 .if (${KERN_IDENT} == LINT)
168 MKMODULESENV+=  ALL_MODULES=LINT
169 .endif
170 .if defined(MODULES_OVERRIDE)
171 MKMODULESENV+=  MODULES_OVERRIDE="${MODULES_OVERRIDE}"
172 .endif
173 .if defined(WITHOUT_MODULES)
174 MKMODULESENV+=  WITHOUT_MODULES="${WITHOUT_MODULES}"
175 .endif
176 .if defined(DEBUG)
177 MKMODULESENV+=  DEBUG_FLAGS="${DEBUG}"
178 .endif