Added various COMPILE.? & LINK.? macros and changed suffix rules to use

them (Like Sun & GNU make).
This commit is contained in:
jtc 1994-03-24 16:01:24 +00:00
parent f8e2732fe8
commit 4051de5f84
1 changed files with 125 additions and 89 deletions

View File

@ -1,9 +1,9 @@
# from: @(#)sys.mk 5.11 (Berkeley) 3/13/91 # from: @(#)sys.mk 5.11 (Berkeley) 3/13/91
# $Id: sys.mk,v 1.14 1994/03/24 01:39:28 jtc Exp $ # $Id: sys.mk,v 1.15 1994/03/24 16:01:24 jtc Exp $
unix= We run UNIX. unix= We run UNIX.
.SUFFIXES: .out .a .ln .o .c .cc .C .F .f .e .r .y .l .s .S .cl .p .h .sh .SUFFIXES: .out .a .ln .o .c .cc .C .F .f .r .y .l .s .S .cl .p .h .sh
.LIBS: .a .LIBS: .a
@ -13,21 +13,37 @@ RANLIB= ranlib
AS= as AS= as
AFLAGS= AFLAGS=
COMPILE.s= ${AS} ${AFLAGS}
LINK.s= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC= cc CC= cc
CFLAGS= -O CFLAGS= -O
COMPILE.c= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX= g++ CXX= g++
CXXFLAGS= ${CFLAGS} CXXFLAGS= ${CFLAGS}
COMPILE.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP= cpp CPP= cpp
CPPFLAGS=
FC= f77 FC= f77
FFLAGS= -O FFLAGS= -O
EFLAGS= RFLAGS=
COMPILE.f= ${FC} ${FFLAGS} -c
LINK.f= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
LEX= lex LEX= lex
LFLAGS= LFLAGS=
LEX.l= ${LEX} ${LFLAGS}
LD= ld LD= ld
LDFLAGS= LDFLAGS=
@ -39,107 +55,127 @@ MAKE= make
PC= pc PC= pc
PFLAGS= PFLAGS=
COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c
RC= f77 LINK.p= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
RFLAGS=
SHELL= sh SHELL= sh
YACC= yacc YACC= yacc
YFLAGS= -d YFLAGS= -d
YACC.y= ${YACC} ${YFLAGS}
# single suffix rules # C
.c: .c:
${CC} ${CFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.cc .C: # C++
${CXX} ${CXXFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} .cc:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.e .r .F .f: .C:
${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.C.o:
${COMPILE.cc} ${.IMPSRC}
.C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p: .p:
${PC} ${PFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.y: # Assembly
${YACC} ${YFLAGS} ${.IMPSRC} .s:
${CC} ${CFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
rm -f y.tab.c .s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l: .l:
${LEX} ${LFLAGS} ${.IMPSRC} ${LEX.l} ${.IMPSRC}
${CC} ${CFLAGS} lex.yy.c ${LDLIBS} -ll -o ${.TARGET} ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh: .sh:
rm -f ${.TARGET} rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET} cp ${.IMPSRC} ${.TARGET}
# double suffix rules
.c.o:
${CC} ${CFLAGS} -c ${.IMPSRC}
.cc.o .C.o:
${CXX} ${CXXFLAGS} -c ${.IMPSRC}
.e.o .r.o .F.o .f.o:
${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC}
.p.o:
${PC} ${PFLAGS} -c ${.IMPSRC}
.s.o:
${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
.S.o:
${CC} -E ${CFLAGS} ${AFLAGS} ${.IMPSRC} | as -o ${.TARGET}
.y.o:
${YACC} ${YFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET}
rm -f y.tab.c
.l.o:
${LEX} ${LFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} -c lex.yy.c -o ${.TARGET}
rm -f lex.yy.c
.y.c:
${YACC} ${YFLAGS} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.l.c:
${LEX} ${LFLAGS} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.c.a:
${CC} -c ${CFLAGS} $<
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.f.a:
${CC} -c ${FFLAGS} $<
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.s.out .c.out .o.out:
${CC} ${CFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET}
.f.out .F.out .r.out .e.out:
${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${.IMPSRC} \
${LDLIBS} -o ${.TARGET}
rm -f ${.PREFIX}.o
.y.out:
${YACC} ${YFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET}
rm -f y.tab.c
.l.out:
${LEX} ${LFLAGS} ${.IMPSRC}
${CC} ${CFLAGS} lex.yy.c ${LDLIBS} -ll -o ${.TARGET}
rm -f lex.yy.c
.include <bsd.own.mk>