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