1# $Id: HP-UX.mk,v 1.9 2003/09/30 16:42:23 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 .cc .C .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.cc: 135 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 136.cc.o: 137 ${COMPILE.cc} ${.IMPSRC} 138.cc.a: 139 ${COMPILE.cc} ${.IMPSRC} 140 ${AR} ${ARFLAGS} $@ $*.o 141 rm -f $*.o 142 143.C: 144 ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 145.C.o: 146 ${COMPILE.cc} ${.IMPSRC} 147.C.a: 148 ${COMPILE.cc} ${.IMPSRC} 149 ${AR} ${ARFLAGS} $@ $*.o 150 rm -f $*.o 151 152# Fortran/Ratfor 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.F: 163 ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 164.F.o: 165 ${COMPILE.F} ${.IMPSRC} 166.F.a: 167 ${COMPILE.F} ${.IMPSRC} 168 ${AR} ${ARFLAGS} $@ $*.o 169 rm -f $*.o 170 171.r: 172 ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 173.r.o: 174 ${COMPILE.r} ${.IMPSRC} 175.r.a: 176 ${COMPILE.r} ${.IMPSRC} 177 ${AR} ${ARFLAGS} $@ $*.o 178 rm -f $*.o 179 180# Pascal 181.p: 182 ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 183.p.o: 184 ${COMPILE.p} ${.IMPSRC} 185.p.a: 186 ${COMPILE.p} ${.IMPSRC} 187 ${AR} ${ARFLAGS} $@ $*.o 188 rm -f $*.o 189 190# Assembly 191.s: 192 ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 193.s.o: 194 ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} 195.s.a: 196 ${COMPILE.s} ${.IMPSRC} 197 ${AR} ${ARFLAGS} $@ $*.o 198 rm -f $*.o 199.S: 200 ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 201.S.o: 202 ${COMPILE.S} ${.IMPSRC} 203.S.a: 204 ${COMPILE.S} ${.IMPSRC} 205 ${AR} ${ARFLAGS} $@ $*.o 206 rm -f $*.o 207 208# Lex 209.l: 210 ${LEX.l} ${.IMPSRC} 211 ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 212 rm -f lex.yy.c 213.l.c: 214 ${LEX.l} ${.IMPSRC} 215 mv lex.yy.c ${.TARGET} 216.l.o: 217 ${LEX.l} ${.IMPSRC} 218 ${COMPILE.c} -o ${.TARGET} lex.yy.c 219 rm -f lex.yy.c 220 221# Yacc 222.y: 223 ${YACC.y} ${.IMPSRC} 224 ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 225 rm -f y.tab.c 226.y.c: 227 ${YACC.y} ${.IMPSRC} 228 mv y.tab.c ${.TARGET} 229.y.o: 230 ${YACC.y} ${.IMPSRC} 231 ${COMPILE.c} -o ${.TARGET} y.tab.c 232 rm -f y.tab.c 233 234# Shell 235.sh: 236 rm -f ${.TARGET} 237 cp ${.IMPSRC} ${.TARGET} 238