1# from: @(#)sys.mk 8.2 (Berkeley) 3/21/94 2# $Id: sys.mk,v 1.25 1997/09/05 09:09:56 peter Exp $ 3 4unix ?= We run FreeBSD, not UNIX. 5 6# If the special target .POSIX appears (without prerequisites or 7# commands) before the first noncomment line in the makefile, make shall 8# process the makefile as specified by the Posix 1003.2 specification. 9# make(1) sets the special macro %POSIX in this case (to the actual 10# value "1003.2", for what it's worth). 11# 12# The rules below use this macro to distinguish between Posix-compliant 13# and default behaviour. 14 15.if defined(%POSIX) 16.SUFFIXES: .o .c .y .l .a .sh .f 17.else 18.SUFFIXES: .out .a .ln .o .c .cc .cxx .C .F .f .e .r .y .l .S .s .cl .p .h .sh 19.endif 20 21.LIBS: .a 22 23X11BASE ?= /usr/X11R6 24 25AR ?= ar 26.if defined(%POSIX) 27ARFLAGS ?= -rv 28.else 29ARFLAGS ?= rl 30.endif 31RANLIB ?= ranlib 32 33AS ?= as 34AFLAGS ?= 35 36.if defined(%POSIX) 37CC ?= c89 38.else 39CC ?= cc 40.endif 41CFLAGS ?= -O 42 43CXX ?= c++ 44CXXFLAGS ?= ${CXXINCLUDES} ${CFLAGS} 45 46CPP ?= cpp 47 48.if ${.MAKEFLAGS:M-s} == "" 49ECHO ?= echo 50ECHODIR ?= echo 51.else 52ECHO ?= true 53.if ${.MAKEFLAGS:M-s} == "-s" 54ECHODIR ?= echo 55.else 56ECHODIR ?= true 57.endif 58.endif 59 60.if defined(%POSIX) 61FC ?= fort77 62FFLAGS ?= -O 1 63.else 64FC ?= f77 65FFLAGS ?= -O 66.endif 67EFLAGS ?= 68 69INSTALL ?= install 70 71LEX ?= lex 72LFLAGS ?= 73 74LD ?= ld 75LDFLAGS ?= 76 77LINT ?= lint 78LINTFLAGS ?= -chapbx 79 80MAKE ?= make 81 82PC ?= pc 83PFLAGS ?= 84 85RC ?= f77 86RFLAGS ?= 87 88SHELL ?= sh 89 90YACC ?= yacc 91.if defined(%POSIX) 92YFLAGS ?= 93.else 94YFLAGS ?= -d 95.endif 96 97# Default executable format 98BINFORMAT ?= aout 99 100# For tags rule. 101GTAGSFLAGS= -se 102HTAGSFLAGS= 103 104.if defined(%POSIX) 105# Posix 1003.2 mandated rules 106# 107# Quoted directly from the Posix 1003.2 draft, only the macros 108# $@, $< and $* have been replaced by ${.TARGET}, ${.IMPSRC}, and 109# ${.PREFIX}, resp. 110 111# SINGLE SUFFIX RULES 112.c: 113 ${CC} ${CFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 114 115.f: 116 ${FC} ${FFLAGS} ${LDFLAGS} -o ${.TARGET} ${.IMPSRC} 117 118.sh: 119 cp ${.IMPSRC} ${.TARGET} 120 chmod a+x ${.TARGET} 121 122# DOUBLE SUFFIX RULES 123 124.c.o: 125 ${CC} ${CFLAGS} -c ${.IMPSRC} 126 127.f.o: 128 ${FC} ${FFLAGS} -c ${.IMPSRC} 129 130.y.o: 131 ${YACC} ${YFLAGS} ${.IMPSRC} 132 ${CC} ${CFLAGS} -c y.tab.c 133 rm -f y.tab.c 134 mv y.tab.o ${.TARGET} 135 136.l.o: 137 ${LEX} ${LFLAGS} ${.IMPSRC} 138 ${CC} ${CFLAGS} -c lex.yy.c 139 rm -f lex.yy.c 140 mv lex.yy.o ${.TARGET} 141 142.y.c: 143 ${YACC} ${YFLAGS} ${.IMPSRC} 144 mv y.tab.c ${.TARGET} 145 146.l.c: 147 ${LEX} ${LFLAGS} ${.IMPSRC} 148 mv lex.yy.c ${.TARGET} 149 150.c.a: 151 ${CC} ${CFLAGS} -c ${.IMPSRC} 152 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 153 rm -f ${.PREFIX}.o 154 155.f.a: 156 ${FC} ${FFLAGS} -c ${.IMPSRC} 157 ${AR} ${ARFLAGS} ${.TARGET} ${.PREFIX}.o 158 rm -f ${.PREFIX}.o 159 160.else 161 162# non-Posix rule set 163 164.c: 165 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 166 167.sh: 168 cp -p ${.IMPSRC} ${.TARGET} 169 chmod a+x ${.TARGET} 170 171.c.o: 172 ${CC} ${CFLAGS} -c ${.IMPSRC} 173 174.cc.o .cxx.o .C.o: 175 ${CXX} ${CXXFLAGS} -c ${.IMPSRC} 176 177.p.o: 178 ${PC} ${PFLAGS} -c ${.IMPSRC} 179 180.e.o .r.o .F.o .f.o: 181 ${FC} ${RFLAGS} ${EFLAGS} ${FFLAGS} -c ${.IMPSRC} 182 183.S.o: 184 ${CC} ${CFLAGS} -c ${.IMPSRC} 185 186.s.o: 187 ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} 188 189# XXX not -j safe 190.y.o: 191 ${YACC} ${YFLAGS} ${.IMPSRC} 192 ${CC} ${CFLAGS} -c y.tab.c -o ${.TARGET} 193 rm -f y.tab.c 194 195.l.o: 196 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 197 ${CC} ${CFLAGS} -c ${.PREFIX}.tmp.c -o ${.TARGET} 198 rm -f ${.PREFIX}.tmp.c 199 200# XXX not -j safe 201.y.c: 202 ${YACC} ${YFLAGS} ${.IMPSRC} 203 mv y.tab.c ${.TARGET} 204 205.l.c: 206 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.TARGET} 207 208.s.out .c.out .o.out: 209 ${CC} ${CFLAGS} ${LDFLAGS} ${.IMPSRC} ${LDLIBS} -o ${.TARGET} 210 211.f.out .F.out .r.out .e.out: 212 ${FC} ${EFLAGS} ${RFLAGS} ${FFLAGS} ${LDFLAGS} ${.IMPSRC} \ 213 ${LDLIBS} -o ${.TARGET} 214 rm -f ${.PREFIX}.o 215 216# XXX not -j safe 217.y.out: 218 ${YACC} ${YFLAGS} ${.IMPSRC} 219 ${CC} ${CFLAGS} ${LDFLAGS} y.tab.c ${LDLIBS} -ly -o ${.TARGET} 220 rm -f y.tab.c 221 222.l.out: 223 ${LEX} -t ${LFLAGS} ${.IMPSRC} > ${.PREFIX}.tmp.c 224 ${CC} ${CFLAGS} ${LDFLAGS} ${.PREFIX}.tmp.c ${LDLIBS} -ll -o ${.TARGET} 225 rm -f ${.PREFIX}.tmp.c 226 227.endif 228 229.include <bsd.own.mk> 230 231.if exists(/etc/make.conf) 232.include </etc/make.conf> 233.endif 234