ath - Temporarily remove ath from kernel build
[dragonfly.git] / sys / conf / kern.pre.mk
CommitLineData
edbe133c
SS
1#
2# This Makefile covers the top part of the MI kernel build instructions
3#
4
5# Can be overridden by makeoptions or /etc/make.conf
6KERNEL?= kernel
7
8# build this target if none is specified on the command line
9.MAIN: all
10
a9295349
MD
11# Set the platform and machine architectures
12#
0955fd91 13P= ${MACHINE_PLATFORM}
edbe133c
SS
14M= ${MACHINE_ARCH}
15
16SIZE?= size
17OBJCOPY?= objcopy
18
19COPTFLAGS?=-O -pipe
116b7e3c
MD
20#COPTFLAGS?=-O -fthread-jumps -fcse-follow-jumps -fcrossjumping -frerun-cse-after-loop -fno-guess-branch-probability --param min-crossjump-insns=1 -pipe
21#COPTFLAGS?=-O -fcrossjumping -pipe
22#COPTFLAGS?=-Os -fno-strict-aliasing -pipe
23#COPTFLAGS?=-O2 -fno-strict-aliasing -pipe
edbe133c
SS
24.if !defined(NO_CPU_COPTFLAGS)
25COPTFLAGS+= ${_CPUCFLAGS}
26.endif
27# don't use -I- so we can use proper source-relative locality for local
a9295349
MD
28# includes.
29#
30# -I. - this is to access the opt_*.h and use_*.h header files generated
31# in the kernel build directory.
32#
33# -Iinclude
34# - this is used to access forwarding header files for
35# <machine/*.h> that exist in the cpu architecture but do not
36# exist in the platform (machine/) architecture. This allows
37# the platform to trivially override the cpu header files.
38#
39INCLUDES= -nostdinc -I. -Iinclude -I$S
edbe133c
SS
40# This hack is to allow kernel compiles to succeed on machines w/out srcdist
41.if exists($S/../include)
42INCLUDES+= -I$S/../include
43.else
44INCLUDES+= -I/usr/include
45.endif
46
47# This hack lets us use the Intel ACPICA code without spamming a new
48# include path into 100+ source files.
49.include "$S/conf/acpi.mk"
50INCLUDES+= -I${.OBJDIR} -I"$S/${OSACPI_MI_DIR}" -I"$S/${ACPICA_DIR}/include"
51
3af1e2fa
MD
52## ... and the same for Atheros HAL
53##INCLUDES+= -I$S/dev/netif/ath/ath_hal
edbe133c 54
18e26a6d
FT
55# Same thing for drm includes
56INCLUDES+= -I$S/dev/drm/include
57
edbe133c
SS
58COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h
59CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
60
61# XXX LOCORE means "don't declare C stuff" not "for locore.s".
62ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
63
64DEFINED_PROF= ${PROF}
65.if defined(PROF)
66CFLAGS+= -falign-functions=16
67.if ${PROFLEVEL} >= 2
68IDENT+= -DGPROF4 -DGUPROF
69PROF+= -mprofiler-epilogue
70.endif
71.endif
72
73# Put configuration-specific C flags last (except for ${PROF}) so that they
74# can override the others.
75CFLAGS+= ${CONF_CFLAGS}
76
77NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
78NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
79NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC}
80PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC}
81
82NORMAL_M= awk -f $S/tools/makeobjops.awk -- -c $<; \
83 ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
84
6e65b53f
SW
85NORMAL_FW= uudecode -o ${.TARGET} ${.ALLSRC}
86NORMAL_FWO= ${LD} -b binary -d -warn-common -r -o ${.TARGET} ${.ALLSRC:M*.fw}
87
6b9709a6 88.if !defined(NO_WERROR) && (${CCVER} == "gcc44" || ${CCVER} == "gcc47")
40ec0564
SW
89WERROR=-Werror
90.endif
91
0955fd91 92GEN_CFILES= $S/platform/$P/$M/genassym.c
edbe133c 93SYSTEM_CFILES= ioconf.c config.c
0955fd91 94SYSTEM_SFILES= $S/platform/$P/$M/locore.s
edbe133c
SS
95SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
96SYSTEM_OBJS= locore.o ${OBJS} ioconf.o config.o hack.So
0955fd91 97SYSTEM_LD= @${LD} -Bdynamic -T $S/platform/$P/conf/ldscript.$M \
edbe133c
SS
98 -export-dynamic -dynamic-linker /red/herring \
99 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
ed9f17e4
JM
100
101# The max-page-size for gnu ld is 0x200000 on x86_64
102# For the gold linker, it is only 0x1000 on both x86_64 and i386
103# The penalty for changing the gold default for x86_64 is larger binaries
104# and shared libraries, and forcing them to use more address space than
105# required. The only application that needs such a large page size is the
106# kernel itself, so leave the gold default alone and treat the kernel
107# page size as an exception.
108#
109.if ${P} == "pc64" || ${P} == "vkernel64"
110SYSTEM_LD+= -z max-page-size=0x200000
111.elif ${P} == "pc32" || ${P} == "vkernel"
112SYSTEM_LD+= -z max-page-size=0x1000
113.endif
114
edbe133c
SS
115SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
116 ${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}
0955fd91 117SYSTEM_DEP+= $S/platform/$P/conf/ldscript.$M
edbe133c
SS
118
119# Normalize output files to make it absolutely crystal clear to
120# anyone examining the build directory.
121#
122.if defined(DEBUG)
123FULLKERNEL= ${KERNEL}.debug
124.if defined(INSTALLSTRIPPED)
125SELECTEDKERNEL= ${KERNEL}.stripped
126.else
127SELECTEDKERNEL= ${KERNEL}.debug
128.endif
129.else
130FULLKERNEL= ${KERNEL}.nodebug
131SELECTEDKERNEL= ${KERNEL}.stripped
132.endif
133
134
135MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
136.if defined(MODULES_OVERRIDE)
137MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
138.endif
139.if defined(DEBUG)
140MKMODULESENV+= DEBUG="${DEBUG}" DEBUG_FLAGS="${DEBUG}"
141.endif
142.if defined(INSTALLSTRIPPED) || defined(INSTALLSTRIPPEDMODULES)
143MKMODULESENV+= INSTALLSTRIPPEDMODULES=1
144.endif
982b0507 145MKMODULESENV+= MACHINE_ARCH=${MACHINE_ARCH} MACHINE=${MACHINE} MACHINE_PLATFORM=${MACHINE_PLATFORM}
edbe133c 146