| @@ -1,278 +1,277 @@ | | | @@ -1,278 +1,277 @@ |
1 | # $NetBSD: bsd.sys.mk,v 1.231 2013/12/16 21:34:16 matt Exp $ | | 1 | # $NetBSD: bsd.sys.mk,v 1.232 2014/01/07 02:16:41 joerg Exp $ |
2 | # | | 2 | # |
3 | # Build definitions used for NetBSD source tree builds. | | 3 | # Build definitions used for NetBSD source tree builds. |
4 | | | 4 | |
5 | .if !defined(_BSD_SYS_MK_) | | 5 | .if !defined(_BSD_SYS_MK_) |
6 | _BSD_SYS_MK_=1 | | 6 | _BSD_SYS_MK_=1 |
7 | | | 7 | |
8 | .if ${MKREPRO:Uno} == "yes" | | 8 | .if ${MKREPRO:Uno} == "yes" |
9 | CPPFLAGS+= -Wp,-iremap,${NETBSDSRCDIR}:/usr/src | | 9 | CPPFLAGS+= -Wp,-iremap,${NETBSDSRCDIR}:/usr/src |
10 | CPPFLAGS+= -Wp,-iremap,${DESTDIR}/:/ | | 10 | CPPFLAGS+= -Wp,-iremap,${DESTDIR}/:/ |
11 | CPPFLAGS+= -Wp,-iremap,${X11SRCDIR}:/usr/xsrc | | 11 | CPPFLAGS+= -Wp,-iremap,${X11SRCDIR}:/usr/xsrc |
12 | .endif | | 12 | .endif |
13 | | | 13 | |
14 | # Enable c99 mode by default. | | 14 | # Enable c99 mode by default. |
15 | # This has the side effect of complaining for missing prototypes | | 15 | # This has the side effect of complaining for missing prototypes |
16 | # implicit type declarations and missing return statements. | | 16 | # implicit type declarations and missing return statements. |
17 | .if defined(HAVE_GCC) || defined(HAVE_LLVM) | | 17 | .if defined(HAVE_GCC) || defined(HAVE_LLVM) |
18 | CFLAGS+= -std=gnu99 | | 18 | CFLAGS+= -std=gnu99 |
19 | .endif | | 19 | .endif |
20 | | | 20 | |
21 | .if defined(WARNS) | | 21 | .if defined(WARNS) |
22 | CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wno-sign-compare -Wno-pointer-sign :} | | 22 | CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wno-sign-compare -Wno-pointer-sign :} |
23 | .if ${WARNS} > 0 | | 23 | .if ${WARNS} > 0 |
24 | CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith | | 24 | CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith |
25 | #CFLAGS+= -Wmissing-declarations -Wredundant-decls -Wnested-externs | | 25 | #CFLAGS+= -Wmissing-declarations -Wredundant-decls -Wnested-externs |
26 | # Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3, | | 26 | # Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3, |
27 | # but our sources aren't up for it yet. Also, add -Wno-traditional because | | 27 | # but our sources aren't up for it yet. Also, add -Wno-traditional because |
28 | # gcc includes #elif in the warnings, which is 'this code will not compile | | 28 | # gcc includes #elif in the warnings, which is 'this code will not compile |
29 | # in a traditional environment' warning, as opposed to 'this code behaves | | 29 | # in a traditional environment' warning, as opposed to 'this code behaves |
30 | # differently in traditional and ansi environments' which is the warning | | 30 | # differently in traditional and ansi environments' which is the warning |
31 | # we wanted, and now we don't get anymore. | | 31 | # we wanted, and now we don't get anymore. |
32 | CFLAGS+= -Wno-sign-compare | | 32 | CFLAGS+= -Wno-sign-compare |
33 | CFLAGS+= ${${ACTIVE_CC} != "clang":? -Wno-traditional :} | | 33 | CFLAGS+= ${${ACTIVE_CC} != "clang":? -Wno-traditional :} |
34 | .if !defined(NOGCCERROR) | | 34 | .if !defined(NOGCCERROR) |
35 | # Set assembler warnings to be fatal | | 35 | # Set assembler warnings to be fatal |
36 | CFLAGS+= -Wa,--fatal-warnings | | 36 | CFLAGS+= -Wa,--fatal-warnings |
37 | .endif | | 37 | .endif |
38 | # Set linker warnings to be fatal | | 38 | # Set linker warnings to be fatal |
39 | # XXX no proper way to avoid "FOO is a patented algorithm" warnings | | 39 | # XXX no proper way to avoid "FOO is a patented algorithm" warnings |
40 | # XXX on linking static libs | | 40 | # XXX on linking static libs |
41 | .if (!defined(MKPIC) || ${MKPIC} != "no") && \ | | 41 | .if (!defined(MKPIC) || ${MKPIC} != "no") && \ |
42 | (!defined(LDSTATIC) || ${LDSTATIC} != "-static") | | 42 | (!defined(LDSTATIC) || ${LDSTATIC} != "-static") |
43 | # XXX there are some strange problems not yet resolved | | 43 | # XXX there are some strange problems not yet resolved |
44 | . if !defined(HAVE_GCC) || defined(HAVE_LLVM) | | 44 | . if !defined(HAVE_GCC) || defined(HAVE_LLVM) |
45 | LDFLAGS+= -Wl,--fatal-warnings | | 45 | LDFLAGS+= -Wl,--fatal-warnings |
46 | . endif | | 46 | . endif |
47 | .endif | | 47 | .endif |
48 | .endif | | 48 | .endif |
49 | .if ${WARNS} > 1 | | 49 | .if ${WARNS} > 1 |
50 | CFLAGS+= -Wreturn-type -Wswitch -Wshadow | | 50 | CFLAGS+= -Wreturn-type -Wswitch -Wshadow |
51 | .endif | | 51 | .endif |
52 | .if ${WARNS} > 2 | | 52 | .if ${WARNS} > 2 |
53 | CFLAGS+= -Wcast-qual -Wwrite-strings | | 53 | CFLAGS+= -Wcast-qual -Wwrite-strings |
54 | CFLAGS+= -Wextra -Wno-unused-parameter | | 54 | CFLAGS+= -Wextra -Wno-unused-parameter |
55 | # Readd -Wno-sign-compare to override -Wextra with clang | | 55 | # Readd -Wno-sign-compare to override -Wextra with clang |
56 | CFLAGS+= -Wno-sign-compare | | 56 | CFLAGS+= -Wno-sign-compare |
57 | CXXFLAGS+= -Wabi | | 57 | CXXFLAGS+= -Wabi |
58 | CXXFLAGS+= -Wold-style-cast | | 58 | CXXFLAGS+= -Wold-style-cast |
59 | CXXFLAGS+= -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \ | | 59 | CXXFLAGS+= -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder \ |
60 | -Wno-deprecated -Woverloaded-virtual -Wsign-promo -Wsynth | | 60 | -Wno-deprecated -Woverloaded-virtual -Wsign-promo -Wsynth |
61 | CXXFLAGS+= ${${ACTIVE_CXX} == "gcc":? -Wno-non-template-friend -Wno-pmf-conversions :} | | 61 | CXXFLAGS+= ${${ACTIVE_CXX} == "gcc":? -Wno-non-template-friend -Wno-pmf-conversions :} |
62 | .endif | | 62 | .endif |
63 | .if ${WARNS} > 3 && (defined(HAVE_GCC) || defined(HAVE_LLVM)) | | 63 | .if ${WARNS} > 3 && (defined(HAVE_GCC) || defined(HAVE_LLVM)) |
64 | .if ${WARNS} > 4 | | 64 | .if ${WARNS} > 4 |
65 | CFLAGS+= -Wold-style-definition | | 65 | CFLAGS+= -Wold-style-definition |
66 | .endif | | 66 | .endif |
67 | .if ${WARNS} > 5 && !(defined(HAVE_GCC) && ${HAVE_GCC} <= 45) | | 67 | .if ${WARNS} > 5 && !(defined(HAVE_GCC) && ${HAVE_GCC} <= 45) |
68 | CFLAGS+= -Wconversion | | 68 | CFLAGS+= -Wconversion |
69 | .endif | | 69 | .endif |
70 | CFLAGS+= -Wsign-compare -Wformat=2 | | 70 | CFLAGS+= -Wsign-compare -Wformat=2 |
71 | CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wno-error=format-nonliteral :} | | | |
72 | CFLAGS+= ${${ACTIVE_CC} == "gcc":? -Wno-format-zero-length :} | | 71 | CFLAGS+= ${${ACTIVE_CC} == "gcc":? -Wno-format-zero-length :} |
73 | .endif | | 72 | .endif |
74 | .if ${WARNS} > 3 && defined(HAVE_LLVM) | | 73 | .if ${WARNS} > 3 && defined(HAVE_LLVM) |
75 | CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wpointer-sign -Wmissing-noreturn :} | | 74 | CFLAGS+= ${${ACTIVE_CC} == "clang":? -Wpointer-sign -Wmissing-noreturn :} |
76 | .endif | | 75 | .endif |
77 | .if (defined(HAVE_GCC) && ${HAVE_GCC} >= 45 \ | | 76 | .if (defined(HAVE_GCC) && ${HAVE_GCC} >= 45 \ |
78 | && (${MACHINE_ARCH} == "coldfire" || \ | | 77 | && (${MACHINE_ARCH} == "coldfire" || \ |
79 | ${MACHINE_ARCH} == "sh3eb" || \ | | 78 | ${MACHINE_ARCH} == "sh3eb" || \ |
80 | ${MACHINE_ARCH} == "sh3el" || \ | | 79 | ${MACHINE_ARCH} == "sh3el" || \ |
81 | ${MACHINE_ARCH} == "m68k" || \ | | 80 | ${MACHINE_ARCH} == "m68k" || \ |
82 | ${MACHINE_ARCH} == "m68000")) | | 81 | ${MACHINE_ARCH} == "m68000")) |
83 | # XXX GCC 4.5 for sh3 and m68k (which we compile with -Os) is extra noisy for | | 82 | # XXX GCC 4.5 for sh3 and m68k (which we compile with -Os) is extra noisy for |
84 | # cases it should be better with | | 83 | # cases it should be better with |
85 | CFLAGS+= -Wno-uninitialized | | 84 | CFLAGS+= -Wno-uninitialized |
86 | .if ${HAVE_GCC} >= 48 | | 85 | .if ${HAVE_GCC} >= 48 |
87 | CFLAGS+= -Wno-maybe-uninitialized | | 86 | CFLAGS+= -Wno-maybe-uninitialized |
88 | .endif | | 87 | .endif |
89 | .endif | | 88 | .endif |
90 | .endif | | 89 | .endif |
91 | | | 90 | |
92 | CWARNFLAGS+= ${CWARNFLAGS.${ACTIVE_CC}} | | 91 | CWARNFLAGS+= ${CWARNFLAGS.${ACTIVE_CC}} |
93 | | | 92 | |
94 | CPPFLAGS+= ${AUDIT:D-D__AUDIT__} | | 93 | CPPFLAGS+= ${AUDIT:D-D__AUDIT__} |
95 | _NOWERROR= ${defined(NOGCCERROR) || (${ACTIVE_CC} == "clang" && defined(NOCLANGERROR)):?yes:no} | | 94 | _NOWERROR= ${defined(NOGCCERROR) || (${ACTIVE_CC} == "clang" && defined(NOCLANGERROR)):?yes:no} |
96 | CFLAGS+= ${${_NOWERROR} == "no" :?-Werror:} ${CWARNFLAGS} | | 95 | CFLAGS+= ${${_NOWERROR} == "no" :?-Werror:} ${CWARNFLAGS} |
97 | LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr/include} | | 96 | LINTFLAGS+= ${DESTDIR:D-d ${DESTDIR}/usr/include} |
98 | | | 97 | |
99 | .if (${USE_SSP:Uno} != "no") && (${BINDIR:Ux} != "/usr/mdec") | | 98 | .if (${USE_SSP:Uno} != "no") && (${BINDIR:Ux} != "/usr/mdec") |
100 | .if !defined(KERNSRCDIR) && !defined(KERN) # not for kernels nor kern modules | | 99 | .if !defined(KERNSRCDIR) && !defined(KERN) # not for kernels nor kern modules |
101 | CPPFLAGS+= -D_FORTIFY_SOURCE=2 | | 100 | CPPFLAGS+= -D_FORTIFY_SOURCE=2 |
102 | .endif | | 101 | .endif |
103 | COPTS+= -fstack-protector -Wstack-protector | | 102 | COPTS+= -fstack-protector -Wstack-protector |
104 | COPTS+= ${${ACTIVE_CC} == "clang":? --param ssp-buffer-size=1 :} | | 103 | COPTS+= ${${ACTIVE_CC} == "clang":? --param ssp-buffer-size=1 :} |
105 | COPTS+= ${${ACTIVE_CC} == "gcc":? --param ssp-buffer-size=1 :} | | 104 | COPTS+= ${${ACTIVE_CC} == "gcc":? --param ssp-buffer-size=1 :} |
106 | .endif | | 105 | .endif |
107 | | | 106 | |
108 | .if ${MKSOFTFLOAT:Uno} != "no" | | 107 | .if ${MKSOFTFLOAT:Uno} != "no" |
109 | COPTS+= -msoft-float | | 108 | COPTS+= -msoft-float |
110 | FOPTS+= -msoft-float | | 109 | FOPTS+= -msoft-float |
111 | .elif ${MACHINE_ARCH} == "coldfire" | | 110 | .elif ${MACHINE_ARCH} == "coldfire" |
112 | COPTS+= -mhard-float | | 111 | COPTS+= -mhard-float |
113 | FOPTS+= -mhard-float | | 112 | FOPTS+= -mhard-float |
114 | .endif | | 113 | .endif |
115 | | | 114 | |
116 | .if ${MKIEEEFP:Uno} != "no" | | 115 | .if ${MKIEEEFP:Uno} != "no" |
117 | .if ${MACHINE_ARCH} == "alpha" | | 116 | .if ${MACHINE_ARCH} == "alpha" |
118 | CFLAGS+= -mieee | | 117 | CFLAGS+= -mieee |
119 | FFLAGS+= -mieee | | 118 | FFLAGS+= -mieee |
120 | .endif | | 119 | .endif |
121 | .endif | | 120 | .endif |
122 | | | 121 | |
123 | .if ${MACHINE} == "sparc64" && ${MACHINE_ARCH} == "sparc" | | 122 | .if ${MACHINE} == "sparc64" && ${MACHINE_ARCH} == "sparc" |
124 | CFLAGS+= -Wa,-Av8plus | | 123 | CFLAGS+= -Wa,-Av8plus |
125 | .endif | | 124 | .endif |
126 | | | 125 | |
127 | .if !defined(NOGCCERROR) | | 126 | .if !defined(NOGCCERROR) |
128 | .if (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb") | | 127 | .if (${MACHINE_ARCH} == "mips64el") || (${MACHINE_ARCH} == "mips64eb") |
129 | CPUFLAGS+= -Wa,--fatal-warnings | | 128 | CPUFLAGS+= -Wa,--fatal-warnings |
130 | .endif | | 129 | .endif |
131 | .endif | | 130 | .endif |
132 | | | 131 | |
133 | #.if ${MACHINE} == "sbmips" | | 132 | #.if ${MACHINE} == "sbmips" |
134 | #CFLAGS+= -mips64 -mtune=sb1 | | 133 | #CFLAGS+= -mips64 -mtune=sb1 |
135 | #.endif | | 134 | #.endif |
136 | | | 135 | |
137 | #.if (${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") && \ | | 136 | #.if (${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb") && \ |
138 | # (defined(MKPIC) && ${MKPIC} == "no") | | 137 | # (defined(MKPIC) && ${MKPIC} == "no") |
139 | #CPUFLAGS+= -mno-abicalls -fno-PIC | | 138 | #CPUFLAGS+= -mno-abicalls -fno-PIC |
140 | #.endif | | 139 | #.endif |
141 | CFLAGS+= ${CPUFLAGS} | | 140 | CFLAGS+= ${CPUFLAGS} |
142 | AFLAGS+= ${CPUFLAGS} | | 141 | AFLAGS+= ${CPUFLAGS} |
143 | | | 142 | |
144 | .if !defined(LDSTATIC) || ${LDSTATIC} != "-static" | | 143 | .if !defined(LDSTATIC) || ${LDSTATIC} != "-static" |
145 | # Position Independent Executable flags | | 144 | # Position Independent Executable flags |
146 | PIE_CFLAGS?= -fPIC | | 145 | PIE_CFLAGS?= -fPIC |
147 | PIE_LDFLAGS?= -Wl,-pie -shared-libgcc | | 146 | PIE_LDFLAGS?= -Wl,-pie -shared-libgcc |
148 | PIE_AFLAGS?= -fPIC | | 147 | PIE_AFLAGS?= -fPIC |
149 | .endif | | 148 | .endif |
150 | | | 149 | |
151 | # Helpers for cross-compiling | | 150 | # Helpers for cross-compiling |
152 | HOST_CC?= cc | | 151 | HOST_CC?= cc |
153 | HOST_CFLAGS?= -O | | 152 | HOST_CFLAGS?= -O |
154 | HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c | | 153 | HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c |
155 | HOST_COMPILE.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} -c | | 154 | HOST_COMPILE.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} -c |
156 | HOST_LINK.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} | | 155 | HOST_LINK.cc?= ${HOST_CXX} ${HOST_CXXFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} |
157 | .if defined(HOSTPROG_CXX) | | 156 | .if defined(HOSTPROG_CXX) |
158 | HOST_LINK.c?= ${HOST_LINK.cc} | | 157 | HOST_LINK.c?= ${HOST_LINK.cc} |
159 | .else | | 158 | .else |
160 | HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} | | 159 | HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS} |
161 | .endif | | 160 | .endif |
162 | | | 161 | |
163 | HOST_CXX?= c++ | | 162 | HOST_CXX?= c++ |
164 | HOST_CXXFLAGS?= -O | | 163 | HOST_CXXFLAGS?= -O |
165 | | | 164 | |
166 | HOST_CPP?= cpp | | 165 | HOST_CPP?= cpp |
167 | HOST_CPPFLAGS?= | | 166 | HOST_CPPFLAGS?= |
168 | | | 167 | |
169 | HOST_LD?= ld | | 168 | HOST_LD?= ld |
170 | HOST_LDFLAGS?= | | 169 | HOST_LDFLAGS?= |
171 | | | 170 | |
172 | HOST_AR?= ar | | 171 | HOST_AR?= ar |
173 | HOST_RANLIB?= ranlib | | 172 | HOST_RANLIB?= ranlib |
174 | | | 173 | |
175 | HOST_LN?= ln | | 174 | HOST_LN?= ln |
176 | | | 175 | |
177 | # HOST_SH must be an absolute path | | 176 | # HOST_SH must be an absolute path |
178 | HOST_SH?= /bin/sh | | 177 | HOST_SH?= /bin/sh |
179 | | | 178 | |
180 | ELF2ECOFF?= elf2ecoff | | 179 | ELF2ECOFF?= elf2ecoff |
181 | MKDEP?= mkdep | | 180 | MKDEP?= mkdep |
182 | MKDEPCXX?= mkdep | | 181 | MKDEPCXX?= mkdep |
183 | OBJCOPY?= objcopy | | 182 | OBJCOPY?= objcopy |
184 | OBJDUMP?= objdump | | 183 | OBJDUMP?= objdump |
185 | PAXCTL?= paxctl | | 184 | PAXCTL?= paxctl |
186 | STRIP?= strip | | 185 | STRIP?= strip |
187 | | | 186 | |
188 | # TOOL_* variables are defined in bsd.own.mk | | 187 | # TOOL_* variables are defined in bsd.own.mk |
189 | | | 188 | |
190 | .SUFFIXES: .o .ln .lo .c .cc .cpp .cxx .C .m ${YHEADER:D.h} | | 189 | .SUFFIXES: .o .ln .lo .c .cc .cpp .cxx .C .m ${YHEADER:D.h} |
191 | | | 190 | |
192 | # C | | 191 | # C |
193 | .c.o: | | 192 | .c.o: |
194 | ${_MKTARGET_COMPILE} | | 193 | ${_MKTARGET_COMPILE} |
195 | ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} | | 194 | ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} |
196 | .if defined(CTFCONVERT) | | 195 | .if defined(CTFCONVERT) |
197 | ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} | | 196 | ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} |
198 | .endif | | 197 | .endif |
199 | | | 198 | |
200 | .c.ln: | | 199 | .c.ln: |
201 | ${_MKTARGET_COMPILE} | | 200 | ${_MKTARGET_COMPILE} |
202 | ${LINT} ${LINTFLAGS} ${LINTFLAGS.${.IMPSRC:T}} \ | | 201 | ${LINT} ${LINTFLAGS} ${LINTFLAGS.${.IMPSRC:T}} \ |
203 | ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ | | 202 | ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ |
204 | ${CPPFLAGS.${.IMPSRC:T}:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ | | 203 | ${CPPFLAGS.${.IMPSRC:T}:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ |
205 | -i ${.IMPSRC} | | 204 | -i ${.IMPSRC} |
206 | | | 205 | |
207 | # C++ | | 206 | # C++ |
208 | .cc.o .cpp.o .cxx.o .C.o: | | 207 | .cc.o .cpp.o .cxx.o .C.o: |
209 | ${_MKTARGET_COMPILE} | | 208 | ${_MKTARGET_COMPILE} |
210 | ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} | | 209 | ${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} |
211 | | | 210 | |
212 | # Objective C | | 211 | # Objective C |
213 | # (Defined here rather than in <sys.mk> because `.m' is not just | | 212 | # (Defined here rather than in <sys.mk> because `.m' is not just |
214 | # used for Objective C source) | | 213 | # used for Objective C source) |
215 | .m.o: | | 214 | .m.o: |
216 | ${_MKTARGET_COMPILE} | | 215 | ${_MKTARGET_COMPILE} |
217 | ${COMPILE.m} ${OBJCOPTS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} | | 216 | ${COMPILE.m} ${OBJCOPTS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} |
218 | .if defined(CTFCONVERT) | | 217 | .if defined(CTFCONVERT) |
219 | ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} | | 218 | ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} |
220 | .endif | | 219 | .endif |
221 | | | 220 | |
222 | # Host-compiled C objects | | 221 | # Host-compiled C objects |
223 | # The intermediate step is necessary for Sun CC, which objects to calling | | 222 | # The intermediate step is necessary for Sun CC, which objects to calling |
224 | # object files anything but *.o | | 223 | # object files anything but *.o |
225 | .c.lo: | | 224 | .c.lo: |
226 | ${_MKTARGET_COMPILE} | | 225 | ${_MKTARGET_COMPILE} |
227 | ${HOST_COMPILE.c} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} | | 226 | ${HOST_COMPILE.c} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} |
228 | mv ${.TARGET}.o ${.TARGET} | | 227 | mv ${.TARGET}.o ${.TARGET} |
229 | | | 228 | |
230 | # C++ | | 229 | # C++ |
231 | .cc.lo .cpp.lo .cxx.lo .C.lo: | | 230 | .cc.lo .cpp.lo .cxx.lo .C.lo: |
232 | ${_MKTARGET_COMPILE} | | 231 | ${_MKTARGET_COMPILE} |
233 | ${HOST_COMPILE.cc} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} | | 232 | ${HOST_COMPILE.cc} -o ${.TARGET}.o ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} |
234 | mv ${.TARGET}.o ${.TARGET} | | 233 | mv ${.TARGET}.o ${.TARGET} |
235 | | | 234 | |
236 | # Assembly | | 235 | # Assembly |
237 | .s.o: | | 236 | .s.o: |
238 | ${_MKTARGET_COMPILE} | | 237 | ${_MKTARGET_COMPILE} |
239 | ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} | | 238 | ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} |
240 | .if defined(CTFCONVERT) | | 239 | .if defined(CTFCONVERT) |
241 | ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} | | 240 | ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} |
242 | .endif | | 241 | .endif |
243 | | | 242 | |
244 | .S.o: | | 243 | .S.o: |
245 | ${_MKTARGET_COMPILE} | | 244 | ${_MKTARGET_COMPILE} |
246 | ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} | | 245 | ${COMPILE.S} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} |
247 | .if defined(CTFCONVERT) | | 246 | .if defined(CTFCONVERT) |
248 | ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} | | 247 | ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} |
249 | .endif | | 248 | .endif |
250 | | | 249 | |
251 | # Lex | | 250 | # Lex |
252 | LFLAGS+= ${LPREFIX.${.IMPSRC:T}:D-P${LPREFIX.${.IMPSRC:T}}} | | 251 | LFLAGS+= ${LPREFIX.${.IMPSRC:T}:D-P${LPREFIX.${.IMPSRC:T}}} |
253 | LFLAGS+= ${LPREFIX:D-P${LPREFIX}} | | 252 | LFLAGS+= ${LPREFIX:D-P${LPREFIX}} |
254 | | | 253 | |
255 | .l.c: | | 254 | .l.c: |
256 | ${_MKTARGET_LEX} | | 255 | ${_MKTARGET_LEX} |
257 | ${LEX.l} -o${.TARGET} ${.IMPSRC} | | 256 | ${LEX.l} -o${.TARGET} ${.IMPSRC} |
258 | | | 257 | |
259 | # Yacc | | 258 | # Yacc |
260 | YFLAGS+= ${YPREFIX.${.IMPSRC:T}:D-p${YPREFIX.${.IMPSRC:T}}} ${YHEADER.${.IMPSRC:T}:D-d} | | 259 | YFLAGS+= ${YPREFIX.${.IMPSRC:T}:D-p${YPREFIX.${.IMPSRC:T}}} ${YHEADER.${.IMPSRC:T}:D-d} |
261 | YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d} | | 260 | YFLAGS+= ${YPREFIX:D-p${YPREFIX}} ${YHEADER:D-d} |
262 | | | 261 | |
263 | .y.c: | | 262 | .y.c: |
264 | ${_MKTARGET_YACC} | | 263 | ${_MKTARGET_YACC} |
265 | ${YACC.y} -o ${.TARGET} ${.IMPSRC} | | 264 | ${YACC.y} -o ${.TARGET} ${.IMPSRC} |
266 | | | 265 | |
267 | .ifdef YHEADER | | 266 | .ifdef YHEADER |
268 | .if empty(.MAKEFLAGS:M-n) | | 267 | .if empty(.MAKEFLAGS:M-n) |
269 | .y.h: ${.TARGET:.h=.c} | | 268 | .y.h: ${.TARGET:.h=.c} |
270 | .endif | | 269 | .endif |
271 | .endif | | 270 | .endif |
272 | | | 271 | |
273 | # Objcopy | | 272 | # Objcopy |
274 | # ARM big endian needs to preserve $a/$d/$t symbols for the linker. | | 273 | # ARM big endian needs to preserve $a/$d/$t symbols for the linker. |
275 | OBJCOPYLIBFLAGS?=${"${.TARGET:M*.po}" != "":?-X:-x} \ | | 274 | OBJCOPYLIBFLAGS?=${"${.TARGET:M*.po}" != "":?-X:-x} \ |
276 | ${"${MACHINE_ARCH:M*arm*eb}" != "":?-K '\$a' -K '\$d' -K '\$t':} | | 275 | ${"${MACHINE_ARCH:M*arm*eb}" != "":?-K '\$a' -K '\$d' -K '\$t':} |
277 | | | 276 | |
278 | .endif # !defined(_BSD_SYS_MK_) | | 277 | .endif # !defined(_BSD_SYS_MK_) |