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 ?= r 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 115SIZE ?= size 116 117TSORT ?= tsort -q 118 119YACC ?= yacc 120YFLAGS ?= 121YACC.y ?= ${YACC} ${YFLAGS} 122 123# C 124.c: 125 ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 126.c.o: 127 ${COMPILE.c} ${.IMPSRC} 128.c.a: 129 ${COMPILE.c} ${.IMPSRC} 130 ${AR} ${ARFLAGS} $@ $*.o 131 rm -f $*.o 132.c.ln: 133 ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} 134 135# C++ 136${CXX_SUFFIXES}: 137 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 138${CXX_SUFFIXES:%=%.o}: 139 ${COMPILE.cc} ${.IMPSRC} 140${CXX_SUFFIXES:%=%.a}: 141 ${COMPILE.cc} ${.IMPSRC} 142 ${AR} ${ARFLAGS} $@ $*.o 143 rm -f $*.o 144 145# Fortran/Ratfor 146.f: 147 ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 148.f.o: 149 ${COMPILE.f} ${.IMPSRC} 150.f.a: 151 ${COMPILE.f} ${.IMPSRC} 152 ${AR} ${ARFLAGS} $@ $*.o 153 rm -f $*.o 154 155.F: 156 ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 157.F.o: 158 ${COMPILE.F} ${.IMPSRC} 159.F.a: 160 ${COMPILE.F} ${.IMPSRC} 161 ${AR} ${ARFLAGS} $@ $*.o 162 rm -f $*.o 163 164.r: 165 ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 166.r.o: 167 ${COMPILE.r} ${.IMPSRC} 168.r.a: 169 ${COMPILE.r} ${.IMPSRC} 170 ${AR} ${ARFLAGS} $@ $*.o 171 rm -f $*.o 172 173# Pascal 174.p: 175 ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 176.p.o: 177 ${COMPILE.p} ${.IMPSRC} 178.p.a: 179 ${COMPILE.p} ${.IMPSRC} 180 ${AR} ${ARFLAGS} $@ $*.o 181 rm -f $*.o 182 183# Assembly 184.s: 185 ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 186.s.o: 187 ${COMPILE.s} ${.IMPSRC} 188.s.a: 189 ${COMPILE.s} ${.IMPSRC} 190 ${AR} ${ARFLAGS} $@ $*.o 191 rm -f $*.o 192.S: 193 ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 194.S.o: 195 ${COMPILE.S} ${.IMPSRC} 196.S.a: 197 ${COMPILE.S} ${.IMPSRC} 198 ${AR} ${ARFLAGS} $@ $*.o 199 rm -f $*.o 200 201# Lex 202.l: 203 ${LEX.l} ${.IMPSRC} 204 ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 205 rm -f lex.yy.c 206.l.c: 207 ${LEX.l} ${.IMPSRC} 208 mv lex.yy.c ${.TARGET} 209.l.o: 210 ${LEX.l} ${.IMPSRC} 211 ${COMPILE.c} -o ${.TARGET} lex.yy.c 212 rm -f lex.yy.c 213 214# Yacc 215.y: 216 ${YACC.y} ${.IMPSRC} 217 ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 218 rm -f y.tab.c 219.y.c: 220 ${YACC.y} ${.IMPSRC} 221 mv y.tab.c ${.TARGET} 222.y.o: 223 ${YACC.y} ${.IMPSRC} 224 ${COMPILE.c} -o ${.TARGET} y.tab.c 225 rm -f y.tab.c 226 227# Shell 228.sh: 229 rm -f ${.TARGET} 230 cp ${.IMPSRC} ${.TARGET} 231 chmod a+x ${.TARGET} 232