1# $Id: HP-UX.mk,v 1.11 2017/05/05 18:02:16 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 104PC= pc 105PFLAGS= 106COMPILE.p= ${PC} ${PFLAGS} ${CPPFLAGS} -c 107LINK.p= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} 108 109# HP's sh sucks 110ENV= 111SHELL= /bin/ksh 112 113.if exists(/usr/local/bin/bison) 114YACC= bison -y 115.else 116YACC= yacc 117.endif 118YFLAGS= -d 119YACC.y= ${YACC} ${YFLAGS} 120 121# C 122.c: 123 ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 124.c.o: 125 ${COMPILE.c} ${.IMPSRC} 126.c.a: 127 ${COMPILE.c} ${.IMPSRC} 128 ${AR} ${ARFLAGS} $@ $*.o 129 rm -f $*.o 130 131# C++ 132${CXX_SUFFIXES}: 133 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 134${CXX_SUFFIXES:%=%.o}: 135 ${COMPILE.cc} ${.IMPSRC} 136${CXX_SUFFIXES:%=%.a}: 137 ${COMPILE.cc} ${.IMPSRC} 138 ${AR} ${ARFLAGS} $@ $*.o 139 rm -f $*.o 140 141# Fortran/Ratfor 142.f: 143 ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 144.f.o: 145 ${COMPILE.f} ${.IMPSRC} 146.f.a: 147 ${COMPILE.f} ${.IMPSRC} 148 ${AR} ${ARFLAGS} $@ $*.o 149 rm -f $*.o 150 151.F: 152 ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 153.F.o: 154 ${COMPILE.F} ${.IMPSRC} 155.F.a: 156 ${COMPILE.F} ${.IMPSRC} 157 ${AR} ${ARFLAGS} $@ $*.o 158 rm -f $*.o 159 160.r: 161 ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 162.r.o: 163 ${COMPILE.r} ${.IMPSRC} 164.r.a: 165 ${COMPILE.r} ${.IMPSRC} 166 ${AR} ${ARFLAGS} $@ $*.o 167 rm -f $*.o 168 169# Pascal 170.p: 171 ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 172.p.o: 173 ${COMPILE.p} ${.IMPSRC} 174.p.a: 175 ${COMPILE.p} ${.IMPSRC} 176 ${AR} ${ARFLAGS} $@ $*.o 177 rm -f $*.o 178 179# Assembly 180.s: 181 ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 182.s.o: 183 ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} 184.s.a: 185 ${COMPILE.s} ${.IMPSRC} 186 ${AR} ${ARFLAGS} $@ $*.o 187 rm -f $*.o 188.S: 189 ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 190.S.o: 191 ${COMPILE.S} ${.IMPSRC} 192.S.a: 193 ${COMPILE.S} ${.IMPSRC} 194 ${AR} ${ARFLAGS} $@ $*.o 195 rm -f $*.o 196 197# Lex 198.l: 199 ${LEX.l} ${.IMPSRC} 200 ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 201 rm -f lex.yy.c 202.l.c: 203 ${LEX.l} ${.IMPSRC} 204 mv lex.yy.c ${.TARGET} 205.l.o: 206 ${LEX.l} ${.IMPSRC} 207 ${COMPILE.c} -o ${.TARGET} lex.yy.c 208 rm -f lex.yy.c 209 210# Yacc 211.y: 212 ${YACC.y} ${.IMPSRC} 213 ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 214 rm -f y.tab.c 215.y.c: 216 ${YACC.y} ${.IMPSRC} 217 mv y.tab.c ${.TARGET} 218.y.o: 219 ${YACC.y} ${.IMPSRC} 220 ${COMPILE.c} -o ${.TARGET} y.tab.c 221 rm -f y.tab.c 222 223# Shell 224.sh: 225 rm -f ${.TARGET} 226 cp ${.IMPSRC} ${.TARGET} 227