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