xref: /minix3/share/mk/bsd.hostlib.mk (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc#	$NetBSD: bsd.hostlib.mk,v 1.19 2014/12/01 01:34:30 erh Exp $
2be9962e2SThomas Veerman
3be9962e2SThomas Veerman.include <bsd.init.mk>
4be9962e2SThomas Veerman.include <bsd.sys.mk>
5be9962e2SThomas Veerman
6be9962e2SThomas Veerman##### Basic targets
7be9962e2SThomas Veerman
8be9962e2SThomas Veerman##### Default values
9be9962e2SThomas VeermanCFLAGS+=	${COPTS}
10*0a6a1f1dSLionel SambucMKDEP_SUFFIXES?=	.o .lo .d
11be9962e2SThomas Veerman
12be9962e2SThomas Veerman# Override these:
13be9962e2SThomas VeermanMKDEP:=		${HOST_MKDEP}
1484d9c625SLionel SambucMKDEPCXX:=	${HOST_MKDEPCXX}
15be9962e2SThomas Veerman
16be9962e2SThomas Veerman.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)
17be9962e2SThomas VeermanOBJHOSTMACHINE=	# set
18be9962e2SThomas Veerman.endif
19be9962e2SThomas Veerman
20be9962e2SThomas Veerman##### Build rules
21be9962e2SThomas Veerman.if defined(HOSTLIB)
22be9962e2SThomas Veerman_YHLSRCS=	${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
23be9962e2SThomas VeermanDPSRCS+=	${_YHLSRCS}
24be9962e2SThomas VeermanCLEANFILES+=	${_YHLSRCS}
25be9962e2SThomas Veerman.endif	# defined(HOSTLIB)
26be9962e2SThomas Veerman
27be9962e2SThomas Veerman.if !empty(SRCS:N*.h:N*.sh)
28be9962e2SThomas VeermanOBJS+=		${SRCS:N*.h:N*.sh:R:S/$/.lo/g}
29be9962e2SThomas Veerman.endif
30be9962e2SThomas Veerman
31be9962e2SThomas Veerman.if defined(OBJS) && !empty(OBJS)
32be9962e2SThomas Veerman.NOPATH: lib${HOSTLIB}.a ${OBJS} ${_YHLSRCS}
33be9962e2SThomas Veerman
34be9962e2SThomas Veerman${OBJS}: ${DPSRCS}
35be9962e2SThomas Veerman
36be9962e2SThomas Veermanlib${HOSTLIB}.a: ${OBJS} ${DPADD}
37be9962e2SThomas Veerman	${_MKTARGET_BUILD}
38be9962e2SThomas Veerman	rm -f ${.TARGET}
39be9962e2SThomas Veerman	${HOST_AR} cq ${.TARGET} ${OBJS}
40be9962e2SThomas Veerman	${HOST_RANLIB} ${.TARGET}
41be9962e2SThomas Veerman
42be9962e2SThomas Veerman.endif	# defined(OBJS) && !empty(OBJS)
43be9962e2SThomas Veerman
44be9962e2SThomas Veermanrealall: lib${HOSTLIB}.a
45be9962e2SThomas Veerman
46be9962e2SThomas VeermanCLEANFILES+= a.out [Ee]rrs mklog core *.core lib${HOSTLIB}.a ${OBJS}
47be9962e2SThomas Veerman
48be9962e2SThomas Veermanbeforedepend:
49be9962e2SThomas VeermanCFLAGS:=	${HOST_CFLAGS}
50be9962e2SThomas VeermanCPPFLAGS:=	${HOST_CPPFLAGS}
51be9962e2SThomas Veerman
52be9962e2SThomas Veerman##### Pull in related .mk logic
53be9962e2SThomas Veerman.include <bsd.obj.mk>
54be9962e2SThomas Veerman.include <bsd.dep.mk>
55be9962e2SThomas Veerman.include <bsd.clean.mk>
56be9962e2SThomas Veerman
57be9962e2SThomas Veerman${TARGETS}:	# ensure existence
58