1 1.116 yamt # $NetBSD: sys.mk,v 1.116 2013/03/06 11:19:08 yamt 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.109 abs .elif ${MACHINE_ARCH} == "vax" 34 1.109 abs DBG?= -O1 -fgcse -fstrength-reduce -fgcse-after-reload 35 1.44 mycroft .else 36 1.107 chs DBG?= -O2 37 1.44 mycroft .endif 38 1.57 sjg CFLAGS?= ${DBG} 39 1.87 lukem LDFLAGS?= 40 1.22 christos COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c 41 1.22 christos LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} 42 1.22 christos 43 1.100 darran # C Type Format data is required for DTrace 44 1.116 yamt CTFFLAGS ?= -g -L VERSION 45 1.116 yamt CTFMFLAGS ?= -g -t -L VERSION 46 1.100 darran 47 1.113 christos # We don't define these here, we let the bsd.own.mk to do it 48 1.113 christos #CTFCONVERT ?= ctfconvert 49 1.113 christos #CTFMERGE ?= ctfmerge 50 1.100 darran 51 1.41 tv CXX?= c++ 52 1.110 christos CXXFLAGS?= ${CFLAGS:N-Wno-traditional:N-Wstrict-prototypes:N-Wmissing-prototypes:N-Wno-pointer-sign:N-ffreestanding:N-std=gnu99:N-Wold-style-definition:N-Wno-format-zero-length} 53 1.89 christos 54 1.98 joerg __ALLSRC1= ${empty(DESTDIR):?${.ALLSRC}:${.ALLSRC:S|^${DESTDIR}|^destdir|}} 55 1.98 joerg __ALLSRC2= ${empty(MAKEOBJDIR):?${__ALLSRC1}:${__ALLSRC1:S|^${MAKEOBJDIR}|^obj|}} 56 1.98 joerg __ALLSRC3= ${empty(NETBSDSRCDIR):?${__ALLSRC2}:${__ALLSRC2:S|^${NETBSDSRCDIR}|^src|}} 57 1.105 joerg __BUILDSEED= ${BUILDSEED}/${__ALLSRC3:O}/${.TARGET} 58 1.105 joerg _CXXSEED?= ${BUILDSEED:D-frandom-seed=${__BUILDSEED:hash}} 59 1.98 joerg 60 1.98 joerg COMPILE.cc?= ${CXX} ${_CXXSEED} ${CXXFLAGS} ${CPPFLAGS} -c 61 1.22 christos LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} 62 1.34 lukem 63 1.34 lukem OBJC?= ${CC} 64 1.34 lukem OBJCFLAGS?= ${CFLAGS} 65 1.34 lukem COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c 66 1.34 lukem LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} 67 1.3 mycroft 68 1.22 christos CPP?= cpp 69 1.75 lukem CPPFLAGS?= 70 1.1 cgd 71 1.22 christos FC?= f77 72 1.30 mikel FFLAGS?= -O 73 1.22 christos RFLAGS?= 74 1.22 christos COMPILE.f?= ${FC} ${FFLAGS} -c 75 1.22 christos LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS} 76 1.22 christos COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c 77 1.22 christos LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} 78 1.22 christos COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c 79 1.22 christos LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} 80 1.29 thorpej 81 1.29 thorpej INSTALL?= install 82 1.22 christos 83 1.79 lukem LD?= ld 84 1.79 lukem 85 1.22 christos LEX?= lex 86 1.22 christos LFLAGS?= 87 1.22 christos LEX.l?= ${LEX} ${LFLAGS} 88 1.22 christos 89 1.22 christos LINT?= lint 90 1.85 perry LINTFLAGS?= -chapbxzFS 91 1.22 christos 92 1.36 gwr LORDER?= lorder 93 1.36 gwr 94 1.22 christos MAKE?= make 95 1.22 christos 96 1.36 gwr NM?= nm 97 1.36 gwr 98 1.22 christos PC?= pc 99 1.22 christos PFLAGS?= 100 1.22 christos COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c 101 1.22 christos LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} 102 1.22 christos 103 1.22 christos SHELL?= sh 104 1.36 gwr 105 1.36 gwr SIZE?= size 106 1.36 gwr 107 1.36 gwr TSORT?= tsort -q 108 1.22 christos 109 1.22 christos YACC?= yacc 110 1.40 tv YFLAGS?= 111 1.22 christos YACC.y?= ${YACC} ${YFLAGS} 112 1.1 cgd 113 1.15 jtc # C 114 1.14 jtc .c: 115 1.15 jtc ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 116 1.100 darran .if defined(CTFCONVERT) 117 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 118 1.100 darran .endif 119 1.15 jtc .c.o: 120 1.15 jtc ${COMPILE.c} ${.IMPSRC} 121 1.100 darran .if defined(CTFCONVERT) 122 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 123 1.100 darran .endif 124 1.15 jtc .c.a: 125 1.15 jtc ${COMPILE.c} ${.IMPSRC} 126 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 127 1.76 lukem rm -f ${.PREFIX}.o 128 1.21 cgd .c.ln: 129 1.83 lukem ${LINT} ${LINTFLAGS} \ 130 1.83 lukem ${CPPFLAGS:C/-([IDU])[ ]*/-\1/Wg:M-[IDU]*} \ 131 1.83 lukem -i ${.IMPSRC} 132 1.14 jtc 133 1.15 jtc # C++ 134 1.55 jdolecek .cc .cpp .cxx .C: 135 1.15 jtc ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 136 1.55 jdolecek .cc.o .cpp.o .cxx.o .C.o: 137 1.15 jtc ${COMPILE.cc} ${.IMPSRC} 138 1.55 jdolecek .cc.a .cpp.a .cxx.a .C.a: 139 1.15 jtc ${COMPILE.cc} ${.IMPSRC} 140 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 141 1.76 lukem rm -f ${.PREFIX}.o 142 1.14 jtc 143 1.15 jtc # Fortran/Ratfor 144 1.15 jtc .f: 145 1.15 jtc ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 146 1.15 jtc .f.o: 147 1.15 jtc ${COMPILE.f} ${.IMPSRC} 148 1.114 christos .if defined(CTFCONVERT) 149 1.114 christos ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 150 1.114 christos .endif 151 1.15 jtc .f.a: 152 1.15 jtc ${COMPILE.f} ${.IMPSRC} 153 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 154 1.76 lukem rm -f ${.PREFIX}.o 155 1.14 jtc 156 1.15 jtc .F: 157 1.15 jtc ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 158 1.100 darran .if defined(CTFCONVERT) 159 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 160 1.100 darran .endif 161 1.15 jtc .F.o: 162 1.15 jtc ${COMPILE.F} ${.IMPSRC} 163 1.100 darran .if defined(CTFCONVERT) 164 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 165 1.100 darran .endif 166 1.15 jtc .F.a: 167 1.15 jtc ${COMPILE.F} ${.IMPSRC} 168 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 169 1.76 lukem rm -f ${.PREFIX}.o 170 1.14 jtc 171 1.15 jtc .r: 172 1.15 jtc ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 173 1.15 jtc .r.o: 174 1.15 jtc ${COMPILE.r} ${.IMPSRC} 175 1.114 christos .if defined(CTFCONVERT) 176 1.114 christos ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 177 1.114 christos .endif 178 1.15 jtc .r.a: 179 1.15 jtc ${COMPILE.r} ${.IMPSRC} 180 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 181 1.76 lukem rm -f ${.PREFIX}.o 182 1.9 jtc 183 1.15 jtc # Pascal 184 1.15 jtc .p: 185 1.15 jtc ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 186 1.100 darran .if defined(CTFCONVERT) 187 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 188 1.100 darran .endif 189 1.1 cgd .p.o: 190 1.15 jtc ${COMPILE.p} ${.IMPSRC} 191 1.100 darran .if defined(CTFCONVERT) 192 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 193 1.100 darran .endif 194 1.15 jtc .p.a: 195 1.15 jtc ${COMPILE.p} ${.IMPSRC} 196 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 197 1.76 lukem rm -f ${.PREFIX}.o 198 1.1 cgd 199 1.15 jtc # Assembly 200 1.15 jtc .s: 201 1.15 jtc ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 202 1.100 darran .if defined(CTFCONVERT) 203 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 204 1.100 darran .endif 205 1.1 cgd .s.o: 206 1.27 mycroft ${COMPILE.s} ${.IMPSRC} 207 1.100 darran .if defined(CTFCONVERT) 208 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 209 1.100 darran .endif 210 1.15 jtc .s.a: 211 1.15 jtc ${COMPILE.s} ${.IMPSRC} 212 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 213 1.76 lukem rm -f ${.PREFIX}.o 214 1.15 jtc .S: 215 1.15 jtc ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 216 1.100 darran .if defined(CTFCONVERT) 217 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 218 1.100 darran .endif 219 1.8 brezak .S.o: 220 1.27 mycroft ${COMPILE.S} ${.IMPSRC} 221 1.100 darran .if defined(CTFCONVERT) 222 1.100 darran ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 223 1.100 darran .endif 224 1.15 jtc .S.a: 225 1.15 jtc ${COMPILE.S} ${.IMPSRC} 226 1.76 lukem ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 227 1.76 lukem rm -f ${.PREFIX}.o 228 1.1 cgd 229 1.15 jtc # Lex 230 1.15 jtc .l: 231 1.15 jtc ${LEX.l} ${.IMPSRC} 232 1.15 jtc ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 233 1.15 jtc rm -f lex.yy.c 234 1.15 jtc .l.c: 235 1.15 jtc ${LEX.l} ${.IMPSRC} 236 1.15 jtc mv lex.yy.c ${.TARGET} 237 1.1 cgd .l.o: 238 1.15 jtc ${LEX.l} ${.IMPSRC} 239 1.75 lukem ${COMPILE.c} -o ${.TARGET} lex.yy.c 240 1.114 christos .if defined(CTFCONVERT) 241 1.114 christos ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 242 1.114 christos .endif 243 1.1 cgd rm -f lex.yy.c 244 1.1 cgd 245 1.15 jtc # Yacc 246 1.15 jtc .y: 247 1.15 jtc ${YACC.y} ${.IMPSRC} 248 1.15 jtc ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 249 1.15 jtc rm -f y.tab.c 250 1.38 tv .y.c: 251 1.15 jtc ${YACC.y} ${.IMPSRC} 252 1.38 tv mv y.tab.c ${.TARGET} 253 1.15 jtc .y.o: 254 1.15 jtc ${YACC.y} ${.IMPSRC} 255 1.15 jtc ${COMPILE.c} -o ${.TARGET} y.tab.c 256 1.114 christos .if defined(CTFCONVERT) 257 1.114 christos ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} 258 1.114 christos .endif 259 1.1 cgd rm -f y.tab.c 260 1.1 cgd 261 1.15 jtc # Shell 262 1.15 jtc .sh: 263 1.15 jtc rm -f ${.TARGET} 264 1.15 jtc cp ${.IMPSRC} ${.TARGET} 265 1.79 lukem chmod a+x ${.TARGET} 266