1 # $DragonFly: src/sys/conf/kern.pre.mk,v 1.8 2008/11/17 11:55:19 swildner Exp $
3 # This Makefile covers the top part of the MI kernel build instructions
6 # Can be overridden by makeoptions or /etc/make.conf
9 # build this target if none is specified on the command line
12 # Set the platform and machine architectures
14 P
= ${MACHINE_PLATFORM}
21 .if
!defined
(NO_CPU_COPTFLAGS
)
22 COPTFLAGS
+= ${_CPUCFLAGS}
24 # don't use -I- so we can use proper source-relative locality for local
27 # -I. - this is to access the opt_*.h and use_*.h header files generated
28 # in the kernel build directory.
31 # - this is used to access forwarding header files for
32 # <machine/*.h> that exist in the cpu architecture but do not
33 # exist in the platform (machine/) architecture. This allows
34 # the platform to trivially override the cpu header files.
36 INCLUDES
= -nostdinc
-I.
-Iinclude
-I
$S
37 # This hack is to allow kernel compiles to succeed on machines w/out srcdist
38 .if exists
($S/..
/include)
39 INCLUDES
+= -I
$S/..
/include
41 INCLUDES
+= -I
/usr
/include
44 # This hack lets us use the Intel ACPICA code without spamming a new
45 # include path into 100+ source files.
46 .
include "$S/conf/acpi.mk"
47 INCLUDES
+= -I
${.OBJDIR
} -I
"$S/${OSACPI_MI_DIR}" -I
"$S/${ACPICA_DIR}/include"
49 # This hack lets us use the ipfilter code without spamming a new
50 # include path into 100+ source files.
51 INCLUDES
+= -I
$S/contrib
/ipfilter
53 # ... and the same for Atheros HAL
54 INCLUDES
+= -I
$S/dev
/netif
/ath
/hal
-I
$S/dev
/netif
/ath
/hal
/ath_hal
56 COPTS
= ${INCLUDES} ${IDENT} -D_KERNEL
-include opt_global.h
57 CFLAGS
= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
59 # XXX LOCORE means "don't declare C stuff" not "for locore.s".
60 ASM_CFLAGS
= -x assembler-with-cpp
-DLOCORE
${CFLAGS}
64 CFLAGS
+= -falign-functions
=16
66 IDENT
+= -DGPROF4
-DGUPROF
67 PROF
+= -mprofiler-epilogue
71 # Put configuration-specific C flags last (except for ${PROF}) so that they
72 # can override the others.
73 CFLAGS
+= ${CONF_CFLAGS}
75 NORMAL_C
= ${CC} -c
${CFLAGS} ${PROF} ${.IMPSRC
}
76 NORMAL_C_C
= ${CC} -c
${CFLAGS} ${PROF} ${.IMPSRC
}
77 NORMAL_S
= ${CC} -c
${ASM_CFLAGS} ${.IMPSRC
}
78 PROFILE_C
= ${CC} -c
${CFLAGS} ${.IMPSRC
}
80 NORMAL_M
= awk
-f
$S/tools
/makeobjops.awk
-- -c
$<; \
81 ${CC} -c
${CFLAGS} ${PROF} ${.PREFIX
}.c
83 .if
!defined
(NO_WERROR
) && ${CCVER} == "gcc41"
87 GEN_CFILES
= $S/platform
/$P/$M/genassym.c
88 SYSTEM_CFILES
= ioconf.c config.c
89 SYSTEM_SFILES
= $S/platform
/$P/$M/locore.s
90 SYSTEM_DEP
= Makefile
${SYSTEM_OBJS}
91 SYSTEM_OBJS
= locore.o
${OBJS} ioconf.o config.o hack.So
92 SYSTEM_LD
= @
${LD} -Bdynamic
-T
$S/platform
/$P/conf
/ldscript.
$M \
93 -export-dynamic
-dynamic-linker
/red
/herring \
94 -o
${.TARGET
} -X
${SYSTEM_OBJS} vers.o
95 SYSTEM_LD_TAIL
= @
${OBJCOPY} --strip-symbol gcc2_compiled.
${.TARGET
} ; \
96 ${SIZE} ${.TARGET
} ; chmod
755 ${.TARGET
}
97 SYSTEM_DEP
+= $S/platform
/$P/conf
/ldscript.
$M
99 # Normalize output files to make it absolutely crystal clear to
100 # anyone examining the build directory.
103 FULLKERNEL
= ${KERNEL}.debug
104 .if defined
(INSTALLSTRIPPED
)
105 SELECTEDKERNEL
= ${KERNEL}.stripped
107 SELECTEDKERNEL
= ${KERNEL}.debug
110 FULLKERNEL
= ${KERNEL}.nodebug
111 SELECTEDKERNEL
= ${KERNEL}.stripped
115 MKMODULESENV
= MAKEOBJDIRPREFIX
=${.OBJDIR
} BUILDING_WITH_KERNEL
=${.OBJDIR
}
116 .if defined
(MODULES_OVERRIDE
)
117 MKMODULESENV
+= MODULES_OVERRIDE
="${MODULES_OVERRIDE}"
120 MKMODULESENV
+= DEBUG
="${DEBUG}" DEBUG_FLAGS
="${DEBUG}"
122 .if defined
(INSTALLSTRIPPED
) || defined
(INSTALLSTRIPPEDMODULES
)
123 MKMODULESENV
+= INSTALLSTRIPPEDMODULES
=1
125 MKMODULESENV
+= MACHINE_ARCH
=${MACHINE_ARCH} MACHINE
=${MACHINE} MACHINE_PLATFORM
=${MACHINE_PLATFORM}