xref: /dflybsd-src/contrib/bmake/mk/sys/OpenBSD.mk (revision 9e7ae5a0527a977cab412aede3a532cfe2903bbb)
15f1e34d9SAlexandre Perrin#	$NetBSD: OpenBSD.sys.mk,v 1.1 2002/11/17 09:18:00 cjep Exp $
25f1e34d9SAlexandre Perrin#	@(#)sys.mk	8.2 (Berkeley) 3/21/94
35f1e34d9SAlexandre Perrin
4ca58f742SDaniel FojtOS ?=		OpenBSD
55f1e34d9SAlexandre Perrinunix ?=		We run ${OS}.
65f1e34d9SAlexandre Perrin
7f445c897SJohn Marino.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h
85f1e34d9SAlexandre Perrin.SUFFIXES: .sh .m4
95f1e34d9SAlexandre Perrin
105f1e34d9SAlexandre Perrin.LIBS:		.a
115f1e34d9SAlexandre Perrin
125f1e34d9SAlexandre Perrin# need to make sure this is set
135f1e34d9SAlexandre PerrinMACHINE_ARCH.${MACHINE} ?= ${MACHINE}
145f1e34d9SAlexandre Perrin.if empty(MACHINE_ARCH)
15ca58f742SDaniel FojtMACHINE_ARCH  ?= ${MACHINE_ARCH.${MACHINE}}
165f1e34d9SAlexandre Perrin.endif
175f1e34d9SAlexandre Perrin
185f1e34d9SAlexandre PerrinAR ?=		ar
19*6eef5f0cSAntonio Huete JimenezARFLAGS ?=	r
205f1e34d9SAlexandre PerrinRANLIB ?=	ranlib
215f1e34d9SAlexandre Perrin
225f1e34d9SAlexandre PerrinAS ?=		as
235f1e34d9SAlexandre PerrinAFLAGS ?=
245f1e34d9SAlexandre Perrin.if ${MACHINE_ARCH} == "sparc64"
255f1e34d9SAlexandre PerrinAFLAGS+= -Wa,-Av9a
265f1e34d9SAlexandre Perrin.endif
275f1e34d9SAlexandre PerrinCOMPILE.s ?=	${CC} ${AFLAGS} -c
285f1e34d9SAlexandre PerrinLINK.s ?=	${CC} ${AFLAGS} ${LDFLAGS}
295f1e34d9SAlexandre PerrinCOMPILE.S ?=	${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
305f1e34d9SAlexandre PerrinLINK.S ?=	${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
315f1e34d9SAlexandre Perrin
325f1e34d9SAlexandre PerrinCC ?=		cc
335f1e34d9SAlexandre Perrin.if ${MACHINE_ARCH} == "alpha" || \
345f1e34d9SAlexandre Perrin    ${MACHINE_ARCH} == "i386" || \
355f1e34d9SAlexandre Perrin    ${MACHINE_ARCH} == "m68k" || \
365f1e34d9SAlexandre Perrin    ${MACHINE_ARCH} == "sparc" || \
375f1e34d9SAlexandre Perrin    ${MACHINE_ARCH} == "vax"
385f1e34d9SAlexandre PerrinDBG ?=	-O2
395f1e34d9SAlexandre Perrin.else
405f1e34d9SAlexandre PerrinDBG ?=	-O
415f1e34d9SAlexandre Perrin.endif
425f1e34d9SAlexandre PerrinCFLAGS ?=	${DBG}
435f1e34d9SAlexandre PerrinCOMPILE.c ?=	${CC} ${CFLAGS} ${CPPFLAGS} -c
445f1e34d9SAlexandre PerrinLINK.c ?=	${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
455f1e34d9SAlexandre Perrin
465f1e34d9SAlexandre PerrinCXX ?=		c++
475f1e34d9SAlexandre PerrinCXXFLAGS ?=	${CFLAGS}
485f1e34d9SAlexandre PerrinCOMPILE.cc ?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
495f1e34d9SAlexandre PerrinLINK.cc ?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
505f1e34d9SAlexandre Perrin
515f1e34d9SAlexandre PerrinOBJC ?=		${CC}
525f1e34d9SAlexandre PerrinOBJCFLAGS ?=	${CFLAGS}
535f1e34d9SAlexandre PerrinCOMPILE.m ?=	${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
545f1e34d9SAlexandre PerrinLINK.m ?=	${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
555f1e34d9SAlexandre Perrin
565f1e34d9SAlexandre PerrinCPP ?=		cpp
575f1e34d9SAlexandre PerrinCPPFLAGS ?=
585f1e34d9SAlexandre Perrin
595f1e34d9SAlexandre PerrinFC ?=		f77
605f1e34d9SAlexandre PerrinFFLAGS ?=	-O
615f1e34d9SAlexandre PerrinRFLAGS ?=
625f1e34d9SAlexandre PerrinCOMPILE.f ?=	${FC} ${FFLAGS} -c
635f1e34d9SAlexandre PerrinLINK.f ?=	${FC} ${FFLAGS} ${LDFLAGS}
645f1e34d9SAlexandre PerrinCOMPILE.F ?=	${FC} ${FFLAGS} ${CPPFLAGS} -c
655f1e34d9SAlexandre PerrinLINK.F ?=	${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
665f1e34d9SAlexandre PerrinCOMPILE.r ?=	${FC} ${FFLAGS} ${RFLAGS} -c
675f1e34d9SAlexandre PerrinLINK.r ?=	${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
685f1e34d9SAlexandre Perrin
695f1e34d9SAlexandre PerrinINSTALL ?=	install
705f1e34d9SAlexandre Perrin
715f1e34d9SAlexandre PerrinLEX ?=		lex
725f1e34d9SAlexandre PerrinLFLAGS ?=
735f1e34d9SAlexandre PerrinLEX.l ?=		${LEX} ${LFLAGS}
745f1e34d9SAlexandre Perrin
755f1e34d9SAlexandre PerrinLD ?=		ld
765f1e34d9SAlexandre PerrinLDFLAGS ?=
775f1e34d9SAlexandre Perrin
785f1e34d9SAlexandre PerrinLINT ?=		lint
795f1e34d9SAlexandre PerrinLINTFLAGS ?=	-chapbxzF
805f1e34d9SAlexandre Perrin
815f1e34d9SAlexandre PerrinLORDER ?=	lorder
825f1e34d9SAlexandre Perrin
835f1e34d9SAlexandre PerrinNM ?=		nm
845f1e34d9SAlexandre Perrin
855f1e34d9SAlexandre PerrinPC ?=		pc
865f1e34d9SAlexandre PerrinPFLAGS ?=
875f1e34d9SAlexandre PerrinCOMPILE.p ?=	${PC} ${PFLAGS} ${CPPFLAGS} -c
885f1e34d9SAlexandre PerrinLINK.p ?=	${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
895f1e34d9SAlexandre Perrin
905f1e34d9SAlexandre PerrinSIZE ?=		size
915f1e34d9SAlexandre Perrin
925f1e34d9SAlexandre PerrinTSORT ?= 	tsort -q
935f1e34d9SAlexandre Perrin
945f1e34d9SAlexandre PerrinYACC ?=		yacc
955f1e34d9SAlexandre PerrinYFLAGS ?=
965f1e34d9SAlexandre PerrinYACC.y ?=	${YACC} ${YFLAGS}
975f1e34d9SAlexandre Perrin
985f1e34d9SAlexandre Perrin# C
995f1e34d9SAlexandre Perrin.c:
1005f1e34d9SAlexandre Perrin	${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1015f1e34d9SAlexandre Perrin.c.o:
1025f1e34d9SAlexandre Perrin	${COMPILE.c} ${.IMPSRC}
1035f1e34d9SAlexandre Perrin.c.a:
1045f1e34d9SAlexandre Perrin	${COMPILE.c} ${.IMPSRC}
1055f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1065f1e34d9SAlexandre Perrin	rm -f $*.o
1075f1e34d9SAlexandre Perrin.c.ln:
1085f1e34d9SAlexandre Perrin	${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
1095f1e34d9SAlexandre Perrin
1105f1e34d9SAlexandre Perrin# C++
111f445c897SJohn Marino${CXX_SUFFIXES}:
1125f1e34d9SAlexandre Perrin	${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
113f445c897SJohn Marino${CXX_SUFFIXES:%=%.o}:
1145f1e34d9SAlexandre Perrin	${COMPILE.cc} ${.IMPSRC}
115f445c897SJohn Marino${CXX_SUFFIXES:%=%.a}:
1165f1e34d9SAlexandre Perrin	${COMPILE.cc} ${.IMPSRC}
1175f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1185f1e34d9SAlexandre Perrin	rm -f $*.o
1195f1e34d9SAlexandre Perrin
1205f1e34d9SAlexandre Perrin# Fortran/Ratfor
1215f1e34d9SAlexandre Perrin.f:
1225f1e34d9SAlexandre Perrin	${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1235f1e34d9SAlexandre Perrin.f.o:
1245f1e34d9SAlexandre Perrin	${COMPILE.f} ${.IMPSRC}
1255f1e34d9SAlexandre Perrin.f.a:
1265f1e34d9SAlexandre Perrin	${COMPILE.f} ${.IMPSRC}
1275f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1285f1e34d9SAlexandre Perrin	rm -f $*.o
1295f1e34d9SAlexandre Perrin
1305f1e34d9SAlexandre Perrin.F:
1315f1e34d9SAlexandre Perrin	${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1325f1e34d9SAlexandre Perrin.F.o:
1335f1e34d9SAlexandre Perrin	${COMPILE.F} ${.IMPSRC}
1345f1e34d9SAlexandre Perrin.F.a:
1355f1e34d9SAlexandre Perrin	${COMPILE.F} ${.IMPSRC}
1365f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1375f1e34d9SAlexandre Perrin	rm -f $*.o
1385f1e34d9SAlexandre Perrin
1395f1e34d9SAlexandre Perrin.r:
1405f1e34d9SAlexandre Perrin	${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1415f1e34d9SAlexandre Perrin.r.o:
1425f1e34d9SAlexandre Perrin	${COMPILE.r} ${.IMPSRC}
1435f1e34d9SAlexandre Perrin.r.a:
1445f1e34d9SAlexandre Perrin	${COMPILE.r} ${.IMPSRC}
1455f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1465f1e34d9SAlexandre Perrin	rm -f $*.o
1475f1e34d9SAlexandre Perrin
1485f1e34d9SAlexandre Perrin# Pascal
1495f1e34d9SAlexandre Perrin.p:
1505f1e34d9SAlexandre Perrin	${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1515f1e34d9SAlexandre Perrin.p.o:
1525f1e34d9SAlexandre Perrin	${COMPILE.p} ${.IMPSRC}
1535f1e34d9SAlexandre Perrin.p.a:
1545f1e34d9SAlexandre Perrin	${COMPILE.p} ${.IMPSRC}
1555f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1565f1e34d9SAlexandre Perrin	rm -f $*.o
1575f1e34d9SAlexandre Perrin
1585f1e34d9SAlexandre Perrin# Assembly
1595f1e34d9SAlexandre Perrin.s:
1605f1e34d9SAlexandre Perrin	${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1615f1e34d9SAlexandre Perrin.s.o:
1625f1e34d9SAlexandre Perrin	${COMPILE.s} ${.IMPSRC}
1635f1e34d9SAlexandre Perrin.s.a:
1645f1e34d9SAlexandre Perrin	${COMPILE.s} ${.IMPSRC}
1655f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1665f1e34d9SAlexandre Perrin	rm -f $*.o
1675f1e34d9SAlexandre Perrin.S:
1685f1e34d9SAlexandre Perrin	${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1695f1e34d9SAlexandre Perrin.S.o:
1705f1e34d9SAlexandre Perrin	${COMPILE.S} ${.IMPSRC}
1715f1e34d9SAlexandre Perrin.S.a:
1725f1e34d9SAlexandre Perrin	${COMPILE.S} ${.IMPSRC}
1735f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1745f1e34d9SAlexandre Perrin	rm -f $*.o
1755f1e34d9SAlexandre Perrin
1765f1e34d9SAlexandre Perrin# Lex
1775f1e34d9SAlexandre Perrin.l:
1785f1e34d9SAlexandre Perrin	${LEX.l} ${.IMPSRC}
1795f1e34d9SAlexandre Perrin	${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
1805f1e34d9SAlexandre Perrin	rm -f lex.yy.c
1815f1e34d9SAlexandre Perrin.l.c:
1825f1e34d9SAlexandre Perrin	${LEX.l} ${.IMPSRC}
1835f1e34d9SAlexandre Perrin	mv lex.yy.c ${.TARGET}
1845f1e34d9SAlexandre Perrin.l.o:
1855f1e34d9SAlexandre Perrin	${LEX.l} ${.IMPSRC}
1865f1e34d9SAlexandre Perrin	${COMPILE.c} -o ${.TARGET} lex.yy.c
1875f1e34d9SAlexandre Perrin	rm -f lex.yy.c
1885f1e34d9SAlexandre Perrin
1895f1e34d9SAlexandre Perrin# Yacc
1905f1e34d9SAlexandre Perrin.y:
1915f1e34d9SAlexandre Perrin	${YACC.y} ${.IMPSRC}
1925f1e34d9SAlexandre Perrin	${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
1935f1e34d9SAlexandre Perrin	rm -f y.tab.c
1945f1e34d9SAlexandre Perrin.y.c:
1955f1e34d9SAlexandre Perrin	${YACC.y} ${.IMPSRC}
1965f1e34d9SAlexandre Perrin	mv y.tab.c ${.TARGET}
1975f1e34d9SAlexandre Perrin.y.o:
1985f1e34d9SAlexandre Perrin	${YACC.y} ${.IMPSRC}
1995f1e34d9SAlexandre Perrin	${COMPILE.c} -o ${.TARGET} y.tab.c
2005f1e34d9SAlexandre Perrin	rm -f y.tab.c
2015f1e34d9SAlexandre Perrin
2025f1e34d9SAlexandre Perrin# Shell
2035f1e34d9SAlexandre Perrin.sh:
2045f1e34d9SAlexandre Perrin	rm -f ${.TARGET}
2055f1e34d9SAlexandre Perrin	cp ${.IMPSRC} ${.TARGET}
206*6eef5f0cSAntonio Huete Jimenez	chmod a+x ${.TARGET}
207