1# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ 2# @(#)sys.mk 5.11 (Berkeley) 3/13/91 3 4OS ?= AIX 5unix ?= We run ${OS}. 6ROOT_GROUP ?= system 7 8# This needs a lot of work yet... 9 10NOPIC ?=no # no shared libs? 11 12.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4 13 14.LIBS: .a 15 16AR ?= ar 17ARFLAGS ?= r 18RANLIB ?= ranlib 19 20AS ?= as 21AFLAGS= 22COMPILE.s ?= ${AS} ${AFLAGS} 23LINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS} 24COMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c 25LINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS} 26.if exists(/usr/local/bin/gcc) 27CC ?= gcc 28DBG ?= -O -g 29STATIC ?= -static 30.else 31CC ?= cc 32DBG ?= -g 33STATIC ?= 34.endif 35CFLAGS ?= ${DBG} 36COMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c 37LINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} 38 39CXX ?= g++ 40CXXFLAGS ?= ${CFLAGS} 41COMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c 42LINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} 43 44CPP ?= cpp 45.if defined(DESTDIR) 46CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include 47.endif 48 49MK_DEP ?= mkdeps.sh -N 50FC ?= f77 51FFLAGS ?= -O 52RFLAGS= 53COMPILE.f ?= ${FC} ${FFLAGS} -c 54LINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS} 55COMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c 56LINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} 57COMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c 58LINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} 59 60LEX ?= lex 61LFLAGS= 62LEX.l ?= ${LEX} ${LFLAGS} 63 64LD ?= ld 65LDFLAGS= 66 67LINT ?= lint 68LINTFLAGS ?= -chapbx 69 70PC ?= pc 71PFLAGS= 72COMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c 73LINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} 74 75YACC ?= yacc 76YFLAGS ?= -d 77YACC.y ?= ${YACC} ${YFLAGS} 78 79# C 80.c: 81 ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 82.c.o: 83 ${COMPILE.c} ${.IMPSRC} 84.c.a: 85 ${COMPILE.c} ${.IMPSRC} 86 ${AR} ${ARFLAGS} $@ $*.o 87 rm -f $*.o 88 89# C++ 90${CXX_SUFFIXES}: 91 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 92${CXX_SUFFIXES:%=%.o}: 93 ${COMPILE.cc} ${.IMPSRC} 94${CXX_SUFFIXES:%=%.a}: 95 ${COMPILE.cc} ${.IMPSRC} 96 ${AR} ${ARFLAGS} $@ $*.o 97 rm -f $*.o 98 99# Fortran/Ratfor 100.f: 101 ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 102.f.o: 103 ${COMPILE.f} ${.IMPSRC} 104.f.a: 105 ${COMPILE.f} ${.IMPSRC} 106 ${AR} ${ARFLAGS} $@ $*.o 107 rm -f $*.o 108 109.F: 110 ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 111.F.o: 112 ${COMPILE.F} ${.IMPSRC} 113.F.a: 114 ${COMPILE.F} ${.IMPSRC} 115 ${AR} ${ARFLAGS} $@ $*.o 116 rm -f $*.o 117 118.r: 119 ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 120.r.o: 121 ${COMPILE.r} ${.IMPSRC} 122.r.a: 123 ${COMPILE.r} ${.IMPSRC} 124 ${AR} ${ARFLAGS} $@ $*.o 125 rm -f $*.o 126 127# Pascal 128.p: 129 ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 130.p.o: 131 ${COMPILE.p} ${.IMPSRC} 132.p.a: 133 ${COMPILE.p} ${.IMPSRC} 134 ${AR} ${ARFLAGS} $@ $*.o 135 rm -f $*.o 136 137# Assembly 138.s: 139 ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 140.s.o: 141 ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} 142.s.a: 143 ${COMPILE.s} ${.IMPSRC} 144 ${AR} ${ARFLAGS} $@ $*.o 145 rm -f $*.o 146.S: 147 ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 148.S.o: 149 ${COMPILE.S} ${.IMPSRC} 150.S.a: 151 ${COMPILE.S} ${.IMPSRC} 152 ${AR} ${ARFLAGS} $@ $*.o 153 rm -f $*.o 154 155# Lex 156.l: 157 ${LEX.l} ${.IMPSRC} 158 ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 159 rm -f lex.yy.c 160.l.c: 161 ${LEX.l} ${.IMPSRC} 162 mv lex.yy.c ${.TARGET} 163.l.o: 164 ${LEX.l} ${.IMPSRC} 165 ${COMPILE.c} -o ${.TARGET} lex.yy.c 166 rm -f lex.yy.c 167 168# Yacc 169.y: 170 ${YACC.y} ${.IMPSRC} 171 ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 172 rm -f y.tab.c 173.y.c: 174 ${YACC.y} ${.IMPSRC} 175 mv y.tab.c ${.TARGET} 176.y.o: 177 ${YACC.y} ${.IMPSRC} 178 ${COMPILE.c} -o ${.TARGET} y.tab.c 179 rm -f y.tab.c 180 181# Shell 182.sh: 183 rm -f ${.TARGET} 184 cp ${.IMPSRC} ${.TARGET} 185 chmod a+x ${.TARGET} 186