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