dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / kernel / mk / defines.mk
blob54e7f5459c62e531f0c7113cbd37fa59c8729722
2 # This is a makefile fragment that's supposed to set the following
3 # variables:
5 # KERNEL_CFLAGS - CFLAGS for kernel code
6 # KERNEL_LDFLAGS - LDFLAGS for kernel code
8 # The bit-ness (32- or 64-bit) is selected by setting BITS to 32 or 64.
10 # The following can be tweaked to change up the KERNEL_CFLAGS variables:
12 # KERNEL_CFLAGS - CFLAGS used by both 32- & 64-bit
13 # KERNEL_CFLAGS_${BITS}
14 # KERNEL_CFLAGS_${CONFIG_MACH}
15 # KERNEL_CFLAGS_${CONFIG_MACH32}
16 # KERNEL_CFLAGS_${CONFIG_MACH64}
17 # - CFLAGS used by specific builds
18 # KERNEL_INCLUDES - -Ifoo directives used by all builds
19 # KERNEL_INCLUDES_${CONFIG_MACH}
20 # - -Ifoo directives for specific build
21 # KERNEL_LDFLAGS - LDFLAGS used by both 32- & 64-bit
25 # CFLAGS
27 # TODO: -fstack-protector will fail for 'unix'
28 KERNEL_CFLAGS_ALL = \
29 -pipe \
30 -fident \
31 -finline \
32 -fno-inline-functions \
33 -fno-builtin \
34 -fno-asm \
35 -fdiagnostics-show-option \
36 -nodefaultlibs \
37 -D_ASM_INLINES \
38 -ffreestanding \
39 -std=gnu99 \
40 -g \
41 -Wall \
42 -Wextra \
43 -Werror \
44 -Wno-missing-braces \
45 -Wno-sign-compare \
46 -Wno-unknown-pragmas \
47 -Wno-unused-parameter \
48 -Wno-missing-field-initializers \
49 -fno-inline-small-functions \
50 -fno-inline-functions-called-once \
51 -fno-ipa-cp \
52 -fstack-protector \
53 -D_KERNEL \
54 -D_SYSCALL32 \
55 -D_DDI_STRICT \
56 -D__sun \
57 -nostdinc
59 # TODO: support for debug builds
60 # KERNEL_CFLAGS += -DDEBUG
62 KERNEL_CFLAGS_32 = \
63 -m32
65 KERNEL_CFLAGS_64 = \
66 -m64 \
67 -D_ELF64
69 KERNEL_CFLAGS_i386 = \
70 -mno-mmx \
71 -mno-sse
73 KERNEL_CFLAGS_i86 = \
74 -O \
75 -march=pentiumpro
77 KERNEL_CFLAGS_amd64 = \
78 -O2 \
79 -Dsun \
80 -D__SVR4 \
81 -Ui386 \
82 -U__i386 \
83 -mtune=opteron \
84 -msave-args \
85 -mcmodel=kernel \
86 -fno-strict-aliasing \
87 -fno-unit-at-a-time \
88 -fno-optimize-sibling-calls \
89 -mno-red-zone \
90 -D_SYSCALL32_IMPL
92 KERNEL_CFLAGS_sparc =
93 KERNEL_CFLAGS_sparcv7 =
94 KERNEL_CFLAGS_sparcv9 =
96 KERNEL_INCLUDES = \
97 -I${SRCTOP}/usr/src/uts/common \
98 -I${SRCTOP}/arch/${CONFIG_MACH}/include \
99 -I${SRCTOP}/include
101 KERNEL_INCLUDES_i386 = \
102 -I${SRCTOP}/usr/src/uts/intel
104 KERNEL_INCLUDES_sparc =
106 KERNEL_CFLAGS = \
107 ${KERNEL_CFLAGS_ALL} \
108 ${KERNEL_CFLAGS_${BITS}} \
109 ${KERNEL_CFLAGS_${CONFIG_MACH${BITS}}} \
110 ${KERNEL_CFLAGS_${CONFIG_MACH}} \
111 ${KERNEL_INCLUDES} \
112 ${KERNEL_INCLUDES_${CONFIG_MACH}}
115 # LDFLAGS
117 KERNEL_LDFLAGS = \
121 # Programs
123 CC=/opt/gcc/4.4.4/bin/gcc
124 LD=/usr/bin/ld
125 CTFCONVERT=/opt/onbld/bin/i386/ctfconvert
126 CTFMERGE=/opt/onbld/bin/i386/ctfmerge
129 # Verbosity
131 .if ${VERBOSE:Uno} != "yes"
132 CC := @echo " CC ($${BITS}) $${.IMPSRC}";${CC}
133 LD := @echo " LD ($${BITS}) $${.TARGET}";${LD}
134 CTFCONVERT := @${CTFCONVERT}
135 .endif