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