xref: /freebsd/contrib/bmake/mk/sys/Darwin.mk (revision 907b59d76938e654f0d040a888e8dfca3de1e222)
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
87MAKE?=		bmake
88
89NM?=		nm
90
91PC?=		pc
92PFLAGS?=
93COMPILE.p?=	${PC} ${PFLAGS} ${CPPFLAGS} -c
94LINK.p?=	${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
95
96SHELL?=		sh
97
98SIZE?=		size
99
100TSORT?=		tsort -q
101
102YACC?=		bison -y
103YFLAGS?=	-d
104YACC.y?=	${YACC} ${YFLAGS}
105
106# C
107.c:
108	${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
109.c.o:
110	${COMPILE.c} ${.IMPSRC}
111.c.a:
112	${COMPILE.c} ${.IMPSRC}
113	${AR} ${ARFLAGS} $@ $*.o
114	rm -f $*.o
115
116# C++
117${CXX_SUFFIXES}:
118	${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
119${CXX_SUFFIXES:%=%.o}:
120	${COMPILE.cc} ${.IMPSRC}
121${CXX_SUFFIXES:%=%.a}:
122	${COMPILE.cc} ${.IMPSRC}
123	${AR} ${ARFLAGS} $@ $*.o
124	rm -f $*.o
125
126# Fortran/Ratfor
127.f:
128	${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
129.f.o:
130	${COMPILE.f} ${.IMPSRC}
131.f.a:
132	${COMPILE.f} ${.IMPSRC}
133	${AR} ${ARFLAGS} $@ $*.o
134	rm -f $*.o
135
136.F:
137	${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
138.F.o:
139	${COMPILE.F} ${.IMPSRC}
140.F.a:
141	${COMPILE.F} ${.IMPSRC}
142	${AR} ${ARFLAGS} $@ $*.o
143	rm -f $*.o
144
145.r:
146	${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
147.r.o:
148	${COMPILE.r} ${.IMPSRC}
149.r.a:
150	${COMPILE.r} ${.IMPSRC}
151	${AR} ${ARFLAGS} $@ $*.o
152	rm -f $*.o
153
154# Pascal
155.p:
156	${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
157.p.o:
158	${COMPILE.p} ${.IMPSRC}
159.p.a:
160	${COMPILE.p} ${.IMPSRC}
161	${AR} ${ARFLAGS} $@ $*.o
162	rm -f $*.o
163
164# Assembly
165.s:
166	${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
167.s.o:
168	${COMPILE.s} -o ${.TARGET} ${.IMPSRC}
169.s.a:
170	${COMPILE.s} ${.IMPSRC}
171	${AR} ${ARFLAGS} $@ $*.o
172	rm -f $*.o
173.S:
174	${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
175.S.o:
176	${COMPILE.S} ${.IMPSRC}
177.S.a:
178	${COMPILE.S} ${.IMPSRC}
179	${AR} ${ARFLAGS} $@ $*.o
180	rm -f $*.o
181
182# Lex
183.l:
184	${LEX.l} ${.IMPSRC}
185	${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
186	rm -f lex.yy.c
187.l.c:
188	${LEX.l} ${.IMPSRC}
189	mv lex.yy.c ${.TARGET}
190.l.o:
191	${LEX.l} ${.IMPSRC}
192	${COMPILE.c} -o ${.TARGET} lex.yy.c
193	rm -f lex.yy.c
194
195# Yacc
196.y:
197	${YACC.y} ${.IMPSRC}
198	${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
199	rm -f y.tab.c
200.y.c:
201	${YACC.y} ${.IMPSRC}
202	mv y.tab.c ${.TARGET}
203.y.o:
204	${YACC.y} ${.IMPSRC}
205	${COMPILE.c} -o ${.TARGET} y.tab.c
206	rm -f y.tab.c
207
208# Shell
209.sh:
210	rm -f ${.TARGET}
211	cp ${.IMPSRC} ${.TARGET}
212