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