1# $NetBSD: sys.mk,v 1.66.2.1 2002/06/05 03:31:01 lukem Exp $ 2# @(#)sys.mk 8.2 (Berkeley) 3/21/94 3 4OS= NetBSD 5unix?= We run ${OS}. 6 7.if !defined(MAKE_VERSION) 8# we are running native make 9# which defined MAKE_VERSION between 20010609 and 20090324 10# so we can make a rough guess 11.if defined(.MAKE.LEVEL) 12MAKE_VERSION = 20090908 13.elif defined(.MAKE.MAKEFILES) 14# introduced 20071008 15MAKE_VERSION = 20090324 16.else 17# this just before when MAKE_VERSION was introduced 18MAKE_VERSION = 20010606 19.endif 20.endif 21 22.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h 23.SUFFIXES: .sh .m4 24 25.LIBS: .a 26 27AR?= ar 28ARFLAGS?= rl 29RANLIB?= ranlib 30 31AS?= as 32AFLAGS?= 33COMPILE.s?= ${CC} ${AFLAGS} -c 34LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS} 35COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp 36LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS} 37 38CC?= cc 39 40# need to make sure this is set 41MACHINE_ARCH.${MACHINE} ?= ${MACHINE} 42.if empty(MACHINE_ARCH) 43MACHINE_ARCH = ${MACHINE_ARCH.${MACHINE}} 44.endif 45 46# 47# CPU model, derived from MACHINE_ARCH 48# 49MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:C/mips64e[bl]/mips/:C/sh3e[bl]/sh3/:S/m68000/m68k/:S/armeb/arm/} 50 51.if ${MACHINE_CPU} == "alpha" || \ 52 ${MACHINE_CPU} == "arm" || \ 53 ${MACHINE_CPU} == "i386" || \ 54 ${MACHINE_CPU} == "m68k" || \ 55 ${MACHINE_CPU} == "mips" || \ 56 ${MACHINE_CPU} == "powerpc" || \ 57 ${MACHINE_CPU} == "sparc" || \ 58 ${MACHINE_CPU} == "vax" 59DBG?= -O2 60.elif ${MACHINE_ARCH} == "x86_64" 61DBG?= 62.elif ${MACHINE_ARCH} == "sparc64" 63DBG?= -O -ffixed-g4 #Hack for embedany memory model compatibility 64.else 65DBG?= -O 66.endif 67CFLAGS?= ${DBG} 68COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c 69LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} 70 71CXX?= c++ 72CXXFLAGS?= ${CFLAGS} 73COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c 74LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} 75 76OBJC?= ${CC} 77OBJCFLAGS?= ${CFLAGS} 78COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c 79LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS} 80 81CPP?= cpp 82CPPFLAGS?= 83 84FC?= f77 85FFLAGS?= -O 86RFLAGS?= 87COMPILE.f?= ${FC} ${FFLAGS} -c 88LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS} 89COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c 90LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} 91COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c 92LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} 93 94INSTALL?= install 95 96LEX?= lex 97LFLAGS?= 98LEX.l?= ${LEX} ${LFLAGS} 99 100LD?= ld 101LDFLAGS?= 102 103LINT?= lint 104LINTFLAGS?= -chapbxzF 105 106LORDER?= lorder 107 108NM?= nm 109 110PC?= pc 111PFLAGS?= 112COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c 113LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} 114 115SHELL?= sh 116 117SIZE?= size 118 119TSORT?= tsort -q 120 121YACC?= yacc 122YFLAGS?= 123YACC.y?= ${YACC} ${YFLAGS} 124 125# C 126.c: 127 ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 128.c.o: 129 ${COMPILE.c} ${.IMPSRC} 130.c.a: 131 ${COMPILE.c} ${.IMPSRC} 132 ${AR} ${ARFLAGS} $@ $*.o 133 rm -f $*.o 134.c.ln: 135 ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} 136 137# C++ 138${CXX_SUFFIXES}: 139 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 140${CXX_SUFFIXES:%=%.o}: 141 ${COMPILE.cc} ${.IMPSRC} 142${CXX_SUFFIXES:%=%.a}: 143 ${COMPILE.cc} ${.IMPSRC} 144 ${AR} ${ARFLAGS} $@ $*.o 145 rm -f $*.o 146 147# Fortran/Ratfor 148.f: 149 ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 150.f.o: 151 ${COMPILE.f} ${.IMPSRC} 152.f.a: 153 ${COMPILE.f} ${.IMPSRC} 154 ${AR} ${ARFLAGS} $@ $*.o 155 rm -f $*.o 156 157.F: 158 ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 159.F.o: 160 ${COMPILE.F} ${.IMPSRC} 161.F.a: 162 ${COMPILE.F} ${.IMPSRC} 163 ${AR} ${ARFLAGS} $@ $*.o 164 rm -f $*.o 165 166.r: 167 ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 168.r.o: 169 ${COMPILE.r} ${.IMPSRC} 170.r.a: 171 ${COMPILE.r} ${.IMPSRC} 172 ${AR} ${ARFLAGS} $@ $*.o 173 rm -f $*.o 174 175# Pascal 176.p: 177 ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 178.p.o: 179 ${COMPILE.p} ${.IMPSRC} 180.p.a: 181 ${COMPILE.p} ${.IMPSRC} 182 ${AR} ${ARFLAGS} $@ $*.o 183 rm -f $*.o 184 185# Assembly 186.s: 187 ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 188.s.o: 189 ${COMPILE.s} ${.IMPSRC} 190.s.a: 191 ${COMPILE.s} ${.IMPSRC} 192 ${AR} ${ARFLAGS} $@ $*.o 193 rm -f $*.o 194.S: 195 ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 196.S.o: 197 ${COMPILE.S} ${.IMPSRC} 198.S.a: 199 ${COMPILE.S} ${.IMPSRC} 200 ${AR} ${ARFLAGS} $@ $*.o 201 rm -f $*.o 202 203# Lex 204.l: 205 ${LEX.l} ${.IMPSRC} 206 ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 207 rm -f lex.yy.c 208.l.c: 209 ${LEX.l} ${.IMPSRC} 210 mv lex.yy.c ${.TARGET} 211.l.o: 212 ${LEX.l} ${.IMPSRC} 213 ${COMPILE.c} -o ${.TARGET} lex.yy.c 214 rm -f lex.yy.c 215 216# Yacc 217.y: 218 ${YACC.y} ${.IMPSRC} 219 ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 220 rm -f y.tab.c 221.y.c: 222 ${YACC.y} ${.IMPSRC} 223 mv y.tab.c ${.TARGET} 224.y.o: 225 ${YACC.y} ${.IMPSRC} 226 ${COMPILE.c} -o ${.TARGET} y.tab.c 227 rm -f y.tab.c 228 229# Shell 230.sh: 231 rm -f ${.TARGET} 232 cp ${.IMPSRC} ${.TARGET} 233