1*6eef5f0cSAntonio Huete Jimenez# $Id: HP-UX.mk,v 1.17 2022/03/25 23:43:06 sjg Exp $ 25f1e34d9SAlexandre Perrin# $NetBSD: sys.mk,v 1.19.2.1 1994/07/26 19:58:31 cgd Exp $ 35f1e34d9SAlexandre Perrin# @(#)sys.mk 5.11 (Berkeley) 3/13/91 45f1e34d9SAlexandre Perrin 5ca58f742SDaniel FojtOS ?= HP-UX 6ca58f742SDaniel FojtROOT_GROUP ?= root 75f1e34d9SAlexandre Perrinunix ?= We run ${OS}. 85f1e34d9SAlexandre Perrin 95f1e34d9SAlexandre Perrin# HP-UX's cc does not provide any clues as to wether this is 9.x or 10.x 105f1e34d9SAlexandre Perrin# nor does sys/param.h, so we'll use the existence of /hp-ux 115f1e34d9SAlexandre Perrin.if exists("/hp-ux") 125f1e34d9SAlexandre PerrinOSMAJOR ?=9 135f1e34d9SAlexandre Perrin.endif 145f1e34d9SAlexandre PerrinOSMAJOR ?=10 155f1e34d9SAlexandre Perrin__HPUX_VERSION ?=${OSMAJOR} 165f1e34d9SAlexandre Perrin 17f445c897SJohn Marino.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4 185f1e34d9SAlexandre Perrin 19ca58f742SDaniel FojtLIBMODE ?= 755 20ca58f742SDaniel FojtLIBCRT0 ?= /lib/crt0.o 215f1e34d9SAlexandre Perrin 225f1e34d9SAlexandre Perrin.LIBS: .a 235f1e34d9SAlexandre Perrin 245f1e34d9SAlexandre Perrin# +b<path> is needed to stop the binaries from insisting on having 255f1e34d9SAlexandre Perrin# the build tree available :-) 265f1e34d9SAlexandre Perrin# +s tells the dynamic loader to use SHLIB_PATH if set 275f1e34d9SAlexandre PerrinLD_bpath ?=-Wl,+b/lib:/usr/lib:/usr/local/lib 285f1e34d9SAlexandre PerrinLD_spath ?=-Wl,+s 295f1e34d9SAlexandre PerrinLDADD+= ${LD_bpath} ${LD_spath} 305f1e34d9SAlexandre Perrin 315f1e34d9SAlexandre Perrin.if exists(/usr/lib/end.o) 325f1e34d9SAlexandre PerrinLDADD+= /usr/lib/end.o 335f1e34d9SAlexandre Perrin.endif 345f1e34d9SAlexandre Perrin 35ca58f742SDaniel FojtAR ?= ar 36*6eef5f0cSAntonio Huete JimenezARFLAGS ?= r 37ca58f742SDaniel FojtRANLIB ?= : 385f1e34d9SAlexandre Perrin 395f1e34d9SAlexandre PerrinAFLAGS= 40ca58f742SDaniel FojtCOMPILE.s ?= ${AS} ${AFLAGS} 41ca58f742SDaniel FojtLINK.s ?= ${CC} ${AFLAGS} ${LDFLAGS} 42ca58f742SDaniel FojtCOMPILE.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} -c 43ca58f742SDaniel FojtLINK.S ?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS} 445f1e34d9SAlexandre Perrin.if exists(/usr/local/bin/gcc) 455f1e34d9SAlexandre PerrinPIPE ?= -pipe 465f1e34d9SAlexandre PerrinCC ?= gcc ${PIPE} 47ca58f742SDaniel FojtAS ?= gas 485f1e34d9SAlexandre PerrinDBG ?= -O -g 495f1e34d9SAlexandre PerrinSTATIC ?= -static 505f1e34d9SAlexandre Perrin.if defined(DESTDIR) 515f1e34d9SAlexandre PerrinCPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include 525f1e34d9SAlexandre Perrin.endif 535f1e34d9SAlexandre Perrin.else 545f1e34d9SAlexandre Perrin# HP's bundled compiler knows not -g or -O 55ca58f742SDaniel FojtAS ?= as 56ca58f742SDaniel FojtCC ?= cc 575f1e34d9SAlexandre Perrin.if exists(/opt/ansic/bin/cc) 585f1e34d9SAlexandre PerrinCCMODE ?=-Ae +ESlit 595f1e34d9SAlexandre PerrinPICFLAG ?= +z 605f1e34d9SAlexandre PerrinLD_x= 615f1e34d9SAlexandre PerrinDBG ?=-g -O 625f1e34d9SAlexandre Perrin.endif 635f1e34d9SAlexandre PerrinDBG ?= 645f1e34d9SAlexandre PerrinSTATIC ?= -Wl,-a,archive 655f1e34d9SAlexandre Perrin.endif 665f1e34d9SAlexandre Perrin.if (${__HPUX_VERSION} == "10") 675f1e34d9SAlexandre PerrinCCSOURCE_FLAGS ?= -D_HPUX_SOURCE 685f1e34d9SAlexandre Perrin.else 695f1e34d9SAlexandre PerrinCCSOURCE_FLAGS ?= -D_HPUX_SOURCE -D_INCLUDE_POSIX_SOURCE -D_INCLUDE_XOPEN_SOURCE -D_INCLUDE_XOPEN_SOURCE_EXTENDED 705f1e34d9SAlexandre Perrin.endif 71ca58f742SDaniel FojtCFLAGS ?= ${DBG} 72ca58f742SDaniel FojtCFLAGS+ ?= ${CCMODE} -D__hpux__ -D__HPUX_VERSION=${__HPUX_VERSION} ${CCSOURCE_FLAGS} 73ca58f742SDaniel FojtCOMPILE.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} -c 74ca58f742SDaniel FojtLINK.c ?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} 755f1e34d9SAlexandre Perrin 76ca58f742SDaniel FojtCXX ?= g++ 77ca58f742SDaniel FojtCXXFLAGS ?= ${CFLAGS} 78ca58f742SDaniel FojtCOMPILE.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c 79ca58f742SDaniel FojtLINK.cc ?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} 805f1e34d9SAlexandre Perrin 81ca58f742SDaniel FojtCPP ?= cpp 825f1e34d9SAlexandre Perrin 83ca58f742SDaniel FojtMK_DEP ?= mkdeps.sh -N 84ca58f742SDaniel FojtFC ?= f77 85ca58f742SDaniel FojtFFLAGS ?= -O 865f1e34d9SAlexandre PerrinRFLAGS= 87ca58f742SDaniel FojtCOMPILE.f ?= ${FC} ${FFLAGS} -c 88ca58f742SDaniel FojtLINK.f ?= ${FC} ${FFLAGS} ${LDFLAGS} 89ca58f742SDaniel FojtCOMPILE.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} -c 90ca58f742SDaniel FojtLINK.F ?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS} 91ca58f742SDaniel FojtCOMPILE.r ?= ${FC} ${FFLAGS} ${RFLAGS} -c 92ca58f742SDaniel FojtLINK.r ?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS} 935f1e34d9SAlexandre Perrin 94ca58f742SDaniel FojtLEX ?= lex 955f1e34d9SAlexandre PerrinLFLAGS= 96ca58f742SDaniel FojtLEX.l ?= ${LEX} ${LFLAGS} 975f1e34d9SAlexandre Perrin 98ca58f742SDaniel FojtLD ?= ld 995f1e34d9SAlexandre PerrinLDFLAGS= 1005f1e34d9SAlexandre Perrin 101ca58f742SDaniel FojtLINT ?= lint 102ca58f742SDaniel FojtLINTFLAGS ?= -chapbx 1035f1e34d9SAlexandre Perrin 104ca58f742SDaniel FojtPC ?= pc 1055f1e34d9SAlexandre PerrinPFLAGS= 106ca58f742SDaniel FojtCOMPILE.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} -c 107ca58f742SDaniel FojtLINK.p ?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS} 1085f1e34d9SAlexandre Perrin 1095f1e34d9SAlexandre Perrin# HP's sh sucks 1105f1e34d9SAlexandre PerrinENV= 111ca58f742SDaniel FojtMAKE_SHELL ?= /bin/ksh 1125f1e34d9SAlexandre Perrin 1135f1e34d9SAlexandre Perrin.if exists(/usr/local/bin/bison) 114ca58f742SDaniel FojtYACC ?= bison -y 1155f1e34d9SAlexandre Perrin.else 116ca58f742SDaniel FojtYACC ?= yacc 1175f1e34d9SAlexandre Perrin.endif 118ca58f742SDaniel FojtYFLAGS ?= -d 119ca58f742SDaniel FojtYACC.y ?= ${YACC} ${YFLAGS} 1205f1e34d9SAlexandre Perrin 1215f1e34d9SAlexandre Perrin# C 1225f1e34d9SAlexandre Perrin.c: 1235f1e34d9SAlexandre Perrin ${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 1245f1e34d9SAlexandre Perrin.c.o: 1255f1e34d9SAlexandre Perrin ${COMPILE.c} ${.IMPSRC} 1265f1e34d9SAlexandre Perrin.c.a: 1275f1e34d9SAlexandre Perrin ${COMPILE.c} ${.IMPSRC} 1285f1e34d9SAlexandre Perrin ${AR} ${ARFLAGS} $@ $*.o 1295f1e34d9SAlexandre Perrin rm -f $*.o 1305f1e34d9SAlexandre Perrin 1315f1e34d9SAlexandre Perrin# C++ 132f445c897SJohn Marino${CXX_SUFFIXES}: 1335f1e34d9SAlexandre Perrin ${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 134f445c897SJohn Marino${CXX_SUFFIXES:%=%.o}: 1355f1e34d9SAlexandre Perrin ${COMPILE.cc} ${.IMPSRC} 136f445c897SJohn Marino${CXX_SUFFIXES:%=%.a}: 1375f1e34d9SAlexandre Perrin ${COMPILE.cc} ${.IMPSRC} 1385f1e34d9SAlexandre Perrin ${AR} ${ARFLAGS} $@ $*.o 1395f1e34d9SAlexandre Perrin rm -f $*.o 1405f1e34d9SAlexandre Perrin 1415f1e34d9SAlexandre Perrin# Fortran/Ratfor 1425f1e34d9SAlexandre Perrin.f: 1435f1e34d9SAlexandre Perrin ${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 1445f1e34d9SAlexandre Perrin.f.o: 1455f1e34d9SAlexandre Perrin ${COMPILE.f} ${.IMPSRC} 1465f1e34d9SAlexandre Perrin.f.a: 1475f1e34d9SAlexandre Perrin ${COMPILE.f} ${.IMPSRC} 1485f1e34d9SAlexandre Perrin ${AR} ${ARFLAGS} $@ $*.o 1495f1e34d9SAlexandre Perrin rm -f $*.o 1505f1e34d9SAlexandre Perrin 1515f1e34d9SAlexandre Perrin.F: 1525f1e34d9SAlexandre Perrin ${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 1535f1e34d9SAlexandre Perrin.F.o: 1545f1e34d9SAlexandre Perrin ${COMPILE.F} ${.IMPSRC} 1555f1e34d9SAlexandre Perrin.F.a: 1565f1e34d9SAlexandre Perrin ${COMPILE.F} ${.IMPSRC} 1575f1e34d9SAlexandre Perrin ${AR} ${ARFLAGS} $@ $*.o 1585f1e34d9SAlexandre Perrin rm -f $*.o 1595f1e34d9SAlexandre Perrin 1605f1e34d9SAlexandre Perrin.r: 1615f1e34d9SAlexandre Perrin ${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 1625f1e34d9SAlexandre Perrin.r.o: 1635f1e34d9SAlexandre Perrin ${COMPILE.r} ${.IMPSRC} 1645f1e34d9SAlexandre Perrin.r.a: 1655f1e34d9SAlexandre Perrin ${COMPILE.r} ${.IMPSRC} 1665f1e34d9SAlexandre Perrin ${AR} ${ARFLAGS} $@ $*.o 1675f1e34d9SAlexandre Perrin rm -f $*.o 1685f1e34d9SAlexandre Perrin 1695f1e34d9SAlexandre Perrin# Pascal 1705f1e34d9SAlexandre Perrin.p: 1715f1e34d9SAlexandre Perrin ${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 1725f1e34d9SAlexandre Perrin.p.o: 1735f1e34d9SAlexandre Perrin ${COMPILE.p} ${.IMPSRC} 1745f1e34d9SAlexandre Perrin.p.a: 1755f1e34d9SAlexandre Perrin ${COMPILE.p} ${.IMPSRC} 1765f1e34d9SAlexandre Perrin ${AR} ${ARFLAGS} $@ $*.o 1775f1e34d9SAlexandre Perrin rm -f $*.o 1785f1e34d9SAlexandre Perrin 1795f1e34d9SAlexandre Perrin# Assembly 1805f1e34d9SAlexandre Perrin.s: 1815f1e34d9SAlexandre Perrin ${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 1825f1e34d9SAlexandre Perrin.s.o: 1835f1e34d9SAlexandre Perrin ${COMPILE.s} -o ${.TARGET} ${.IMPSRC} 1845f1e34d9SAlexandre Perrin.s.a: 1855f1e34d9SAlexandre Perrin ${COMPILE.s} ${.IMPSRC} 1865f1e34d9SAlexandre Perrin ${AR} ${ARFLAGS} $@ $*.o 1875f1e34d9SAlexandre Perrin rm -f $*.o 1885f1e34d9SAlexandre Perrin.S: 1895f1e34d9SAlexandre Perrin ${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS} 1905f1e34d9SAlexandre Perrin.S.o: 1915f1e34d9SAlexandre Perrin ${COMPILE.S} ${.IMPSRC} 1925f1e34d9SAlexandre Perrin.S.a: 1935f1e34d9SAlexandre Perrin ${COMPILE.S} ${.IMPSRC} 1945f1e34d9SAlexandre Perrin ${AR} ${ARFLAGS} $@ $*.o 1955f1e34d9SAlexandre Perrin rm -f $*.o 1965f1e34d9SAlexandre Perrin 1975f1e34d9SAlexandre Perrin# Lex 1985f1e34d9SAlexandre Perrin.l: 1995f1e34d9SAlexandre Perrin ${LEX.l} ${.IMPSRC} 2005f1e34d9SAlexandre Perrin ${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll 2015f1e34d9SAlexandre Perrin rm -f lex.yy.c 2025f1e34d9SAlexandre Perrin.l.c: 2035f1e34d9SAlexandre Perrin ${LEX.l} ${.IMPSRC} 2045f1e34d9SAlexandre Perrin mv lex.yy.c ${.TARGET} 2055f1e34d9SAlexandre Perrin.l.o: 2065f1e34d9SAlexandre Perrin ${LEX.l} ${.IMPSRC} 2075f1e34d9SAlexandre Perrin ${COMPILE.c} -o ${.TARGET} lex.yy.c 2085f1e34d9SAlexandre Perrin rm -f lex.yy.c 2095f1e34d9SAlexandre Perrin 2105f1e34d9SAlexandre Perrin# Yacc 2115f1e34d9SAlexandre Perrin.y: 2125f1e34d9SAlexandre Perrin ${YACC.y} ${.IMPSRC} 2135f1e34d9SAlexandre Perrin ${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS} 2145f1e34d9SAlexandre Perrin rm -f y.tab.c 2155f1e34d9SAlexandre Perrin.y.c: 2165f1e34d9SAlexandre Perrin ${YACC.y} ${.IMPSRC} 2175f1e34d9SAlexandre Perrin mv y.tab.c ${.TARGET} 2185f1e34d9SAlexandre Perrin.y.o: 2195f1e34d9SAlexandre Perrin ${YACC.y} ${.IMPSRC} 2205f1e34d9SAlexandre Perrin ${COMPILE.c} -o ${.TARGET} y.tab.c 2215f1e34d9SAlexandre Perrin rm -f y.tab.c 2225f1e34d9SAlexandre Perrin 2235f1e34d9SAlexandre Perrin# Shell 2245f1e34d9SAlexandre Perrin.sh: 2255f1e34d9SAlexandre Perrin rm -f ${.TARGET} 2265f1e34d9SAlexandre Perrin cp ${.IMPSRC} ${.TARGET} 227*6eef5f0cSAntonio Huete Jimenez chmod a+x ${.TARGET} 228