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 .cc .cpp .cxx .C .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 83MAKE?= make 84 85NM?= nm 86 87PC?= pc 88PFLAGS?= 89COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c 90LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} 91 92SHELL?= sh 93 94SIZE?= size 95 96TSORT?= tsort -q 97 98YACC?= yacc 99YFLAGS?= 100YACC.y?= ${YACC} ${YFLAGS} 101 102# C 103.c: 104 ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 105.c.o: 106 ${COMPILE.c} ${.IMPSRC} 107.c.a: 108 ${COMPILE.c} ${.IMPSRC} 109 ${AR} ${ARFLAGS} $@ $*.o 110 rm -f $*.o 111.c.ln: 112 ${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC} 113 114# C++ 115.cc .cpp .cxx .C: 116 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 117.cc.o .cpp.o .cxx.o .C.o: 118 ${COMPILE.cc} ${.IMPSRC} 119.cc.a .cpp.a .cxx.a .C.a: 120 ${COMPILE.cc} ${.IMPSRC} 121 ${AR} ${ARFLAGS} $@ $*.o 122 rm -f $*.o 123 124# Fortran/Ratfor 125.f: 126 ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 127.f.o: 128 ${COMPILE.f} ${.IMPSRC} 129.f.a: 130 ${COMPILE.f} ${.IMPSRC} 131 ${AR} ${ARFLAGS} $@ $*.o 132 rm -f $*.o 133 134.F: 135 ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 136.F.o: 137 ${COMPILE.F} ${.IMPSRC} 138.F.a: 139 ${COMPILE.F} ${.IMPSRC} 140 ${AR} ${ARFLAGS} $@ $*.o 141 rm -f $*.o 142 143.r: 144 ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 145.r.o: 146 ${COMPILE.r} ${.IMPSRC} 147.r.a: 148 ${COMPILE.r} ${.IMPSRC} 149 ${AR} ${ARFLAGS} $@ $*.o 150 rm -f $*.o 151 152# Pascal 153.p: 154 ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 155.p.o: 156 ${COMPILE.p} ${.IMPSRC} 157.p.a: 158 ${COMPILE.p} ${.IMPSRC} 159 ${AR} ${ARFLAGS} $@ $*.o 160 rm -f $*.o 161 162# Assembly 163.s: 164 ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 165.s.o: 166 ${COMPILE.s} ${.IMPSRC} 167.s.a: 168 ${COMPILE.s} ${.IMPSRC} 169 ${AR} ${ARFLAGS} $@ $*.o 170 rm -f $*.o 171.S: 172 ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 173.S.o: 174 ${COMPILE.S} ${.IMPSRC} 175.S.a: 176 ${COMPILE.S} ${.IMPSRC} 177 ${AR} ${ARFLAGS} $@ $*.o 178 rm -f $*.o 179 180# Lex 181.l: 182 ${LEX.l} ${.IMPSRC} 183 ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 184 rm -f lex.yy.c 185.l.c: 186 ${LEX.l} ${.IMPSRC} 187 mv lex.yy.c ${.TARGET} 188.l.o: 189 ${LEX.l} ${.IMPSRC} 190 ${COMPILE.c} -o ${.TARGET} lex.yy.c 191 rm -f lex.yy.c 192 193# Yacc 194.y: 195 ${YACC.y} ${.IMPSRC} 196 ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 197 rm -f y.tab.c 198.y.c: 199 ${YACC.y} ${.IMPSRC} 200 mv y.tab.c ${.TARGET} 201.y.o: 202 ${YACC.y} ${.IMPSRC} 203 ${COMPILE.c} -o ${.TARGET} y.tab.c 204 rm -f y.tab.c 205 206# Shell 207.sh: 208 rm -f ${.TARGET} 209 cp ${.IMPSRC} ${.TARGET} 210