FreeBSD/Linux Kernel Cross Reference
sys/conf/kern.pre.mk
1 # $FreeBSD: src/sys/conf/kern.pre.mk,v 1.56.2.2 2005/05/04 19:26:28 vkashyap Exp $
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 !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing)
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 # ... and the same for twa
70 INCLUDES+= -I$S/dev/twa
71
72 CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG}
73 CFLAGS+= ${INCLUDES} -D_KERNEL -include opt_global.h
74 .if ${CC} != "icc"
75 CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT}
76 CFLAGS+= --param inline-unit-growth=100
77 CFLAGS+= --param large-function-growth=1000
78 WERROR?= -Werror
79 .endif
80
81 # XXX LOCORE means "don't declare C stuff" not "for locore.s".
82 ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
83
84 .if defined(PROFLEVEL) && ${PROFLEVEL} >= 1
85 .if ${CC} == "icc"
86 .error Profiling doesn't work with ICC yet.
87 .else
88 CFLAGS+= -DGPROF -falign-functions=16
89 .endif
90 .if ${PROFLEVEL} >= 2
91 CFLAGS+= -DGPROF4 -DGUPROF
92 . if ${CC} == "icc"
93 # XXX doesn't work yet
94 #PROF= -prof_gen
95 . else
96 PROF= -finstrument-functions -Wno-inline
97 . endif
98 .else
99 . if ${CC} == "icc"
100 PROF= -p
101 . else
102 PROF= -pg
103 . endif
104 .endif
105 .endif
106 DEFINED_PROF= ${PROF}
107
108 # Put configuration-specific C flags last (except for ${PROF}) so that they
109 # can override the others.
110 CFLAGS+= ${CONF_CFLAGS}
111
112 # Optional linting. This can be overridden in /etc/make.conf.
113 LINTFLAGS= ${LINTOBJKERNFLAGS}
114
115 NORMAL_C= ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.IMPSRC}
116 NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}
117 PROFILE_C= ${CC} -c ${CFLAGS} ${WERROR} ${.IMPSRC}
118 NORMAL_C_NOWERROR= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
119
120 NORMAL_M= ${AWK} -f $S/tools/makeobjops.awk ${.IMPSRC} -c ; \
121 ${CC} -c ${CFLAGS} ${WERROR} ${PROF} ${.PREFIX}.c
122
123 NORMAL_LINT= ${LINT} ${LINTFLAGS} ${CFLAGS:M-[DIU]*} ${.IMPSRC}
124
125 GEN_CFILES= $S/$M/$M/genassym.c ${MFILES:T:S/.m$/.c/}
126 SYSTEM_CFILES= config.c env.c hints.c majors.c vnode_if.c
127 SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
128 SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS}
129 SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o}
130 SYSTEM_OBJS+= hack.So
131 SYSTEM_LD= @${LD} -Bdynamic -T $S/conf/ldscript.$M \
132 -warn-common -export-dynamic -dynamic-linker /red/herring \
133 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
134 SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
135 ${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}
136 SYSTEM_DEP+= $S/conf/ldscript.$M
137
138 # MKMODULESENV is set here so that port makefiles can augment
139 # them.
140
141 MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
142 .if (${KERN_IDENT} == LINT)
143 MKMODULESENV+= ALL_MODULES=LINT
144 .endif
145 .if defined(MODULES_OVERRIDE)
146 MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
147 .endif
148 .if defined(DEBUG)
149 MKMODULESENV+= DEBUG_FLAGS="${DEBUG}"
150 .endif
Cache object: dd1c830dd582638654e36f9342c9a9dd
|