1# $NetBSD: Makefile.host,v 1.31 2013/06/14 16:10:02 tsutsui Exp $ 2 3NOINFO= # defined 4NOLINT= # defined 5NOMAN= # defined 6 7.include <bsd.own.mk> 8 9.ifndef NOCOMPATLIB 10# Use TOOLDIR copy of libnbcompat and associated *.h files 11.-include "${TOOLDIR}/share/compat/defs.mk" 12.elif !empty(.MAKE.OS:M*CYGWIN*) 13HOSTEXEEXT=.exe 14.endif 15 16# Resolve pathnames in variables. 17_RESOLVE_VARS= CFLAGS CPPFLAGS DPADD HOST_CPPFLAGS LDADD 18.for var in ${_RESOLVE_VARS} 19${var}:= ${${var}} 20.endfor 21 22# Switch over to the "real" Makefile. 23.PROGDIR:= ${.CURDIR}/../../${HOST_SRCDIR} 24_CURDIR:= ${.CURDIR} 25HOSTPROG?= ${PROG} 26 27.CURDIR:= ${.PROGDIR} 28.PATH: ${.CURDIR} 29.include "${.CURDIR}/Makefile" 30.-include "${.CURDIR}/../Makefile.inc" 31 32# Resolve pathnames from "real" Makefile, and switch .CURDIR back. 33.for var in ${_RESOLVE_VARS} 34${var}:= ${${var}} 35.endfor 36.CURDIR:= ${_CURDIR} 37.undef _CURDIR 38 39# Set up the environment for <bsd.hostprog.mk>. 40.if ${USETOOLS} != "yes" 41.undef HOSTPROG 42.endif 43 44HOSTPROGNAME?= ${HOSTPROG} 45HOST_BINDIR?= ${TOOLDIR}/bin 46HOST_CPPFLAGS:= ${HOST_CPPFLAGS} ${CPPFLAGS} 47HOST_CPPFLAGS:= ${HOST_CPPFLAGS:N-Wp,-iremap,*:N--sysroot=*} 48HOST_INSTALLPROG?=${HOST_BINDIR}/${HOSTPROGNAME}${HOSTEXEEXT} 49.undef LINKS 50 51SRCS?= ${HOSTPROG}.c 52SRCS+= ${HOST_SRCS} 53 54.PATH: ${.PROGDIR} 55 56# Install rule. 57realinstall: install.host install.files 58install.host: ${HOST_INSTALLPROG} 59${HOST_INSTALLPROG}:: ${HOSTPROG} 60 ${_MKTARGET_INSTALL} 61 mkdir -p ${HOST_BINDIR} 62 ${HOST_INSTALL_FILE} -m ${BINMODE} ${HOSTPROG}${HOSTEXEEXT} ${.TARGET} 63.if !empty(.MAKE.OS:M*CYGWIN*) 64 ${HOST_SH} ${NETBSDSRCDIR}/tools/binstall/mkmanifest ${.TARGET} 65.endif 66 67.if ${MKUPDATE} == "no" 68.PHONY: ${HOST_INSTALLPROG} 69.endif 70 71install.files: 72.for F in ${HOSTFILES} 73install.files: ${HOST_FILESDIR}/${F} 74${HOST_FILESDIR}/${F}: ${F} 75 ${_MKTARGET_INSTALL} 76 mkdir -p ${HOST_FILESDIR} 77 ${HOST_INSTALL_FILE} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET} 78 79.if ${MKUPDATE} == "no" 80.PHONY: ${HOST_FILESDIR}/${F} 81.endif 82.endfor 83 84.include <bsd.hostprog.mk> 85