HAMMER Utilities: Add an 'everything' directive to the prune command. This
[dragonfly.git] / sys / conf / kern.pre.mk
blob5d0820c550af4f83a3896a9730d556f302a319fd
1 # $DragonFly: src/sys/conf/kern.pre.mk,v 1.5 2007/02/22 21:02:49 corecode Exp $
3 # This Makefile covers the top part of the MI kernel build instructions
6 # Can be overridden by makeoptions or /etc/make.conf
7 KERNEL?= kernel
9 # build this target if none is specified on the command line
10 .MAIN: all
12 # Set the platform and machine architectures
14 P= ${MACHINE_PLATFORM}
15 M= ${MACHINE_ARCH}
17 SIZE?= size
18 OBJCOPY?= objcopy
20 COPTFLAGS?=-O -pipe
21 .if !defined(NO_CPU_COPTFLAGS)
22 COPTFLAGS+= ${_CPUCFLAGS}
23 .endif
24 # don't use -I- so we can use proper source-relative locality for local
25 # includes.
27 # -I. - this is to access the opt_*.h and use_*.h header files generated
28 # in the kernel build directory.
30 # -Iinclude
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
40 .else
41 INCLUDES+= -I/usr/include
42 .endif
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 COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h
54 CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
56 # XXX LOCORE means "don't declare C stuff" not "for locore.s".
57 ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
59 DEFINED_PROF= ${PROF}
60 .if defined(PROF)
61 CFLAGS+= -falign-functions=16
62 .if ${PROFLEVEL} >= 2
63 IDENT+= -DGPROF4 -DGUPROF
64 PROF+= -mprofiler-epilogue
65 .endif
66 .endif
68 # Put configuration-specific C flags last (except for ${PROF}) so that they
69 # can override the others.
70 CFLAGS+= ${CONF_CFLAGS}
72 NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
73 NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
74 NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC}
75 PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC}
77 NORMAL_M= awk -f $S/tools/makeobjops.awk -- -c $<; \
78 ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
80 GEN_CFILES= $S/platform/$P/$M/genassym.c
81 SYSTEM_CFILES= ioconf.c config.c
82 SYSTEM_SFILES= $S/platform/$P/$M/locore.s
83 SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
84 SYSTEM_OBJS= locore.o ${OBJS} ioconf.o config.o hack.So
85 SYSTEM_LD= @${LD} -Bdynamic -T $S/platform/$P/conf/ldscript.$M \
86 -export-dynamic -dynamic-linker /red/herring \
87 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
88 SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
89 ${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}
90 SYSTEM_DEP+= $S/platform/$P/conf/ldscript.$M
92 # Normalize output files to make it absolutely crystal clear to
93 # anyone examining the build directory.
95 .if defined(DEBUG)
96 FULLKERNEL= ${KERNEL}.debug
97 .if defined(INSTALLSTRIPPED)
98 SELECTEDKERNEL= ${KERNEL}.stripped
99 .else
100 SELECTEDKERNEL= ${KERNEL}.debug
101 .endif
102 .else
103 FULLKERNEL= ${KERNEL}.nodebug
104 SELECTEDKERNEL= ${KERNEL}.stripped
105 .endif
106 DESTKERNNAME?= ${KERNEL}
109 MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR} BUILDING_WITH_KERNEL=${.OBJDIR}
110 .if defined(MODULES_OVERRIDE)
111 MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
112 .endif
113 .if defined(DEBUG)
114 MKMODULESENV+= DEBUG="${DEBUG}" DEBUG_FLAGS="${DEBUG}"
115 .endif
116 .if defined(INSTALLSTRIPPED) || defined(INSTALLSTRIPPEDMODULES)
117 MKMODULESENV+= INSTALLSTRIPPEDMODULES=1
118 .endif