arcmsr(4): Use MSI if it is supported by the device.
[dragonfly.git] / sys / conf / kern.pre.mk
blobd944533904eb6313780d0435b74ecf73a1a5c35a
2 # This Makefile covers the top part of the MI kernel build instructions
5 # Can be overridden by makeoptions or /etc/make.conf
6 KERNEL?= kernel
8 # build this target if none is specified on the command line
9 .MAIN: all
11 # Set the platform and machine architectures
13 P= ${MACHINE_PLATFORM}
14 M= ${MACHINE_ARCH}
16 SIZE?= size
17 OBJCOPY?= objcopy
19 COPTFLAGS?=-O -pipe
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
24 .if !defined(NO_CPU_COPTFLAGS)
25 COPTFLAGS+= ${_CPUCFLAGS}
26 .endif
27 # don't use -I- so we can use proper source-relative locality for local
28 # includes.
30 # -I. - this is to access the opt_*.h and use_*.h header files generated
31 # in the kernel build directory.
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.
39 INCLUDES= -nostdinc -I. -Iinclude -I$S
40 # This hack is to allow kernel compiles to succeed on machines w/out srcdist
41 .if exists($S/../include)
42 INCLUDES+= -I$S/../include
43 .else
44 INCLUDES+= -I/usr/include
45 .endif
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"
50 INCLUDES+= -I${.OBJDIR} -I"$S/${OSACPI_MI_DIR}" -I"$S/${ACPICA_DIR}/include"
52 # ... and the same for Atheros HAL
53 INCLUDES+= -I$S/dev/netif/ath/hal -I$S/dev/netif/ath/hal/ath_hal
55 COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h
56 CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
58 # XXX LOCORE means "don't declare C stuff" not "for locore.s".
59 ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
61 DEFINED_PROF= ${PROF}
62 .if defined(PROF)
63 CFLAGS+= -falign-functions=16
64 .if ${PROFLEVEL} >= 2
65 IDENT+= -DGPROF4 -DGUPROF
66 PROF+= -mprofiler-epilogue
67 .endif
68 .endif
70 # Put configuration-specific C flags last (except for ${PROF}) so that they
71 # can override the others.
72 CFLAGS+= ${CONF_CFLAGS}
74 NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
75 NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
76 NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC}
77 PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC}
79 NORMAL_M= awk -f $S/tools/makeobjops.awk -- -c $<; \
80 ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
82 .if !defined(NO_WERROR) && (${CCVER} == "gcc41" || ${CCVER} == "gcc44")
83 WERROR=-Werror
84 .endif
86 GEN_CFILES= $S/platform/$P/$M/genassym.c
87 SYSTEM_CFILES= ioconf.c config.c
88 SYSTEM_SFILES= $S/platform/$P/$M/locore.s
89 SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
90 SYSTEM_OBJS= locore.o ${OBJS} ioconf.o config.o hack.So
91 SYSTEM_LD= @${LD} -Bdynamic -T $S/platform/$P/conf/ldscript.$M \
92 -export-dynamic -dynamic-linker /red/herring \
93 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
95 # The max-page-size for gnu ld is 0x200000 on x86_64
96 # For the gold linker, it is only 0x1000 on both x86_64 and i386
97 # The penalty for changing the gold default for x86_64 is larger binaries
98 # and shared libraries, and forcing them to use more address space than
99 # required. The only application that needs such a large page size is the
100 # kernel itself, so leave the gold default alone and treat the kernel
101 # page size as an exception.
103 .if ${P} == "pc64" || ${P} == "vkernel64"
104 SYSTEM_LD+= -z max-page-size=0x200000
105 .elif ${P} == "pc32" || ${P} == "vkernel"
106 SYSTEM_LD+= -z max-page-size=0x1000
107 .endif
109 SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
110 ${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}
111 SYSTEM_DEP+= $S/platform/$P/conf/ldscript.$M
113 # Normalize output files to make it absolutely crystal clear to
114 # anyone examining the build directory.
116 .if defined(DEBUG)
117 FULLKERNEL= ${KERNEL}.debug
118 .if defined(INSTALLSTRIPPED)
119 SELECTEDKERNEL= ${KERNEL}.stripped
120 .else
121 SELECTEDKERNEL= ${KERNEL}.debug
122 .endif
123 .else
124 FULLKERNEL= ${KERNEL}.nodebug
125 SELECTEDKERNEL= ${KERNEL}.stripped
126 .endif
129 MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
130 .if defined(MODULES_OVERRIDE)
131 MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
132 .endif
133 .if defined(DEBUG)
134 MKMODULESENV+= DEBUG="${DEBUG}" DEBUG_FLAGS="${DEBUG}"
135 .endif
136 .if defined(INSTALLSTRIPPED) || defined(INSTALLSTRIPPEDMODULES)
137 MKMODULESENV+= INSTALLSTRIPPEDMODULES=1
138 .endif
139 MKMODULESENV+= MACHINE_ARCH=${MACHINE_ARCH} MACHINE=${MACHINE} MACHINE_PLATFORM=${MACHINE_PLATFORM}