1# $Id: SunOS.mk,v 1.7 2016/03/22 20:45:15 sjg Exp $ 2 3.if ${.PARSEFILE} == "sys.mk" 4.include <host-target.mk> 5 6OS?= SunOS.${HOST_OSMAJOR} 7unix?= We run ${OS}. 8.endif 9 10.if ${HOST_OSMAJOR} > 4 11ROOT_GROUP= root 12 13SHLIB_FULLVERSION = ${SHLIB_MAJOR} 14 15# suppress the dependency 16LIBCRT0= /dev/null 17 18.ifndef CC 19# the PATH below may find an ancient gcc 20CC := ${gcc:L:${M_whence}} 21.export CC 22.endif 23 24# the stuff in /usr/xpg4/bin is usually more sane. 25PATH=/usr/xpg4/bin:/usr/sbin:/usr/bin:/usr/ucb:/usr/sfw/bin:/opt/gnu/bin:/usr/ccs/bin:/usr/local/bin 26.export PATH 27 28DSHLIBEXT = .so 29HOST_LIBDIRS = /usr/lib /lib /usr/sfw/lib 30 31# no -X 32LD_X= 33LD_x= 34RANLIB= : 35CPP= /usr/ccs/lib/cpp 36.else 37ROOT_GROUP= wheel 38RANLIB= ranlib 39CPP= cpp 40.endif 41 42# the rest is common 43 44.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4 45 46.LIBS: .a 47 48AR= ar 49ARFLAGS= rl 50 51AS= as 52AS_STDIN= - 53AFLAGS= 54COMPILE.s= ${AS} ${AFLAGS} 55LINK.s= ${CC} ${AFLAGS} ${LDFLAGS} 56COMPILE.S= ${CC} ${AFLAGS} ${CPPFLAGS} -c 57LINK.S= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS} 58.if exists(/opt/gnu/bin/gcc) || exists(/usr/local/bin/gcc) 59CC ?= gcc -pipe 60DBG= -O -g 61STATIC= -static 62.else 63CC ?= cc 64DBG= -g 65STATIC= -Bstatic 66.endif 67CFLAGS= ${DBG} 68COMPILE.c= ${CC} ${CFLAGS} ${CPPFLAGS} -c 69LINK.c= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} 70 71CXX= g++ 72CXXFLAGS= ${CFLAGS} 73COMPILE.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c 74LINK.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} 75 76.if defined(DESTDIR) 77CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include 78.endif 79 80MK_DEP= mkdeps.sh -N 81FC= f77 82FFLAGS= -O 83RFLAGS= 84COMPILE.f= ${FC} ${FFLAGS} -c 85LINK.f= ${FC} ${FFLAGS} ${LDFLAGS} 86COMPILE.F= ${FC} ${FFLAGS} ${CPPFLAGS} -c 87LINK.F= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} 88COMPILE.r= ${FC} ${FFLAGS} ${RFLAGS} -c 89LINK.r= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} 90 91LEX= lex 92LFLAGS= 93LEX.l= ${LEX} ${LFLAGS} 94 95LD= ld 96LDFLAGS= 97 98LINT= lint 99LINTFLAGS= -chapbx 100 101MAKE= bmake 102 103PC= pc 104PFLAGS= 105COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c 106LINK.p= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} 107 108SHELL= sh 109 110.if exists(/usr/local/bin/bison) || exists(/opt/gnu/bin/bison) 111YACC= bison -y 112.else 113YACC= yacc 114.endif 115YFLAGS= -d 116YACC.y= ${YACC} ${YFLAGS} 117 118# C 119.c: 120 ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 121.c.o: 122 ${COMPILE.c} ${.IMPSRC} 123.c.a: 124 ${COMPILE.c} ${.IMPSRC} 125 ${AR} ${ARFLAGS} $@ $*.o 126 rm -f $*.o 127 128# C++ 129${CXX_SUFFIXES}: 130 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 131${CXX_SUFFIXES:%=%.o}: 132 ${COMPILE.cc} ${.IMPSRC} 133${CXX_SUFFIXES:%=%.a}: 134 ${COMPILE.cc} ${.IMPSRC} 135 ${AR} ${ARFLAGS} $@ $*.o 136 rm -f $*.o 137 138# Fortran/Ratfor 139.f: 140 ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 141.f.o: 142 ${COMPILE.f} ${.IMPSRC} 143.f.a: 144 ${COMPILE.f} ${.IMPSRC} 145 ${AR} ${ARFLAGS} $@ $*.o 146 rm -f $*.o 147 148.F: 149 ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 150.F.o: 151 ${COMPILE.F} ${.IMPSRC} 152.F.a: 153 ${COMPILE.F} ${.IMPSRC} 154 ${AR} ${ARFLAGS} $@ $*.o 155 rm -f $*.o 156 157.r: 158 ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 159.r.o: 160 ${COMPILE.r} ${.IMPSRC} 161.r.a: 162 ${COMPILE.r} ${.IMPSRC} 163 ${AR} ${ARFLAGS} $@ $*.o 164 rm -f $*.o 165 166# Pascal 167.p: 168 ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 169.p.o: 170 ${COMPILE.p} ${.IMPSRC} 171.p.a: 172 ${COMPILE.p} ${.IMPSRC} 173 ${AR} ${ARFLAGS} $@ $*.o 174 rm -f $*.o 175 176# Assembly 177.s: 178 ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 179.s.o: 180 ${COMPILE.s} ${.IMPSRC} 181.s.a: 182 ${COMPILE.s} ${.IMPSRC} 183 ${AR} ${ARFLAGS} $@ $*.o 184 rm -f $*.o 185.S: 186 ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 187.S.o: 188 ${COMPILE.S} ${.IMPSRC} 189.S.a: 190 ${COMPILE.S} ${.IMPSRC} 191 ${AR} ${ARFLAGS} $@ $*.o 192 rm -f $*.o 193 194# Lex 195.l: 196 ${LEX.l} ${.IMPSRC} 197 ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 198 rm -f lex.yy.c 199.l.c: 200 ${LEX.l} ${.IMPSRC} 201 mv lex.yy.c ${.TARGET} 202.l.o: 203 ${LEX.l} ${.IMPSRC} 204 ${COMPILE.c} -o ${.TARGET} lex.yy.c 205 rm -f lex.yy.c 206 207# Yacc 208.y: 209 ${YACC.y} ${.IMPSRC} 210 ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 211 rm -f y.tab.c 212.y.c: 213 ${YACC.y} ${.IMPSRC} 214 mv y.tab.c ${.TARGET} 215.y.o: 216 ${YACC.y} ${.IMPSRC} 217 ${COMPILE.c} -o ${.TARGET} y.tab.c 218 rm -f y.tab.c 219 220# Shell 221.sh: 222 rm -f ${.TARGET} 223 cp ${.IMPSRC} ${.TARGET} 224