1# $Id: HP-UX.mk,v 1.10 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= HP-UX 6ROOT_GROUP= root 7unix?= We run ${OS}. 8 9# HP-UX's cc does not provide any clues as to wether this is 9.x or 10.x 10# nor does sys/param.h, so we'll use the existence of /hp-ux 11.if exists("/hp-ux") 12OSMAJOR?=9 13.endif 14OSMAJOR?=10 15__HPUX_VERSION?=${OSMAJOR} 16 17.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4 18 19LIBMODE= 755 20LIBCRT0= /lib/crt0.o 21 22.LIBS: .a 23 24# +b<path> is needed to stop the binaries from insisting on having 25# the build tree available :-) 26# +s tells the dynamic loader to use SHLIB_PATH if set 27LD_bpath?=-Wl,+b/lib:/usr/lib:/usr/local/lib 28LD_spath?=-Wl,+s 29LDADD+= ${LD_bpath} ${LD_spath} 30 31.if exists(/usr/lib/end.o) 32LDADD+= /usr/lib/end.o 33.endif 34 35AR= ar 36ARFLAGS= rl 37RANLIB= : 38 39AFLAGS= 40COMPILE.s= ${AS} ${AFLAGS} 41LINK.s= ${CC} ${AFLAGS} ${LDFLAGS} 42COMPILE.S= ${CC} ${AFLAGS} ${CPPFLAGS} -c 43LINK.S= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS} 44.if exists(/usr/local/bin/gcc) 45PIPE?= -pipe 46CC?= gcc ${PIPE} 47AS= gas 48DBG?= -O -g 49STATIC?= -static 50.if defined(DESTDIR) 51CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include 52.endif 53.else 54# HP's bundled compiler knows not -g or -O 55AS= as 56CC= cc 57.if exists(/opt/ansic/bin/cc) 58CCMODE?=-Ae +ESlit 59PICFLAG?= +z 60LD_x= 61DBG?=-g -O 62.endif 63DBG?= 64STATIC?= -Wl,-a,archive 65.endif 66.if (${__HPUX_VERSION} == "10") 67CCSOURCE_FLAGS?= -D_HPUX_SOURCE 68.else 69CCSOURCE_FLAGS?= -D_HPUX_SOURCE -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_XOPEN_SOURCE_EXTENDED 70.endif 71CFLAGS= ${DBG} 72CFLAGS+= ${CCMODE} -D__hpux__ -D__HPUX_VERSION=${__HPUX_VERSION} ${CCSOURCE_FLAGS} 73COMPILE.c= ${CC} ${CFLAGS} ${CPPFLAGS} -c 74LINK.c= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} 75 76CXX= g++ 77CXXFLAGS= ${CFLAGS} 78COMPILE.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c 79LINK.cc= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} 80 81CPP= cpp 82 83MK_DEP= mkdeps.sh -N 84FC= f77 85FFLAGS= -O 86RFLAGS= 87COMPILE.f= ${FC} ${FFLAGS} -c 88LINK.f= ${FC} ${FFLAGS} ${LDFLAGS} 89COMPILE.F= ${FC} ${FFLAGS} ${CPPFLAGS} -c 90LINK.F= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} 91COMPILE.r= ${FC} ${FFLAGS} ${RFLAGS} -c 92LINK.r= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} 93 94LEX= lex 95LFLAGS= 96LEX.l= ${LEX} ${LFLAGS} 97 98LD= ld 99LDFLAGS= 100 101LINT= lint 102LINTFLAGS= -chapbx 103 104MAKE= bmake 105 106PC= pc 107PFLAGS= 108COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c 109LINK.p= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} 110 111# HP's sh sucks 112ENV= 113SHELL= /bin/ksh 114 115.if exists(/usr/local/bin/bison) 116YACC= bison -y 117.else 118YACC= yacc 119.endif 120YFLAGS= -d 121YACC.y= ${YACC} ${YFLAGS} 122 123# C 124.c: 125 ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 126.c.o: 127 ${COMPILE.c} ${.IMPSRC} 128.c.a: 129 ${COMPILE.c} ${.IMPSRC} 130 ${AR} ${ARFLAGS} $@ $*.o 131 rm -f $*.o 132 133# C++ 134${CXX_SUFFIXES}: 135 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 136${CXX_SUFFIXES:%=%.o}: 137 ${COMPILE.cc} ${.IMPSRC} 138${CXX_SUFFIXES:%=%.a}: 139 ${COMPILE.cc} ${.IMPSRC} 140 ${AR} ${ARFLAGS} $@ $*.o 141 rm -f $*.o 142 143# Fortran/Ratfor 144.f: 145 ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 146.f.o: 147 ${COMPILE.f} ${.IMPSRC} 148.f.a: 149 ${COMPILE.f} ${.IMPSRC} 150 ${AR} ${ARFLAGS} $@ $*.o 151 rm -f $*.o 152 153.F: 154 ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 155.F.o: 156 ${COMPILE.F} ${.IMPSRC} 157.F.a: 158 ${COMPILE.F} ${.IMPSRC} 159 ${AR} ${ARFLAGS} $@ $*.o 160 rm -f $*.o 161 162.r: 163 ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 164.r.o: 165 ${COMPILE.r} ${.IMPSRC} 166.r.a: 167 ${COMPILE.r} ${.IMPSRC} 168 ${AR} ${ARFLAGS} $@ $*.o 169 rm -f $*.o 170 171# Pascal 172.p: 173 ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 174.p.o: 175 ${COMPILE.p} ${.IMPSRC} 176.p.a: 177 ${COMPILE.p} ${.IMPSRC} 178 ${AR} ${ARFLAGS} $@ $*.o 179 rm -f $*.o 180 181# Assembly 182.s: 183 ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 184.s.o: 185 ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} 186.s.a: 187 ${COMPILE.s} ${.IMPSRC} 188 ${AR} ${ARFLAGS} $@ $*.o 189 rm -f $*.o 190.S: 191 ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 192.S.o: 193 ${COMPILE.S} ${.IMPSRC} 194.S.a: 195 ${COMPILE.S} ${.IMPSRC} 196 ${AR} ${ARFLAGS} $@ $*.o 197 rm -f $*.o 198 199# Lex 200.l: 201 ${LEX.l} ${.IMPSRC} 202 ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 203 rm -f lex.yy.c 204.l.c: 205 ${LEX.l} ${.IMPSRC} 206 mv lex.yy.c ${.TARGET} 207.l.o: 208 ${LEX.l} ${.IMPSRC} 209 ${COMPILE.c} -o ${.TARGET} lex.yy.c 210 rm -f lex.yy.c 211 212# Yacc 213.y: 214 ${YACC.y} ${.IMPSRC} 215 ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 216 rm -f y.tab.c 217.y.c: 218 ${YACC.y} ${.IMPSRC} 219 mv y.tab.c ${.TARGET} 220.y.o: 221 ${YACC.y} ${.IMPSRC} 222 ${COMPILE.c} -o ${.TARGET} y.tab.c 223 rm -f y.tab.c 224 225# Shell 226.sh: 227 rm -f ${.TARGET} 228 cp ${.IMPSRC} ${.TARGET} 229