xref: /freebsd/contrib/bmake/mk/sys/Darwin.mk (revision 8bab661a3316d8bd9b9fbd11a3b4371b91507bd2)
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 .m ${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 ?=	r
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
27PIPE ?=		-pipe
28
29.if exists(/usr/bin/clang)
30CC ?=		cc ${PIPE}
31CXX ?=		c++
32.elif exists(/usr/bin/gcc)
33CC ?=		gcc ${PIPE}
34.else
35CC ?=		cc ${PIPE}
36.endif
37DBG ?=		-O2
38CFLAGS ?=	${DBG}
39COMPILE.c ?=	${CC} ${CFLAGS} ${CPPFLAGS} -c
40LINK.c ?=	${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
41
42.if exists(/usr/bin/g++)
43CXX ?=		g++
44.else
45CXX ?=		c++
46.endif
47CXXFLAGS ?=	${CFLAGS}
48COMPILE.cc ?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
49LINK.cc ?=	${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
50
51OBJC ?=		${CC}
52OBJCFLAGS ?=	${CFLAGS}
53COMPILE.m ?=	${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
54LINK.m ?=	${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
55
56CPP ?=		cpp
57NOLINT ?=		1
58CPPFLAGS ?=
59
60MK_DEP ?=	mkdep
61
62FC ?=		f77
63FFLAGS ?=	-O
64RFLAGS ?=
65COMPILE.f ?=	${FC} ${FFLAGS} -c
66LINK.f ?=	${FC} ${FFLAGS} ${LDFLAGS}
67COMPILE.F ?=	${FC} ${FFLAGS} ${CPPFLAGS} -c
68LINK.F ?=	${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
69COMPILE.r ?=	${FC} ${FFLAGS} ${RFLAGS} -c
70LINK.r ?=	${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
71
72INSTALL ?=	install
73
74LEX ?=		lex
75LFLAGS ?=
76LEX.l ?=		${LEX} ${LFLAGS}
77
78LD ?=		ld
79LDFLAGS ?=
80
81SHLIB_TEENY  ?= 0
82SHLIB_MINOR  ?= 0
83
84MKPICLIB  ?= no
85LIBEXT  ?= .dylib
86
87LINT ?=		lint
88LINTFLAGS ?=	-chapbx
89
90LORDER ?=	lorder
91
92NM ?=		nm
93
94PC ?=		pc
95PFLAGS ?=
96COMPILE.p ?=	${PC} ${PFLAGS} ${CPPFLAGS} -c
97LINK.p ?=	${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
98
99SIZE ?=		size
100
101TSORT ?=		tsort -q
102
103YACC ?=		bison -y
104YFLAGS ?=	-d
105YACC.y ?=	${YACC} ${YFLAGS}
106
107# C
108.c:
109	${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
110.c.o:
111	${COMPILE.c} ${.IMPSRC}
112.c.a:
113	${COMPILE.c} ${.IMPSRC}
114	${AR} ${ARFLAGS} $@ $*.o
115	rm -f $*.o
116
117# C++
118${CXX_SUFFIXES}:
119	${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
120${CXX_SUFFIXES:%=%.o}:
121	${COMPILE.cc} ${.IMPSRC}
122${CXX_SUFFIXES:%=%.a}:
123	${COMPILE.cc} ${.IMPSRC}
124	${AR} ${ARFLAGS} $@ $*.o
125	rm -f $*.o
126
127# Objective-C
128.m:
129	${LINK.m} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
130.m.o:
131	${COMPILE.m} ${.IMPSRC}
132.m.a:
133	${COMPILE.m} ${.IMPSRC}
134	${AR} ${ARFLAGS} $@ $*.o
135	rm -f $*.o
136
137# Fortran/Ratfor
138.f:
139	${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
140.f.o:
141	${COMPILE.f} ${.IMPSRC}
142.f.a:
143	${COMPILE.f} ${.IMPSRC}
144	${AR} ${ARFLAGS} $@ $*.o
145	rm -f $*.o
146
147.F:
148	${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
149.F.o:
150	${COMPILE.F} ${.IMPSRC}
151.F.a:
152	${COMPILE.F} ${.IMPSRC}
153	${AR} ${ARFLAGS} $@ $*.o
154	rm -f $*.o
155
156.r:
157	${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
158.r.o:
159	${COMPILE.r} ${.IMPSRC}
160.r.a:
161	${COMPILE.r} ${.IMPSRC}
162	${AR} ${ARFLAGS} $@ $*.o
163	rm -f $*.o
164
165# Pascal
166.p:
167	${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
168.p.o:
169	${COMPILE.p} ${.IMPSRC}
170.p.a:
171	${COMPILE.p} ${.IMPSRC}
172	${AR} ${ARFLAGS} $@ $*.o
173	rm -f $*.o
174
175# Assembly
176.s:
177	${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
178.s.o:
179	${COMPILE.s} -o ${.TARGET} ${.IMPSRC}
180.s.a:
181	${COMPILE.s} ${.IMPSRC}
182	${AR} ${ARFLAGS} $@ $*.o
183	rm -f $*.o
184.S:
185	${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
186.S.o:
187	${COMPILE.S} ${.IMPSRC}
188.S.a:
189	${COMPILE.S} ${.IMPSRC}
190	${AR} ${ARFLAGS} $@ $*.o
191	rm -f $*.o
192
193# Lex
194.l:
195	${LEX.l} ${.IMPSRC}
196	${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
197	rm -f lex.yy.c
198.l.c:
199	${LEX.l} ${.IMPSRC}
200	mv lex.yy.c ${.TARGET}
201.l.o:
202	${LEX.l} ${.IMPSRC}
203	${COMPILE.c} -o ${.TARGET} lex.yy.c
204	rm -f lex.yy.c
205
206# Yacc
207.y:
208	${YACC.y} ${.IMPSRC}
209	${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
210	rm -f y.tab.c
211.y.c:
212	${YACC.y} ${.IMPSRC}
213	mv y.tab.c ${.TARGET}
214.y.o:
215	${YACC.y} ${.IMPSRC}
216	${COMPILE.c} -o ${.TARGET} y.tab.c
217	rm -f y.tab.c
218
219# Shell
220.sh:
221	rm -f ${.TARGET}
222	cp ${.IMPSRC} ${.TARGET}
223	chmod a+x ${.TARGET}
224