xref: /freebsd/contrib/bmake/mk/sys/Darwin.mk (revision f6a3b357e9be4c6423c85eff9a847163a0d307c8)
1#	$NetBSD: Darwin.sys.mk,v 1.3 2003/02/16 09:44:41 grant Exp $
2#	@(#)sys.mk	8.2 (Berkeley) 3/21/94
3
4OS=		Darwin
5unix?=		We run ${OS}.
6
7.SUFFIXES: .out .a .ln .o .s .S .c ${CXX_SUFFIXES} .F .f .r .y .l .cl .p .h
8.SUFFIXES: .sh .m4 .dylib
9
10.LIBS:		.a .dylib
11
12SHLIBEXT =	.dylib
13HOST_LIBEXT =	.dylib
14DSHLIBEXT =	.dylib
15
16AR?=		ar
17ARFLAGS?=	rl
18RANLIB =
19
20AS?=		as
21AFLAGS?=
22COMPILE.s?=	${AS} ${AFLAGS}
23LINK.s?=	${CC} ${AFLAGS} ${LDFLAGS}
24COMPILE.S?=	${CC} ${AFLAGS} ${CPPFLAGS} -c
25LINK.S?=	${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
26
27.if exists(/usr/bin/gcc)
28CC?=		gcc -pipe
29.else
30CC?=		cc -pipe
31.endif
32DBG?=		-O2
33CFLAGS?=	${DBG}
34COMPILE.c?=	${CC} ${CFLAGS} ${CPPFLAGS} -c
35LINK.c?=	${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
36
37.if exists(/usr/bin/g++)
38CXX?=		g++
39.else
40CXX?=		c++
41.endif
42CXXFLAGS?=	${CFLAGS}
43COMPILE.cc?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
44LINK.cc?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
45
46OBJC?=		${CC}
47OBJCFLAGS?=	${CFLAGS}
48COMPILE.m?=	${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
49LINK.m?=	${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
50
51CPP?=		cpp
52NOLINT=		1
53CPPFLAGS?=
54
55MK_DEP?=	mkdeps.sh -N
56
57FC?=		f77
58FFLAGS?=	-O
59RFLAGS?=
60COMPILE.f?=	${FC} ${FFLAGS} -c
61LINK.f?=	${FC} ${FFLAGS} ${LDFLAGS}
62COMPILE.F?=	${FC} ${FFLAGS} ${CPPFLAGS} -c
63LINK.F?=	${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
64COMPILE.r?=	${FC} ${FFLAGS} ${RFLAGS} -c
65LINK.r?=	${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
66
67INSTALL?=	install
68
69LEX?=		lex
70LFLAGS?=
71LEX.l?=		${LEX} ${LFLAGS}
72
73LD?=		ld
74LDFLAGS?=
75
76SHLIB_TEENY = 0
77SHLIB_MINOR = 0
78
79MKPICLIB = no
80LIBEXT = .dylib
81
82LINT?=		lint
83LINTFLAGS?=	-chapbx
84
85LORDER?=	lorder
86
87NM?=		nm
88
89PC?=		pc
90PFLAGS?=
91COMPILE.p?=	${PC} ${PFLAGS} ${CPPFLAGS} -c
92LINK.p?=	${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
93
94SHELL?=		sh
95
96SIZE?=		size
97
98TSORT?=		tsort -q
99
100YACC?=		bison -y
101YFLAGS?=	-d
102YACC.y?=	${YACC} ${YFLAGS}
103
104# C
105.c:
106	${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
107.c.o:
108	${COMPILE.c} ${.IMPSRC}
109.c.a:
110	${COMPILE.c} ${.IMPSRC}
111	${AR} ${ARFLAGS} $@ $*.o
112	rm -f $*.o
113
114# C++
115${CXX_SUFFIXES}:
116	${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
117${CXX_SUFFIXES:%=%.o}:
118	${COMPILE.cc} ${.IMPSRC}
119${CXX_SUFFIXES:%=%.a}:
120	${COMPILE.cc} ${.IMPSRC}
121	${AR} ${ARFLAGS} $@ $*.o
122	rm -f $*.o
123
124# Fortran/Ratfor
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.F:
135	${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
136.F.o:
137	${COMPILE.F} ${.IMPSRC}
138.F.a:
139	${COMPILE.F} ${.IMPSRC}
140	${AR} ${ARFLAGS} $@ $*.o
141	rm -f $*.o
142
143.r:
144	${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
145.r.o:
146	${COMPILE.r} ${.IMPSRC}
147.r.a:
148	${COMPILE.r} ${.IMPSRC}
149	${AR} ${ARFLAGS} $@ $*.o
150	rm -f $*.o
151
152# Pascal
153.p:
154	${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
155.p.o:
156	${COMPILE.p} ${.IMPSRC}
157.p.a:
158	${COMPILE.p} ${.IMPSRC}
159	${AR} ${ARFLAGS} $@ $*.o
160	rm -f $*.o
161
162# Assembly
163.s:
164	${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
165.s.o:
166	${COMPILE.s} -o ${.TARGET} ${.IMPSRC}
167.s.a:
168	${COMPILE.s} ${.IMPSRC}
169	${AR} ${ARFLAGS} $@ $*.o
170	rm -f $*.o
171.S:
172	${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
173.S.o:
174	${COMPILE.S} ${.IMPSRC}
175.S.a:
176	${COMPILE.S} ${.IMPSRC}
177	${AR} ${ARFLAGS} $@ $*.o
178	rm -f $*.o
179
180# Lex
181.l:
182	${LEX.l} ${.IMPSRC}
183	${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
184	rm -f lex.yy.c
185.l.c:
186	${LEX.l} ${.IMPSRC}
187	mv lex.yy.c ${.TARGET}
188.l.o:
189	${LEX.l} ${.IMPSRC}
190	${COMPILE.c} -o ${.TARGET} lex.yy.c
191	rm -f lex.yy.c
192
193# Yacc
194.y:
195	${YACC.y} ${.IMPSRC}
196	${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
197	rm -f y.tab.c
198.y.c:
199	${YACC.y} ${.IMPSRC}
200	mv y.tab.c ${.TARGET}
201.y.o:
202	${YACC.y} ${.IMPSRC}
203	${COMPILE.c} -o ${.TARGET} y.tab.c
204	rm -f y.tab.c
205
206# Shell
207.sh:
208	rm -f ${.TARGET}
209	cp ${.IMPSRC} ${.TARGET}
210