[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.3, Tue Sep 17 23:18:29 2002 UTC (21 years, 7 months ago) by thorpej
Branch: MAIN
CVS Tags: fvdl_fs64_base
Changes since 1.2: +2 -2 lines

* Eliminate the USE_NEW_TOOLCHAIN variable.  Instead, split it into
  two variables:

  TOOLCHAIN_MISSING -- set to "yes" on platforms for which there is
  no working in-tree toolchain (hppa, ns32k, sh5, x86_64).

  EXTERNAL_TOOLCHAIN -- if defined by the user, points to the root of
  an external toolchain (e.g. /usr/local/gnu).  This enables the cross-build
  framework even for TOOLCHAIN_MISSING platforms.

  If TOOLCHAIN_MISSING is set to "yes", MKGDB, MKBFD, and MKGCC are all
  unconditionally set to "no", since the bits are not there to build.

  If EXTERNAL_TOOLCHAIN is set, MKGCC is unconditionally set to "no",
  since the external toolchain's compiler is not in-sync with the
  in-tree compiler support components (e.g. libgcc).

* Set MACHINE_CPU much earlier in bsd.own.mk, so that more tests in
  that file can use it.

#	$NetBSD: bsd.hostlib.mk,v 1.3 2002/09/17 23:18:29 thorpej 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 ${TOOLCHAIN_MISSING} != "yes" || defined(EXTERNAL_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