Home | History | Download | only in tools
      1 #	$NetBSD: Makefile.host,v 1.23 2003/11/16 18:06:01 dsl Exp $
      2 
      3 NOLINT=		# defined
      4 NOMAN=		# defined
      5 
      6 .include <bsd.own.mk>
      7 
      8 .ifndef NOCOMPATLIB
      9 COMPATOBJ!=	cd ${.CURDIR}/../compat && ${PRINTOBJDIR}
     10 .-include	"${COMPATOBJ}/defs.mk"
     11 .endif
     12 
     13 # Resolve pathnames in variables.
     14 _RESOLVE_VARS=	CFLAGS CPPFLAGS DPADD HOST_CPPFLAGS LDADD
     15 .for var in ${_RESOLVE_VARS}
     16 ${var}:=	${${var}}
     17 .endfor
     18 
     19 # Switch over to the "real" Makefile.
     20 .PROGDIR:=	${.CURDIR}/../../${HOST_SRCDIR}
     21 _CURDIR:=	${.CURDIR}
     22 HOSTPROG?=	${PROG}
     23 
     24 .CURDIR:=	${.PROGDIR}
     25 .PATH:		${.CURDIR}
     26 .include "${.CURDIR}/Makefile"
     27 .-include "${.CURDIR}/../Makefile.inc"
     28 
     29 # Resolve pathnames from "real" Makefile, and switch .CURDIR back.
     30 .for var in ${_RESOLVE_VARS}
     31 ${var}:=	${${var}}
     32 .endfor
     33 .CURDIR:=	${_CURDIR}
     34 .undef		_CURDIR
     35 
     36 # Set up the environment for <bsd.hostprog.mk>.
     37 .if ${USETOOLS} != "yes"
     38 .undef HOSTPROG
     39 .endif
     40 
     41 HOSTPROGNAME?=	${HOSTPROG}
     42 HOST_BINDIR?=	${TOOLDIR}/bin
     43 HOST_CPPFLAGS:=	${HOST_CPPFLAGS} ${CPPFLAGS}
     44 .undef LINKS
     45 
     46 SRCS?=		${HOSTPROG}.c
     47 SRCS+=		${HOST_SRCS}
     48 
     49 .PATH:		${.PROGDIR}
     50 
     51 # Install rule.
     52 realinstall: install.host install.files
     53 install.host: ${HOST_BINDIR}/${HOSTPROGNAME}
     54 ${HOST_BINDIR}/${HOSTPROGNAME}:: ${HOSTPROG}
     55 	${_MKTARGET_INSTALL}
     56 	mkdir -p ${HOST_BINDIR}
     57 	${HOST_INSTALL_FILE} -m ${BINMODE} ${HOSTPROG}${HOSTEXEEXT} ${.TARGET}
     58 
     59 .if ${MKUPDATE} == "no"
     60 .PHONY:		${HOST_BINDIR}/${HOSTPROGNAME}
     61 .endif
     62 
     63 install.files:
     64 .for F in ${HOSTFILES}
     65 install.files: ${HOST_FILESDIR}/${F}
     66 ${HOST_FILESDIR}/${F}: ${F}
     67 	${_MKTARGET_INSTALL}
     68 	mkdir -p ${HOST_FILESDIR}
     69 	${HOST_INSTALL_FILE} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}
     70 
     71 .if ${MKUPDATE} == "no"
     72 .PHONY:		${HOST_FILESDIR}/${F}
     73 .endif
     74 .endfor
     75 
     76 .include <bsd.hostprog.mk>
     77