[BACK]Return to bsd.hostlib.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / share / mk

File: [cvs.NetBSD.org] / src / share / mk / bsd.hostlib.mk (download)

Revision 1.2, Thu Jan 3 22:45:25 2002 UTC (18 years ago) by tv
Branch: MAIN
CVS Tags: netbsd-1-6-base, netbsd-1-6-RELEASE, netbsd-1-6-RC3, netbsd-1-6-RC2, netbsd-1-6-RC1, netbsd-1-6-PATCH002-RELEASE, netbsd-1-6-PATCH002-RC4, netbsd-1-6-PATCH002-RC3, netbsd-1-6-PATCH002-RC2, netbsd-1-6-PATCH002-RC1, netbsd-1-6-PATCH002, netbsd-1-6-PATCH001-RELEASE, netbsd-1-6-PATCH001-RC3, netbsd-1-6-PATCH001-RC2, netbsd-1-6-PATCH001-RC1, netbsd-1-6-PATCH001, netbsd-1-6
Changes since 1.1: +3 -2 lines

Add more tolerant script-based implementation of mkdep for host tool
compiles.  Based loosely on mkdep.old.compiler (so CSRG license copied),
but now uses just one rewrite (awk) process per cpp invocation and
determines the proper way to run cpp and awk via a "configure" script.

Use HOST_MKDEP in bsd.hostlib/hostprog.mk (defaulting to the old override
value of MKDEP), and give it a TOOLDIR equivalent in bsd.own.mk.

#	$NetBSD: bsd.hostlib.mk,v 1.2 2002/01/03 22:45:25 tv Exp $

.include <bsd.init.mk>
.include <bsd.sys.mk>

##### Basic targets
.PHONY:		cleanlib
clean:		cleanlib

##### Default values
CFLAGS+=	${COPTS}
HOST_MKDEP?=	CC=${HOST_CC:Q} mkdep

# Override these:
MKDEP:=		${HOST_MKDEP}

.if defined(USE_NEW_TOOLCHAIN)
OBJHOSTMACHINE=	# set
.endif

##### Build rules
.if defined(HOSTLIB)
DPSRCS+=	${SRCS:M*.[ly]:C/\..$/.c/}
CLEANFILES+=	${DPSRCS} ${YHEADER:D${SRCS:M*.y:.y=.h}}
.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)
.NOPATH: ${OBJS} ${HOSTPROG} ${SRCS:M*.[ly]:C/\..$/.c/} ${YHEADER:D${SRCS:M*.y:.y=.h}}

lib${HOSTLIB}.a: ${DPSRCS} ${OBJS} ${DPADD}
	-rm -f ${.TARGET}
	${HOST_AR} cq ${.TARGET} ${OBJS}
	@${HOST_RANLIB} ${.TARGET}

.endif	# defined(OBJS) && !empty(OBJS)

realall: lib${HOSTLIB}.a

cleanlib:
	rm -f a.out [Ee]rrs mklog core *.core \
	    lib${HOSTLIB}.a ${OBJS} ${CLEANFILES}

beforedepend:
CFLAGS:=	${HOST_CFLAGS}
CPPFLAGS:=	${HOST_CPPFLAGS}

.if defined(SRCS)
afterdepend: .depend
	@(TMP=/tmp/_depend$$$$; \
	    sed -e 's/^\([^\.]*\).o[ ]*:/\1.lo:/' \
	      < .depend > $$TMP; \
	    mv $$TMP .depend)
.endif

##### Pull in related .mk logic
.include <bsd.dep.mk>
.include <bsd.obj.mk>

${TARGETS}:	# ensure existence