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