xref: /dflybsd-src/contrib/bmake/mk/sys/SunOS.mk (revision 9e7ae5a0527a977cab412aede3a532cfe2903bbb)
1*6eef5f0cSAntonio Huete Jimenez#	$Id: SunOS.mk,v 1.14 2022/03/25 23:43:06 sjg Exp $
25f1e34d9SAlexandre Perrin
35f1e34d9SAlexandre Perrin.if ${.PARSEFILE} == "sys.mk"
45f1e34d9SAlexandre Perrin.include <host-target.mk>
55f1e34d9SAlexandre Perrin
65f1e34d9SAlexandre PerrinOS ?=		SunOS.${HOST_OSMAJOR}
75f1e34d9SAlexandre Perrinunix ?=		We run ${OS}.
85f1e34d9SAlexandre Perrin.endif
95f1e34d9SAlexandre Perrin
105f1e34d9SAlexandre Perrin.if ${HOST_OSMAJOR} > 4
11ca58f742SDaniel FojtROOT_GROUP ?=	root
125f1e34d9SAlexandre Perrin
13ca58f742SDaniel FojtSHLIB_FULLVERSION  ?= ${SHLIB_MAJOR}
145f1e34d9SAlexandre Perrin
156a91b982SJohn Marino# suppress the dependency
16ca58f742SDaniel FojtLIBCRT0 ?= /dev/null
175f1e34d9SAlexandre Perrin
185f1e34d9SAlexandre Perrin.ifndef CC
195f1e34d9SAlexandre Perrin# the PATH below may find an ancient gcc
205f1e34d9SAlexandre PerrinCC := ${gcc:L:${M_whence}}
215f1e34d9SAlexandre Perrin.export CC
225f1e34d9SAlexandre Perrin.endif
235f1e34d9SAlexandre Perrin
245f1e34d9SAlexandre Perrin# the stuff in /usr/xpg4/bin is usually more sane.
25ca58f742SDaniel FojtPATH ?=/usr/xpg4/bin:/usr/sbin:/usr/bin:/usr/ucb:/usr/sfw/bin:/opt/gnu/bin:/usr/ccs/bin:/usr/local/bin
265f1e34d9SAlexandre Perrin.export PATH
275f1e34d9SAlexandre Perrin
28ca58f742SDaniel FojtDSHLIBEXT  ?= .so
29ca58f742SDaniel FojtHOST_LIBDIRS  ?= /usr/lib /lib /usr/sfw/lib
305f1e34d9SAlexandre Perrin
315f1e34d9SAlexandre Perrin# no -X
325f1e34d9SAlexandre PerrinLD_X=
335f1e34d9SAlexandre PerrinLD_x=
34ca58f742SDaniel FojtRANLIB ?=		:
35ca58f742SDaniel FojtCPP ?=		/usr/ccs/lib/cpp
365f1e34d9SAlexandre Perrin.else
37ca58f742SDaniel FojtROOT_GROUP ?=	wheel
38ca58f742SDaniel FojtRANLIB ?=		ranlib
39ca58f742SDaniel FojtCPP ?=		cpp
405f1e34d9SAlexandre Perrin.endif
415f1e34d9SAlexandre Perrin
425f1e34d9SAlexandre Perrin# the rest is common
435f1e34d9SAlexandre Perrin
44f445c897SJohn Marino.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4
455f1e34d9SAlexandre Perrin
465f1e34d9SAlexandre Perrin.LIBS:		.a
475f1e34d9SAlexandre Perrin
48ca58f742SDaniel FojtAR ?=		ar
49*6eef5f0cSAntonio Huete JimenezARFLAGS ?=	r
505f1e34d9SAlexandre Perrin
51ca58f742SDaniel FojtAS ?=		as
52ca58f742SDaniel FojtAS_STDIN ?=	-
535f1e34d9SAlexandre PerrinAFLAGS=
54ca58f742SDaniel FojtCOMPILE.s ?=	${AS} ${AFLAGS}
55ca58f742SDaniel FojtLINK.s ?=		${CC} ${AFLAGS} ${LDFLAGS}
56ca58f742SDaniel FojtCOMPILE.S ?=	${CC} ${AFLAGS} ${CPPFLAGS} -c
57ca58f742SDaniel FojtLINK.S ?=		${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
585f1e34d9SAlexandre Perrin.if exists(/opt/gnu/bin/gcc) || exists(/usr/local/bin/gcc)
595f1e34d9SAlexandre PerrinCC ?=		gcc -pipe
60ca58f742SDaniel FojtDBG ?=		-O -g
61ca58f742SDaniel FojtSTATIC ?=		-static
625f1e34d9SAlexandre Perrin.else
635f1e34d9SAlexandre PerrinCC ?=             cc
64ca58f742SDaniel FojtDBG ?=         -g
65ca58f742SDaniel FojtSTATIC ?=         -Bstatic
665f1e34d9SAlexandre Perrin.endif
67ca58f742SDaniel FojtCFLAGS ?=		${DBG}
68ca58f742SDaniel FojtCOMPILE.c ?=	${CC} ${CFLAGS} ${CPPFLAGS} -c
69ca58f742SDaniel FojtLINK.c ?=		${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
705f1e34d9SAlexandre Perrin
71ca58f742SDaniel FojtCXX ?=		g++
72ca58f742SDaniel FojtCXXFLAGS ?=	${CFLAGS}
73ca58f742SDaniel FojtCOMPILE.cc ?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
74ca58f742SDaniel FojtLINK.cc ?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
755f1e34d9SAlexandre Perrin
765f1e34d9SAlexandre Perrin.if defined(DESTDIR)
775f1e34d9SAlexandre PerrinCPPFLAGS+=	-nostdinc -idirafter ${DESTDIR}/usr/include
785f1e34d9SAlexandre Perrin.endif
795f1e34d9SAlexandre Perrin
80ca58f742SDaniel FojtMK_DEP ?=	mkdeps.sh -N
81ca58f742SDaniel FojtFC ?=		f77
82ca58f742SDaniel FojtFFLAGS ?=		-O
835f1e34d9SAlexandre PerrinRFLAGS=
84ca58f742SDaniel FojtCOMPILE.f ?=	${FC} ${FFLAGS} -c
85ca58f742SDaniel FojtLINK.f ?=		${FC} ${FFLAGS} ${LDFLAGS}
86ca58f742SDaniel FojtCOMPILE.F ?=	${FC} ${FFLAGS} ${CPPFLAGS} -c
87ca58f742SDaniel FojtLINK.F ?=		${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
88ca58f742SDaniel FojtCOMPILE.r ?=	${FC} ${FFLAGS} ${RFLAGS} -c
89ca58f742SDaniel FojtLINK.r ?=		${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
905f1e34d9SAlexandre Perrin
91ca58f742SDaniel FojtLEX ?=		lex
925f1e34d9SAlexandre PerrinLFLAGS=
93ca58f742SDaniel FojtLEX.l ?=		${LEX} ${LFLAGS}
945f1e34d9SAlexandre Perrin
95ca58f742SDaniel FojtLD ?=		ld
965f1e34d9SAlexandre PerrinLDFLAGS=
975f1e34d9SAlexandre Perrin
98ca58f742SDaniel FojtLINT ?=		lint
99ca58f742SDaniel FojtLINTFLAGS ?=	-chapbx
1005f1e34d9SAlexandre Perrin
101ca58f742SDaniel FojtPC ?=		pc
1025f1e34d9SAlexandre PerrinPFLAGS=
103ca58f742SDaniel FojtCOMPILE.p ?=	${PC} ${PFLAGS} ${CPPFLAGS} -c
104ca58f742SDaniel FojtLINK.p ?=		${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
1055f1e34d9SAlexandre Perrin
1065f1e34d9SAlexandre Perrin.if exists(/usr/local/bin/bison) || exists(/opt/gnu/bin/bison)
107ca58f742SDaniel FojtYACC ?=		bison -y
1085f1e34d9SAlexandre Perrin.else
109ca58f742SDaniel FojtYACC ?=		yacc
1105f1e34d9SAlexandre Perrin.endif
111ca58f742SDaniel FojtYFLAGS ?=		-d
112ca58f742SDaniel FojtYACC.y ?=		${YACC} ${YFLAGS}
1135f1e34d9SAlexandre Perrin
1145f1e34d9SAlexandre Perrin# C
1155f1e34d9SAlexandre Perrin.c:
1165f1e34d9SAlexandre Perrin	${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1175f1e34d9SAlexandre Perrin.c.o:
1185f1e34d9SAlexandre Perrin	${COMPILE.c} ${.IMPSRC}
1195f1e34d9SAlexandre Perrin.c.a:
1205f1e34d9SAlexandre Perrin	${COMPILE.c} ${.IMPSRC}
1215f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1225f1e34d9SAlexandre Perrin	rm -f $*.o
1235f1e34d9SAlexandre Perrin
1245f1e34d9SAlexandre Perrin# C++
125f445c897SJohn Marino${CXX_SUFFIXES}:
1265f1e34d9SAlexandre Perrin	${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
127f445c897SJohn Marino${CXX_SUFFIXES:%=%.o}:
1285f1e34d9SAlexandre Perrin	${COMPILE.cc} ${.IMPSRC}
129f445c897SJohn Marino${CXX_SUFFIXES:%=%.a}:
1305f1e34d9SAlexandre Perrin	${COMPILE.cc} ${.IMPSRC}
1315f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1325f1e34d9SAlexandre Perrin	rm -f $*.o
1335f1e34d9SAlexandre Perrin
1345f1e34d9SAlexandre Perrin# Fortran/Ratfor
1355f1e34d9SAlexandre Perrin.f:
1365f1e34d9SAlexandre Perrin	${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1375f1e34d9SAlexandre Perrin.f.o:
1385f1e34d9SAlexandre Perrin	${COMPILE.f} ${.IMPSRC}
1395f1e34d9SAlexandre Perrin.f.a:
1405f1e34d9SAlexandre Perrin	${COMPILE.f} ${.IMPSRC}
1415f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1425f1e34d9SAlexandre Perrin	rm -f $*.o
1435f1e34d9SAlexandre Perrin
1445f1e34d9SAlexandre Perrin.F:
1455f1e34d9SAlexandre Perrin	${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1465f1e34d9SAlexandre Perrin.F.o:
1475f1e34d9SAlexandre Perrin	${COMPILE.F} ${.IMPSRC}
1485f1e34d9SAlexandre Perrin.F.a:
1495f1e34d9SAlexandre Perrin	${COMPILE.F} ${.IMPSRC}
1505f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1515f1e34d9SAlexandre Perrin	rm -f $*.o
1525f1e34d9SAlexandre Perrin
1535f1e34d9SAlexandre Perrin.r:
1545f1e34d9SAlexandre Perrin	${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1555f1e34d9SAlexandre Perrin.r.o:
1565f1e34d9SAlexandre Perrin	${COMPILE.r} ${.IMPSRC}
1575f1e34d9SAlexandre Perrin.r.a:
1585f1e34d9SAlexandre Perrin	${COMPILE.r} ${.IMPSRC}
1595f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1605f1e34d9SAlexandre Perrin	rm -f $*.o
1615f1e34d9SAlexandre Perrin
1625f1e34d9SAlexandre Perrin# Pascal
1635f1e34d9SAlexandre Perrin.p:
1645f1e34d9SAlexandre Perrin	${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1655f1e34d9SAlexandre Perrin.p.o:
1665f1e34d9SAlexandre Perrin	${COMPILE.p} ${.IMPSRC}
1675f1e34d9SAlexandre Perrin.p.a:
1685f1e34d9SAlexandre Perrin	${COMPILE.p} ${.IMPSRC}
1695f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1705f1e34d9SAlexandre Perrin	rm -f $*.o
1715f1e34d9SAlexandre Perrin
1725f1e34d9SAlexandre Perrin# Assembly
1735f1e34d9SAlexandre Perrin.s:
1745f1e34d9SAlexandre Perrin	${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1755f1e34d9SAlexandre Perrin.s.o:
1765f1e34d9SAlexandre Perrin	${COMPILE.s} ${.IMPSRC}
1775f1e34d9SAlexandre Perrin.s.a:
1785f1e34d9SAlexandre Perrin	${COMPILE.s} ${.IMPSRC}
1795f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1805f1e34d9SAlexandre Perrin	rm -f $*.o
1815f1e34d9SAlexandre Perrin.S:
1825f1e34d9SAlexandre Perrin	${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1835f1e34d9SAlexandre Perrin.S.o:
1845f1e34d9SAlexandre Perrin	${COMPILE.S} ${.IMPSRC}
1855f1e34d9SAlexandre Perrin.S.a:
1865f1e34d9SAlexandre Perrin	${COMPILE.S} ${.IMPSRC}
1875f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1885f1e34d9SAlexandre Perrin	rm -f $*.o
1895f1e34d9SAlexandre Perrin
1905f1e34d9SAlexandre Perrin# Lex
1915f1e34d9SAlexandre Perrin.l:
1925f1e34d9SAlexandre Perrin	${LEX.l} ${.IMPSRC}
1935f1e34d9SAlexandre Perrin	${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
1945f1e34d9SAlexandre Perrin	rm -f lex.yy.c
1955f1e34d9SAlexandre Perrin.l.c:
1965f1e34d9SAlexandre Perrin	${LEX.l} ${.IMPSRC}
1975f1e34d9SAlexandre Perrin	mv lex.yy.c ${.TARGET}
1985f1e34d9SAlexandre Perrin.l.o:
1995f1e34d9SAlexandre Perrin	${LEX.l} ${.IMPSRC}
2005f1e34d9SAlexandre Perrin	${COMPILE.c} -o ${.TARGET} lex.yy.c
2015f1e34d9SAlexandre Perrin	rm -f lex.yy.c
2025f1e34d9SAlexandre Perrin
2035f1e34d9SAlexandre Perrin# Yacc
2045f1e34d9SAlexandre Perrin.y:
2055f1e34d9SAlexandre Perrin	${YACC.y} ${.IMPSRC}
2065f1e34d9SAlexandre Perrin	${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
2075f1e34d9SAlexandre Perrin	rm -f y.tab.c
2085f1e34d9SAlexandre Perrin.y.c:
2095f1e34d9SAlexandre Perrin	${YACC.y} ${.IMPSRC}
2105f1e34d9SAlexandre Perrin	mv y.tab.c ${.TARGET}
2115f1e34d9SAlexandre Perrin.y.o:
2125f1e34d9SAlexandre Perrin	${YACC.y} ${.IMPSRC}
2135f1e34d9SAlexandre Perrin	${COMPILE.c} -o ${.TARGET} y.tab.c
2145f1e34d9SAlexandre Perrin	rm -f y.tab.c
2155f1e34d9SAlexandre Perrin
2165f1e34d9SAlexandre Perrin# Shell
2175f1e34d9SAlexandre Perrin.sh:
2185f1e34d9SAlexandre Perrin	rm -f ${.TARGET}
2195f1e34d9SAlexandre Perrin	cp ${.IMPSRC} ${.TARGET}
220*6eef5f0cSAntonio Huete Jimenez	chmod a+x ${.TARGET}
221