xref: /freebsd/contrib/bmake/mk/sys/Linux.mk (revision 3f0164abf32b9b761e0a2cb4bdca3a8b84f156d4)
1#	$Id: Linux.mk,v 1.7 2011/03/02 05:05:21 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?=		Linux
6unix?=		We run ${OS}.
7
8ROOT_GROUP=	root
9
10# would be better to work out where it is...
11LIBCRT0= /dev/null
12
13NEED_SOLINKS=yes
14
15.SUFFIXES: .out .a .ln .o .c .cc .C .F .f .r .y .l .s .S .cl .p .h .sh .m4
16
17.LIBS:		.a
18
19AR=		ar
20ARFLAGS=	rl
21RANLIB=		ranlib
22
23AS=		as
24AFLAGS=
25COMPILE.s=	${AS} ${AFLAGS}
26LINK.s=		${CC} ${AFLAGS} ${LDFLAGS}
27COMPILE.S=	${CC} ${AFLAGS} ${CPPFLAGS} -c
28LINK.S=		${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
29.if exists(/usr/local/bin/gcc)
30CC=		gcc -pipe
31DBG=		-O -g
32STATIC?=		-static
33.else
34CC=             cc -pipe
35DBG=         -g
36STATIC=         -Bstatic
37.endif
38CFLAGS=		${DBG}
39COMPILE.c=	${CC} ${CFLAGS} ${CPPFLAGS} -c
40LINK.c=		${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
41
42CXX=		g++
43CXXFLAGS=	${CFLAGS}
44COMPILE.cc=	${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
45LINK.cc=	${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
46
47CPP=		cpp
48.if defined(DESTDIR)
49CPPFLAGS+=	-nostdinc -idirafter ${DESTDIR}/usr/include
50.endif
51
52MK_DEP=	mkdeps.sh -N
53FC=		f77
54FFLAGS=		-O
55RFLAGS=
56COMPILE.f=	${FC} ${FFLAGS} -c
57LINK.f=		${FC} ${FFLAGS} ${LDFLAGS}
58COMPILE.F=	${FC} ${FFLAGS} ${CPPFLAGS} -c
59LINK.F=		${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
60COMPILE.r=	${FC} ${FFLAGS} ${RFLAGS} -c
61LINK.r=		${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
62
63LEX=		lex
64LFLAGS=
65LEX.l=		${LEX} ${LFLAGS}
66
67LD=		ld
68LDFLAGS=
69
70LINT=		lint
71LINTFLAGS=	-chapbx
72
73MAKE=		bmake
74
75PC=		pc
76PFLAGS=
77COMPILE.p=	${PC} ${PFLAGS} ${CPPFLAGS} -c
78LINK.p=		${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
79
80SHELL=		sh
81
82YACC=		yacc
83YFLAGS=		-d
84YACC.y=		${YACC} ${YFLAGS}
85
86# C
87.c:
88	${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
89.c.o:
90	${COMPILE.c} ${.IMPSRC}
91.c.a:
92	${COMPILE.c} ${.IMPSRC}
93	${AR} ${ARFLAGS} $@ $*.o
94	rm -f $*.o
95
96# C++
97.cc:
98	${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
99.cc.o:
100	${COMPILE.cc} ${.IMPSRC}
101.cc.a:
102	${COMPILE.cc} ${.IMPSRC}
103	${AR} ${ARFLAGS} $@ $*.o
104	rm -f $*.o
105
106.C:
107	${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
108.C.o:
109	${COMPILE.cc} ${.IMPSRC}
110.C.a:
111	${COMPILE.cc} ${.IMPSRC}
112	${AR} ${ARFLAGS} $@ $*.o
113	rm -f $*.o
114
115# Fortran/Ratfor
116.f:
117	${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
118.f.o:
119	${COMPILE.f} ${.IMPSRC}
120.f.a:
121	${COMPILE.f} ${.IMPSRC}
122	${AR} ${ARFLAGS} $@ $*.o
123	rm -f $*.o
124
125.F:
126	${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
127.F.o:
128	${COMPILE.F} ${.IMPSRC}
129.F.a:
130	${COMPILE.F} ${.IMPSRC}
131	${AR} ${ARFLAGS} $@ $*.o
132	rm -f $*.o
133
134.r:
135	${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
136.r.o:
137	${COMPILE.r} ${.IMPSRC}
138.r.a:
139	${COMPILE.r} ${.IMPSRC}
140	${AR} ${ARFLAGS} $@ $*.o
141	rm -f $*.o
142
143# Pascal
144.p:
145	${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
146.p.o:
147	${COMPILE.p} ${.IMPSRC}
148.p.a:
149	${COMPILE.p} ${.IMPSRC}
150	${AR} ${ARFLAGS} $@ $*.o
151	rm -f $*.o
152
153# Assembly
154.s:
155	${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
156.s.o:
157	${COMPILE.s} -o ${.TARGET} ${.IMPSRC}
158.s.a:
159	${COMPILE.s} ${.IMPSRC}
160	${AR} ${ARFLAGS} $@ $*.o
161	rm -f $*.o
162.S:
163	${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
164.S.o:
165	${COMPILE.S} ${.IMPSRC}
166.S.a:
167	${COMPILE.S} ${.IMPSRC}
168	${AR} ${ARFLAGS} $@ $*.o
169	rm -f $*.o
170
171# Lex
172.l:
173	${LEX.l} ${.IMPSRC}
174	${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
175	rm -f lex.yy.c
176.l.c:
177	${LEX.l} ${.IMPSRC}
178	mv lex.yy.c ${.TARGET}
179.l.o:
180	${LEX.l} ${.IMPSRC}
181	${COMPILE.c} -o ${.TARGET} lex.yy.c
182	rm -f lex.yy.c
183
184# Yacc
185.y:
186	${YACC.y} ${.IMPSRC}
187	${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
188	rm -f y.tab.c
189.y.c:
190	${YACC.y} ${.IMPSRC}
191	mv y.tab.c ${.TARGET}
192.y.o:
193	${YACC.y} ${.IMPSRC}
194	${COMPILE.c} -o ${.TARGET} y.tab.c
195	rm -f y.tab.c
196
197# Shell
198.sh:
199	rm -f ${.TARGET}
200	cp ${.IMPSRC} ${.TARGET}
201