1 1.121 christos # $NetBSD: sys.mk,v 1.121 2014/03/09 18:01:06 christos Exp $ 2 1.30 mikel # @(#)sys.mk 8.2 (Berkeley) 3/21/94 3 1.111 christos # 4 1.111 christos # This file contains the basic rules for make(1) and is read first 5 1.111 christos # Do not put conditionals that are set on different files here and 6 1.111 christos # expect them to work. 7 1.1 cgd 8 1.30 mikel unix?= We run NetBSD. 9 1.1 cgd 10 1.80 lukem .SUFFIXES: .a .o .ln .s .S .c .cc .cpp .cxx .C .f .F .r .p .l .y .sh 11 1.1 cgd 12 1.1 cgd .LIBS: .a 13 1.1 cgd 14 1.22 christos AR?= ar 15 1.22 christos ARFLAGS?= rl 16 1.22 christos RANLIB?= ranlib 17 1.22 christos 18 1.22 christos AS?= as 19 1.22 christos AFLAGS?= 20 1.106 joerg COMPILE.s?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} -c 21 1.106 joerg LINK.s?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${LDFLAGS} 22 1.101 joerg _ASM_TRADITIONAL_CPP= -x assembler-with-cpp 23 1.106 joerg COMPILE.S?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} ${_ASM_TRADITIONAL_CPP} -c 24 1.106 joerg LINK.S?= ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} ${LDFLAGS} 25 1.22 christos 26 1.22 christos CC?= cc 27 1.107 chs .if ${MACHINE_ARCH} == "sh3el" || ${MACHINE_ARCH} == "sh3eb" 28 1.97 uwe # -O2 is too -falign-* zealous for low-memory sh3 machines 29 1.97 uwe DBG?= -Os -freorder-blocks 30 1.107 chs .elif ${MACHINE_ARCH} == "m68k" || ${MACHINE_ARCH} == "m68000" 31 1.107 chs # see src/doc/HACKS for details 32 1.107 chs DBG?= -Os 33 1.117 matt .elif ${MACHINE_ARCH} == "coldfire" 34 1.117 matt DBG?= -O1 35 1.109 abs .elif ${MACHINE_ARCH} == "vax" 36 1.109 abs DBG?= -O1 -fgcse -fstrength-reduce -fgcse-after-reload 37 1.44 mycroft .else 38 1.107 chs DBG?= -O2 39 1.44 mycroft .endif 40 1.57 sjg CFLAGS?= ${DBG} 41 1.87 lukem LDFLAGS?= 42 1.22 christos COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c 43 1.22 christos LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} 44 1.22 christos 45 1.100 darran # C Type Format data is required for DTrace 46 1.116 yamt CTFFLAGS ?= -g -L VERSION 47 1.116 yamt CTFMFLAGS ?= -g -t -L VERSION 48 1.121 christos # XXX: Avoid deadlock in threads 49 1.121 christos CTFMERGE_MAX_SLOTS=1 50 1.121 christos .export CFTMERGE_MAX_SLOTS 51 1.100 darran 52 1.119 christos # We have to define these here, because if we don't the rules below will 53 1.119 christos # not work 54 1.119 christos .if exists(/usr/bin/ctfconvert) && exists(/usr/bin/ctfmerge) 55 1.119 christos CTFCONVERT ?= ctfconvert 56 1.119 christos CTFMERGE ?= ctfmerge 57 1.119 christos .endif 58 1.100 darran 59 1.41 tv CXX?= c++ 60 1.118 christos CXXFLAGS?= ${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-Wno-pointer-sign:N-ffreestanding:N-std=gnu[0-9][0-9]:N-Wold-style-definition:N-Wno-format-zero-length} 61 1.89 christos 62 1.98 joerg __ALLSRC1= ${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}} 63 1.98 joerg __ALLSRC2= ${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}} 64 1.98 joerg __ALLSRC3= ${empty(NETBSDSRCDIR):?${__ALLSRC2}:${__ALLSRC2:S|^${NETBSDSRCDIR}|^src|}} 65 1.105 joerg __BUILDSEED= ${BUILDSEED}/${__ALLSRC3:O}/${.TARGET} 66 1.105 joerg _CXXSEED?= ${BUILDSEED:D-frandom-seed=${__BUILDSEED:hash}} 67 1.98 joerg 68 1.98 joerg COMPILE.cc?= ${CXX} ${_CXXSEED} ${CXXFLAGS} ${CPPFLAGS} -c 69 1.22 christos LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} 70 1.34 lukem 71 1.34 lukem OBJC?= ${CC} 72 1.34 lukem OBJCFLAGS?= ${CFLAGS} 73 1.34 lukem COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c 74 1.34 lukem LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} 75 1.3 mycroft 76 1.22 christos CPP?= cpp 77 1.75 lukem CPPFLAGS?= 78 1.1 cgd 79 1.22 christos FC?= f77 80 1.30 mikel FFLAGS?= -O 81 1.22 christos RFLAGS?= 82 1.22 christos COMPILE.f?= ${FC} ${FFLAGS} -c 83 1.22 christos LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS} 84 1.22 christos COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c 85 1.22 christos LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} 86 1.22 christos COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c 87 1.22 christos LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} 88 1.29 thorpej 89 1.29 thorpej INSTALL?= install 90 1.22 christos 91 1.79 lukem LD?= ld 92 1.79 lukem 93 1.22 christos LEX?= lex 94 1.22 christos LFLAGS?= 95 1.22 christos LEX.l?= ${LEX} ${LFLAGS} 96 1.22 christos 97 1.22 christos LINT?= lint 98 1.85 perry LINTFLAGS?= -chapbxzFS 99 1.22 christos 100 1.36 gwr LORDER?= lorder 101 1.36 gwr 102 1.22 christos MAKE?= make 103 1.22 christos 104 1.36 gwr NM?= nm 105 1.36 gwr 106 1.22 christos PC?= pc 107 1.22 christos PFLAGS?= 108 1.22 christos COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c 109 1.22 christos LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} 110 1.22 christos 111 1.22 christos SHELL?= sh 112 1.36 gwr 113 1.36 gwr SIZE?= size 114 1.36 gwr 115 1.36 gwr TSORT?= tsort -q 116 1.22 christos 117 1.22 christos YACC?= yacc 118 1.40 tv YFLAGS?= 119 1.22 christos YACC.y?= ${YACC} ${YFLAGS} 120 1.1 cgd 121 1.15 jtc # C 122 1.14 jtc .c: 123 1.15 jtc ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 124 1.120 christos # XXX: disable for now 125 1.120 christos #.if defined(CTFCONVERT) 126 1.120 christos # ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 127 1.120 christos #.endif 128 1.15 jtc .c.o: 129 1.15 jtc ${COMPILE.c} ${.IMPSRC} 130 1.100 darran .if defined(CTFCONVERT) 131 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 132 1.100 darran .endif 133 1.15 jtc .c.a: 134 1.15 jtc ${COMPILE.c} ${.IMPSRC} 135 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 136 1.76 lukem rm -f ${.PREFIX}.o 137 1.21 cgd .c.ln: 138 1.83 lukem ${LINT} ${LINTFLAGS} \ 139 1.83 lukem ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 140 1.83 lukem -i ${.IMPSRC} 141 1.14 jtc 142 1.15 jtc # C++ 143 1.55 jdolecek .cc .cpp .cxx .C: 144 1.15 jtc ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 145 1.55 jdolecek .cc.o .cpp.o .cxx.o .C.o: 146 1.15 jtc ${COMPILE.cc} ${.IMPSRC} 147 1.55 jdolecek .cc.a .cpp.a .cxx.a .C.a: 148 1.15 jtc ${COMPILE.cc} ${.IMPSRC} 149 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 150 1.76 lukem rm -f ${.PREFIX}.o 151 1.14 jtc 152 1.15 jtc # Fortran/Ratfor 153 1.15 jtc .f: 154 1.15 jtc ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 155 1.15 jtc .f.o: 156 1.15 jtc ${COMPILE.f} ${.IMPSRC} 157 1.114 christos .if defined(CTFCONVERT) 158 1.114 christos ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 159 1.114 christos .endif 160 1.15 jtc .f.a: 161 1.15 jtc ${COMPILE.f} ${.IMPSRC} 162 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 163 1.76 lukem rm -f ${.PREFIX}.o 164 1.14 jtc 165 1.15 jtc .F: 166 1.15 jtc ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 167 1.100 darran .if defined(CTFCONVERT) 168 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 169 1.100 darran .endif 170 1.15 jtc .F.o: 171 1.15 jtc ${COMPILE.F} ${.IMPSRC} 172 1.100 darran .if defined(CTFCONVERT) 173 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 174 1.100 darran .endif 175 1.15 jtc .F.a: 176 1.15 jtc ${COMPILE.F} ${.IMPSRC} 177 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 178 1.76 lukem rm -f ${.PREFIX}.o 179 1.14 jtc 180 1.15 jtc .r: 181 1.15 jtc ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 182 1.15 jtc .r.o: 183 1.15 jtc ${COMPILE.r} ${.IMPSRC} 184 1.114 christos .if defined(CTFCONVERT) 185 1.114 christos ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 186 1.114 christos .endif 187 1.15 jtc .r.a: 188 1.15 jtc ${COMPILE.r} ${.IMPSRC} 189 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 190 1.76 lukem rm -f ${.PREFIX}.o 191 1.9 jtc 192 1.15 jtc # Pascal 193 1.15 jtc .p: 194 1.15 jtc ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 195 1.100 darran .if defined(CTFCONVERT) 196 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 197 1.100 darran .endif 198 1.1 cgd .p.o: 199 1.15 jtc ${COMPILE.p} ${.IMPSRC} 200 1.100 darran .if defined(CTFCONVERT) 201 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 202 1.100 darran .endif 203 1.15 jtc .p.a: 204 1.15 jtc ${COMPILE.p} ${.IMPSRC} 205 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 206 1.76 lukem rm -f ${.PREFIX}.o 207 1.1 cgd 208 1.15 jtc # Assembly 209 1.15 jtc .s: 210 1.15 jtc ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 211 1.100 darran .if defined(CTFCONVERT) 212 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 213 1.100 darran .endif 214 1.1 cgd .s.o: 215 1.27 mycroft ${COMPILE.s} ${.IMPSRC} 216 1.100 darran .if defined(CTFCONVERT) 217 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 218 1.100 darran .endif 219 1.15 jtc .s.a: 220 1.15 jtc ${COMPILE.s} ${.IMPSRC} 221 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 222 1.76 lukem rm -f ${.PREFIX}.o 223 1.15 jtc .S: 224 1.15 jtc ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 225 1.100 darran .if defined(CTFCONVERT) 226 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 227 1.100 darran .endif 228 1.8 brezak .S.o: 229 1.27 mycroft ${COMPILE.S} ${.IMPSRC} 230 1.100 darran .if defined(CTFCONVERT) 231 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 232 1.100 darran .endif 233 1.15 jtc .S.a: 234 1.15 jtc ${COMPILE.S} ${.IMPSRC} 235 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 236 1.76 lukem rm -f ${.PREFIX}.o 237 1.1 cgd 238 1.15 jtc # Lex 239 1.15 jtc .l: 240 1.15 jtc ${LEX.l} ${.IMPSRC} 241 1.15 jtc ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 242 1.15 jtc rm -f lex.yy.c 243 1.15 jtc .l.c: 244 1.15 jtc ${LEX.l} ${.IMPSRC} 245 1.15 jtc mv lex.yy.c ${.TARGET} 246 1.1 cgd .l.o: 247 1.15 jtc ${LEX.l} ${.IMPSRC} 248 1.75 lukem ${COMPILE.c} -o ${.TARGET} lex.yy.c 249 1.114 christos .if defined(CTFCONVERT) 250 1.114 christos ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 251 1.114 christos .endif 252 1.1 cgd rm -f lex.yy.c 253 1.1 cgd 254 1.15 jtc # Yacc 255 1.15 jtc .y: 256 1.15 jtc ${YACC.y} ${.IMPSRC} 257 1.15 jtc ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 258 1.15 jtc rm -f y.tab.c 259 1.38 tv .y.c: 260 1.15 jtc ${YACC.y} ${.IMPSRC} 261 1.38 tv mv y.tab.c ${.TARGET} 262 1.15 jtc .y.o: 263 1.15 jtc ${YACC.y} ${.IMPSRC} 264 1.15 jtc ${COMPILE.c} -o ${.TARGET} y.tab.c 265 1.114 christos .if defined(CTFCONVERT) 266 1.114 christos ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 267 1.114 christos .endif 268 1.1 cgd rm -f y.tab.c 269 1.1 cgd 270 1.15 jtc # Shell 271 1.15 jtc .sh: 272 1.15 jtc rm -f ${.TARGET} 273 1.15 jtc cp ${.IMPSRC} ${.TARGET} 274 1.79 lukem chmod a+x ${.TARGET} 275