]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/conf/kern.pre.mk
This commit was generated by cvs2svn to compensate for changes in r87866,
[FreeBSD/FreeBSD.git] / sys / conf / kern.pre.mk
1 # kern.pre.mk
2 #
3 # Unified Makefile for building kenrels.  This includes all the definitions
4 # that need to be included before %BEFORE_DEPEND
5 #
6 # $FreeBSD$
7 #
8
9 # Can be overridden by makeoptions or /etc/make.conf
10 KERNEL_KO?=     kernel
11 KERNEL?=        kernel
12 KODIR?=         /boot/${KERNEL}
13
14 M=      ${MACHINE_ARCH}
15
16 NM?=            nm
17 OBJCOPY?=       objcopy
18 SIZE?=          size
19
20 COPTFLAGS?=-O -pipe
21 .if !defined(NO_CPU_COPTFLAGS)
22 COPTFLAGS+= ${_CPUCFLAGS}
23 .endif
24 INCLUDES= -nostdinc -I- ${INCLMAGIC} -I. -I$S -I$S/dev
25
26 # This hack lets us use the Intel ACPICA code without spamming a new 
27 # include path into 100+ source files.
28 INCLUDES+= -I$S/contrib/dev/acpica
29
30 # ... and the same for ipfilter
31 INCLUDES+= -I$S/contrib/ipfilter
32
33 # This hack is to allow kernel compiles to succeed on machines w/out srcdist
34 .if exists($S/../include)
35 INCLUDES+= -I$S/../include
36 .else
37 INCLUDES+= -I/usr/include
38 .endif
39
40 COPTS=  ${INCLUDES} ${IDENT} -D_KERNEL -ffreestanding -include opt_global.h
41 CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
42
43 # XXX LOCORE means "don't declare C stuff" not "for locore.s".
44 ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
45
46 # Select the correct set of tools. Can't set OBJFORMAT here because it
47 # doesn't get exported into the environment, and if it were exported
48 # then it might break building of utilities.
49 FMT?=           -elf
50 CFLAGS+=        ${FMT}
51
52 DEFINED_PROF=   ${PROF}
53 .if defined(PROF)
54 CFLAGS+=        -malign-functions=4
55 .if ${PROFLEVEL} >= 2
56 IDENT+= -DGPROF4 -DGUPROF
57 PROF+=  -mprofiler-epilogue
58 .endif
59 .endif
60
61 # Put configuration-specific C flags last (except for ${PROF}) so that they
62 # can override the others.
63 CFLAGS+=        ${CONF_CFLAGS}
64
65 NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
66 NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
67 NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC}
68 PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC}
69
70 NORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \
71           ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
72
73 GEN_CFILES= $S/$M/$M/genassym.c
74 SYSTEM_CFILES= vnode_if.c hints.c env.c config.c
75 SYSTEM_SFILES= $S/$M/$M/locore.s
76 SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
77 SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So
78 SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
79         -export-dynamic -dynamic-linker /red/herring \
80         -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
81 SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
82         ${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET}
83 SYSTEM_DEP+= $S/conf/ldscript.$M
84
85 all:    ${KERNEL_KO}