Makefile.host revision 1.6
1#	$NetBSD: Makefile.host,v 1.6 2001/10/25 02:02:46 thorpej Exp $
2
3# Preload <bsd.obj.mk> to set up obj rules (with proper ${.CURDIR}).
4.include <bsd.obj.mk>
5
6# We might need the PRINTOBJDIR variable -- make sure it's defined.
7# XXX It really sucks to have to copy this from <bsd.own.mk>.
8PRINTOBJDIR=	printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -B -s -f-
9
10# Save value of .CURDIR, and reassign it to the "real" source directory.
11_CURDIR:=	${.CURDIR}
12.CURDIR:=	${_CURDIR}/../../${HOST_SRCDIR}
13
14# Set HOSTPROG as a flag to the real program not to include <bsd.prog.mk>.
15HOSTPROG?=	${PROG}
16
17# Pull in the "real" Makefile.
18.include "${.CURDIR}/Makefile"
19.if exists(${.CURDIR}/../Makefile.inc)
20.include "${.CURDIR}/../Makefile.inc"
21.endif
22
23# Set up the environment for <bsd.hostprog.mk>.
24HOSTPROGNAME?=	${HOSTPROG}
25HOST_BINDIR?=	${TOOLDIR}/bin
26HOST_CPPFLAGS:=	-include ${_CURDIR}/../compat/compat_netbsd.h -Wall \
27		${HOST_CPPFLAGS} ${CPPFLAGS}
28MKMAN=		no
29SRCS?=		${PROG}.c
30SRCS+=		${HOST_SRCS} nb_progname.c
31TIMESTAMP?=	${HOST_BINDIR}/${HOSTPROGNAME}
32.undef LINKS
33
34.PATH:		${.CURDIR} ${_CURDIR}/../compat
35${TIMESTAMP}:	${.CURDIR}/Makefile
36
37# Include the local definitions, and then <bsd.hostprog.mk>.
38.include "${_CURDIR}/../Makefile.inc"
39.include <bsd.hostprog.mk>
40
41# Install rule.
42realinstall: install.host install.files
43install.host:
44	mkdir -p ${HOST_BINDIR}
45	${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -m ${BINMODE} \
46		${HOSTPROG} ${HOST_BINDIR}/${HOSTPROGNAME}
47
48.if defined(HOSTFILES)
49install.files:
50	mkdir -p ${HOST_FILESDIR}
51	for i in ${HOSTFILES}; \
52	do \
53		${INSTALL} ${RENAME} ${PRESERVE} ${COPY} -m ${NONBINMODE} \
54			${.CURDIR}/$$i ${HOST_FILESDIR}/$$i; \
55	done
56.else
57install.files:
58.endif
59