xref: /dragonfly/contrib/bmake/mk/sys/Linux.mk (revision 6eef5f0c)
1*6eef5f0cSAntonio Huete Jimenez#	$Id: Linux.mk,v 1.16 2022/09/09 17:44:29 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
55f1e34d9SAlexandre PerrinOS ?=		Linux
65f1e34d9SAlexandre Perrinunix ?=		We run ${OS}.
75f1e34d9SAlexandre Perrin
8ca58f742SDaniel FojtROOT_GROUP ?=	root
95f1e34d9SAlexandre Perrin
105f1e34d9SAlexandre Perrin# would be better to work out where it is...
11ca58f742SDaniel FojtLIBCRT0 ?= /dev/null
125f1e34d9SAlexandre Perrin
13ca58f742SDaniel FojtNEED_SOLINKS ?=yes
145f1e34d9SAlexandre Perrin
15f445c897SJohn Marino.SUFFIXES: .out .a .ln .o .c ${CXX_SUFFIXES} .F .f .r .y .l .s .S .cl .p .h .sh .m4
165f1e34d9SAlexandre Perrin
175f1e34d9SAlexandre Perrin.LIBS:		.a
185f1e34d9SAlexandre Perrin
19ca58f742SDaniel FojtAR ?=		ar
20*6eef5f0cSAntonio Huete JimenezARFLAGS ?=	r
21ca58f742SDaniel FojtRANLIB ?=		ranlib
225f1e34d9SAlexandre Perrin
23ca58f742SDaniel FojtAS ?=		as
245f1e34d9SAlexandre PerrinAFLAGS=
25ca58f742SDaniel FojtCOMPILE.s ?=	${AS} ${AFLAGS}
26ca58f742SDaniel FojtLINK.s ?=		${CC} ${AFLAGS} ${LDFLAGS}
27ca58f742SDaniel FojtCOMPILE.S ?=	${CC} ${AFLAGS} ${CPPFLAGS} -c
28ca58f742SDaniel FojtLINK.S ?=		${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
295f1e34d9SAlexandre Perrin.if exists(/usr/local/bin/gcc)
30ca58f742SDaniel FojtCC ?=		gcc -pipe
31ca58f742SDaniel FojtDBG ?=		-O -g
325f1e34d9SAlexandre PerrinSTATIC ?=		-static
335f1e34d9SAlexandre Perrin.else
34ca58f742SDaniel FojtCC ?=             cc -pipe
35ca58f742SDaniel FojtDBG ?=         -g
36ca58f742SDaniel FojtSTATIC ?=         -Bstatic
375f1e34d9SAlexandre Perrin.endif
38ca58f742SDaniel FojtCFLAGS ?=		${DBG}
39ca58f742SDaniel FojtCOMPILE.c ?=	${CC} ${CFLAGS} ${CPPFLAGS} -c
40ca58f742SDaniel FojtLINK.c ?=		${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
415f1e34d9SAlexandre Perrin
42ca58f742SDaniel FojtCXX ?=		g++
43ca58f742SDaniel FojtCXXFLAGS ?=	${CFLAGS}
44ca58f742SDaniel FojtCOMPILE.cc ?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
45ca58f742SDaniel FojtLINK.cc ?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
465f1e34d9SAlexandre Perrin
47ca58f742SDaniel FojtCPP ?=		cpp
485f1e34d9SAlexandre Perrin.if defined(DESTDIR)
495f1e34d9SAlexandre PerrinCPPFLAGS+=	-nostdinc -idirafter ${DESTDIR}/usr/include
505f1e34d9SAlexandre Perrin.endif
515f1e34d9SAlexandre Perrin
52ca58f742SDaniel FojtMK_DEP ?=	mkdeps.sh -N
53ca58f742SDaniel FojtFC ?=		f77
54ca58f742SDaniel FojtFFLAGS ?=		-O
555f1e34d9SAlexandre PerrinRFLAGS=
56ca58f742SDaniel FojtCOMPILE.f ?=	${FC} ${FFLAGS} -c
57ca58f742SDaniel FojtLINK.f ?=		${FC} ${FFLAGS} ${LDFLAGS}
58ca58f742SDaniel FojtCOMPILE.F ?=	${FC} ${FFLAGS} ${CPPFLAGS} -c
59ca58f742SDaniel FojtLINK.F ?=		${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
60ca58f742SDaniel FojtCOMPILE.r ?=	${FC} ${FFLAGS} ${RFLAGS} -c
61ca58f742SDaniel FojtLINK.r ?=		${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
625f1e34d9SAlexandre Perrin
63ca58f742SDaniel FojtLEX ?=		lex
645f1e34d9SAlexandre PerrinLFLAGS=
65ca58f742SDaniel FojtLEX.l ?=		${LEX} ${LFLAGS}
665f1e34d9SAlexandre Perrin
67ca58f742SDaniel FojtLD ?=		ld
685f1e34d9SAlexandre PerrinLDFLAGS=
695f1e34d9SAlexandre Perrin
70ca58f742SDaniel FojtLINT ?=		lint
71ca58f742SDaniel FojtLINTFLAGS ?=	-chapbx
725f1e34d9SAlexandre Perrin
73ca58f742SDaniel FojtPC ?=		pc
745f1e34d9SAlexandre PerrinPFLAGS=
75ca58f742SDaniel FojtCOMPILE.p ?=	${PC} ${PFLAGS} ${CPPFLAGS} -c
76ca58f742SDaniel FojtLINK.p ?=		${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
775f1e34d9SAlexandre Perrin
78ca58f742SDaniel FojtYACC ?=		yacc
79ca58f742SDaniel FojtYFLAGS ?=		-d
80ca58f742SDaniel FojtYACC.y ?=		${YACC} ${YFLAGS}
815f1e34d9SAlexandre Perrin
825f1e34d9SAlexandre Perrin# C
835f1e34d9SAlexandre Perrin.c:
845f1e34d9SAlexandre Perrin	${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
855f1e34d9SAlexandre Perrin.c.o:
865f1e34d9SAlexandre Perrin	${COMPILE.c} ${.IMPSRC}
875f1e34d9SAlexandre Perrin.c.a:
885f1e34d9SAlexandre Perrin	${COMPILE.c} ${.IMPSRC}
895f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
905f1e34d9SAlexandre Perrin	rm -f $*.o
915f1e34d9SAlexandre Perrin
925f1e34d9SAlexandre Perrin# C++
93f445c897SJohn Marino${CXX_SUFFIXES}:
945f1e34d9SAlexandre Perrin	${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
95f445c897SJohn Marino${CXX_SUFFIXES:%=%.o}:
965f1e34d9SAlexandre Perrin	${COMPILE.cc} ${.IMPSRC}
97f445c897SJohn Marino${CXX_SUFFIXES:%=%.a}:
985f1e34d9SAlexandre Perrin	${COMPILE.cc} ${.IMPSRC}
995f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1005f1e34d9SAlexandre Perrin	rm -f $*.o
1015f1e34d9SAlexandre Perrin
1025f1e34d9SAlexandre Perrin# Fortran/Ratfor
1035f1e34d9SAlexandre Perrin.f:
1045f1e34d9SAlexandre Perrin	${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1055f1e34d9SAlexandre Perrin.f.o:
1065f1e34d9SAlexandre Perrin	${COMPILE.f} ${.IMPSRC}
1075f1e34d9SAlexandre Perrin.f.a:
1085f1e34d9SAlexandre Perrin	${COMPILE.f} ${.IMPSRC}
1095f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1105f1e34d9SAlexandre Perrin	rm -f $*.o
1115f1e34d9SAlexandre Perrin
1125f1e34d9SAlexandre Perrin.F:
1135f1e34d9SAlexandre Perrin	${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1145f1e34d9SAlexandre Perrin.F.o:
1155f1e34d9SAlexandre Perrin	${COMPILE.F} ${.IMPSRC}
1165f1e34d9SAlexandre Perrin.F.a:
1175f1e34d9SAlexandre Perrin	${COMPILE.F} ${.IMPSRC}
1185f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1195f1e34d9SAlexandre Perrin	rm -f $*.o
1205f1e34d9SAlexandre Perrin
1215f1e34d9SAlexandre Perrin.r:
1225f1e34d9SAlexandre Perrin	${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1235f1e34d9SAlexandre Perrin.r.o:
1245f1e34d9SAlexandre Perrin	${COMPILE.r} ${.IMPSRC}
1255f1e34d9SAlexandre Perrin.r.a:
1265f1e34d9SAlexandre Perrin	${COMPILE.r} ${.IMPSRC}
1275f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1285f1e34d9SAlexandre Perrin	rm -f $*.o
1295f1e34d9SAlexandre Perrin
1305f1e34d9SAlexandre Perrin# Pascal
1315f1e34d9SAlexandre Perrin.p:
1325f1e34d9SAlexandre Perrin	${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1335f1e34d9SAlexandre Perrin.p.o:
1345f1e34d9SAlexandre Perrin	${COMPILE.p} ${.IMPSRC}
1355f1e34d9SAlexandre Perrin.p.a:
1365f1e34d9SAlexandre Perrin	${COMPILE.p} ${.IMPSRC}
1375f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1385f1e34d9SAlexandre Perrin	rm -f $*.o
1395f1e34d9SAlexandre Perrin
1405f1e34d9SAlexandre Perrin# Assembly
1415f1e34d9SAlexandre Perrin.s:
1425f1e34d9SAlexandre Perrin	${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1435f1e34d9SAlexandre Perrin.s.o:
1445f1e34d9SAlexandre Perrin	${COMPILE.s} -o ${.TARGET} ${.IMPSRC}
1455f1e34d9SAlexandre Perrin.s.a:
1465f1e34d9SAlexandre Perrin	${COMPILE.s} ${.IMPSRC}
1475f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1485f1e34d9SAlexandre Perrin	rm -f $*.o
1495f1e34d9SAlexandre Perrin.S:
1505f1e34d9SAlexandre Perrin	${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
1515f1e34d9SAlexandre Perrin.S.o:
1525f1e34d9SAlexandre Perrin	${COMPILE.S} ${.IMPSRC}
1535f1e34d9SAlexandre Perrin.S.a:
1545f1e34d9SAlexandre Perrin	${COMPILE.S} ${.IMPSRC}
1555f1e34d9SAlexandre Perrin	${AR} ${ARFLAGS} $@ $*.o
1565f1e34d9SAlexandre Perrin	rm -f $*.o
1575f1e34d9SAlexandre Perrin
1585f1e34d9SAlexandre Perrin# Lex
1595f1e34d9SAlexandre Perrin.l:
1605f1e34d9SAlexandre Perrin	${LEX.l} ${.IMPSRC}
1615f1e34d9SAlexandre Perrin	${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
1625f1e34d9SAlexandre Perrin	rm -f lex.yy.c
1635f1e34d9SAlexandre Perrin.l.c:
1645f1e34d9SAlexandre Perrin	${LEX.l} ${.IMPSRC}
1655f1e34d9SAlexandre Perrin	mv lex.yy.c ${.TARGET}
1665f1e34d9SAlexandre Perrin.l.o:
1675f1e34d9SAlexandre Perrin	${LEX.l} ${.IMPSRC}
1685f1e34d9SAlexandre Perrin	${COMPILE.c} -o ${.TARGET} lex.yy.c
1695f1e34d9SAlexandre Perrin	rm -f lex.yy.c
1705f1e34d9SAlexandre Perrin
1715f1e34d9SAlexandre Perrin# Yacc
1725f1e34d9SAlexandre Perrin.y:
1735f1e34d9SAlexandre Perrin	${YACC.y} ${.IMPSRC}
1745f1e34d9SAlexandre Perrin	${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
1755f1e34d9SAlexandre Perrin	rm -f y.tab.c
1765f1e34d9SAlexandre Perrin.y.c:
1775f1e34d9SAlexandre Perrin	${YACC.y} ${.IMPSRC}
1785f1e34d9SAlexandre Perrin	mv y.tab.c ${.TARGET}
1795f1e34d9SAlexandre Perrin.y.o:
1805f1e34d9SAlexandre Perrin	${YACC.y} ${.IMPSRC}
1815f1e34d9SAlexandre Perrin	${COMPILE.c} -o ${.TARGET} y.tab.c
1825f1e34d9SAlexandre Perrin	rm -f y.tab.c
1835f1e34d9SAlexandre Perrin
1845f1e34d9SAlexandre Perrin# Shell
1855f1e34d9SAlexandre Perrin.sh:
1865f1e34d9SAlexandre Perrin	rm -f ${.TARGET}
1875f1e34d9SAlexandre Perrin	cp ${.IMPSRC} ${.TARGET}
188*6eef5f0cSAntonio Huete Jimenez	chmod a+x ${.TARGET}
189*6eef5f0cSAntonio Huete Jimenez
190*6eef5f0cSAntonio Huete Jimenez
191*6eef5f0cSAntonio Huete Jimenez# egrep is deprecated
192*6eef5f0cSAntonio Huete JimenezEGREP = grep -E
193