2004-06-10 04:29:58 +04:00
|
|
|
# $NetBSD: bsd.hostlib.mk,v 1.14 2004/06/10 00:29:58 lukem Exp $
|
2001-11-28 07:42:49 +03:00
|
|
|
|
|
|
|
.include <bsd.init.mk>
|
|
|
|
.include <bsd.sys.mk>
|
|
|
|
|
|
|
|
##### Basic targets
|
|
|
|
clean: cleanlib
|
|
|
|
|
|
|
|
##### Default values
|
|
|
|
CFLAGS+= ${COPTS}
|
2002-01-04 01:45:23 +03:00
|
|
|
HOST_MKDEP?= CC=${HOST_CC:Q} mkdep
|
2003-11-11 14:43:45 +03:00
|
|
|
MKDEP_SUFFIXES?= .o .lo
|
2001-11-28 07:42:49 +03:00
|
|
|
|
|
|
|
# Override these:
|
2002-01-04 01:45:23 +03:00
|
|
|
MKDEP:= ${HOST_MKDEP}
|
2001-11-28 07:42:49 +03:00
|
|
|
|
2004-01-02 19:12:36 +03:00
|
|
|
.if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)
|
2001-11-28 07:42:49 +03:00
|
|
|
OBJHOSTMACHINE= # set
|
|
|
|
.endif
|
|
|
|
|
|
|
|
##### Build rules
|
|
|
|
.if defined(HOSTLIB)
|
2004-06-10 04:29:58 +04:00
|
|
|
_YHLSRCS= ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}
|
|
|
|
DPSRCS+= ${_YHLSRCS}
|
|
|
|
CLEANFILES+= ${_YHLSRCS}
|
2001-11-28 07:42:49 +03:00
|
|
|
.endif # defined(HOSTLIB)
|
|
|
|
|
|
|
|
.if !empty(SRCS:N*.h:N*.sh)
|
|
|
|
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if defined(OBJS) && !empty(OBJS)
|
2004-06-10 04:29:58 +04:00
|
|
|
.NOPATH: ${OBJS} ${HOSTPROG} ${_YHLSRCS}
|
2001-11-28 07:42:49 +03:00
|
|
|
|
2003-08-01 21:03:41 +04:00
|
|
|
${OBJS}: ${DPSRCS}
|
|
|
|
|
|
|
|
lib${HOSTLIB}.a: ${OBJS} ${DPADD}
|
2003-10-21 14:01:19 +04:00
|
|
|
${_MKTARGET_BUILD}
|
2003-10-18 19:33:59 +04:00
|
|
|
rm -f ${.TARGET}
|
2001-11-28 07:42:49 +03:00
|
|
|
${HOST_AR} cq ${.TARGET} ${OBJS}
|
2003-10-18 19:33:59 +04:00
|
|
|
${HOST_RANLIB} ${.TARGET}
|
2001-11-28 07:42:49 +03:00
|
|
|
|
|
|
|
.endif # defined(OBJS) && !empty(OBJS)
|
|
|
|
|
|
|
|
realall: lib${HOSTLIB}.a
|
|
|
|
|
2004-01-29 04:48:45 +03:00
|
|
|
cleanlib: .PHONY
|
2001-11-28 07:42:49 +03:00
|
|
|
rm -f a.out [Ee]rrs mklog core *.core \
|
|
|
|
lib${HOSTLIB}.a ${OBJS} ${CLEANFILES}
|
|
|
|
|
|
|
|
beforedepend:
|
|
|
|
CFLAGS:= ${HOST_CFLAGS}
|
|
|
|
CPPFLAGS:= ${HOST_CPPFLAGS}
|
|
|
|
|
|
|
|
##### Pull in related .mk logic
|
|
|
|
.include <bsd.obj.mk>
|
2003-07-31 17:47:32 +04:00
|
|
|
.include <bsd.dep.mk>
|
2001-11-28 07:42:49 +03:00
|
|
|
|
|
|
|
${TARGETS}: # ensure existence
|