Makefile revision 1.92
11.92Slukem#	$NetBSD: Makefile,v 1.92 2023/05/30 18:27:04 lukem Exp $
21.67Schristos
31.67SchristosHOSTLIB=	nbcompat
41.63Schristos
51.83Schristos.include <bsd.hostinit.mk>
61.1Stv
71.59SjoergSRCS=		atoll.c basename.c cdbr.c cdbw.c dirname.c \
81.68Schristos		dprintf.c fgetln.c flock.c fparseln.c fpurge.c \
91.58Sjoerg		getcap.c getline.c getmode.c getopt_long.c gettemp.c \
101.86Schristos		heapsort.c getsubopt.c \
111.39Selad		issetugid.c lchflags.c lchmod.c lchown.c libyywrap.c \
121.54Sroy		md2.c md2hl.c md4c.c md4hl.c md5c.c md5hl.c \
131.54Sroy		mi_vector_hash.c mkdtemp.c \
141.22Sthorpej		mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
151.51Slukem		pw_scan.c \
161.89Schristos		raise_default_signal.c rb.c reallocarr.c reallocarray.c \
171.89Schristos		rmd160.c rmd160hl.c \
181.81Saymeric		regcomp.c regerror.c regexec.c regfree.c \
191.51Slukem		setenv.c setgroupent.c \
201.34Selad		setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \
211.69Sapb		sha256hl.c sha384hl.c sha512hl.c snprintb.c snprintf.c \
221.71Sapb		stat_flags.c strlcat.c strlcpy.c strmode.c \
231.85Schristos		strcasecmp.c strncasecmp.c strndup.c strnlen.c \
241.69Sapb		strsep.c strsuftoll.c strtoll.c \
251.73Schristos		strtoi.c strtou.c \
261.72Schristos		unvis.c vis.c err.c errx.c errc.c verr.c verrx.c verrc.c \
271.72Schristos		vwarn.c vwarnx.c vwarnc.c warn.c warnx.c warnc.c \
281.72Schristos		fts.c glob.c efun.c
291.21Sthorpej
301.21SthorpejBUILD_OSTYPE!=  uname -s
311.21Sthorpej
321.21Sthorpej# Disable use of pre-compiled headers on Darwin.
331.21Sthorpej.if ${BUILD_OSTYPE} == "Darwin"
341.90SchristosHOST_CPPFLAGS+=	-no-cpp-precomp
351.21Sthorpej.endif
361.6Stv
371.6Stv# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and
381.6Stv# other file ops, on many systems, without changing function names.
391.6Stv
401.90SchristosHOST_CPPFLAGS+=	-I. -I./include -I${.CURDIR} -I${.CURDIR}/sys \
411.47Sdogcow		-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
421.3Stv
431.57Sjoerg.PATH:		${.CURDIR}/../../lib/libc/cdb \
441.57Sjoerg		${.CURDIR}/../../lib/libc/gen \
451.9Sbjh21		${.CURDIR}/../../lib/libc/hash \
461.39Selad		${.CURDIR}/../../lib/libc/hash/md2 \
471.38Selad		${.CURDIR}/../../lib/libc/hash/md5 \
481.38Selad		${.CURDIR}/../../lib/libc/hash/rmd160 \
491.38Selad		${.CURDIR}/../../lib/libc/hash/sha1 \
501.34Selad		${.CURDIR}/../../lib/libc/hash/sha2 \
511.9Sbjh21		${.CURDIR}/../../lib/libc/md \
521.81Saymeric		${.CURDIR}/../../lib/libc/regex \
531.15Sthorpej		${.CURDIR}/../../lib/libc/stdio \
541.6Stv		${.CURDIR}/../../lib/libc/stdlib \
551.4Slukem		${.CURDIR}/../../lib/libc/string \
561.44Schristos		${.CURDIR}/../../lib/libutil \
571.70Sjoerg		${.CURDIR}/../../common/lib/libc/cdb \
581.87Sthorpej		${.CURDIR}/../../common/lib/libc/gen \
591.40Schristos		${.CURDIR}/../../common/lib/libc/string \
601.46Smrg		${.CURDIR}/../../common/lib/libc/hash/rmd160 \
611.40Schristos		${.CURDIR}/../../common/lib/libc/hash/sha1 \
621.46Smrg		${.CURDIR}/../../common/lib/libc/hash/sha2 \
631.40Schristos		${.CURDIR}/../../common/lib/libc/md \
641.45Sthorpej		${.CURDIR}/../../common/lib/libc/stdlib \
651.69Sapb		${.CURDIR}/../../common/lib/libutil \
661.77Schristos		${.CURDIR}/../../external/bsd/flex/dist/src
671.1Stv
681.6StvDPSRCS+=	defs.mk
691.43SchristosCLEANFILES+=	config.log config.status configure.lineno *.stamp
701.61SapbCLEANDIRFILES+=	defs.mk config.cache confdefs.h
711.3Stv
721.3Stv# Get components of Berkeley DB.
731.3Stv_CURDIR:=	${.CURDIR}
741.3Stv.CURDIR:=	${_CURDIR}/../../lib/libc
751.3Stv.include "${.CURDIR}/db/Makefile.inc"
761.3Stv.CURDIR:=	${_CURDIR}
771.3Stv
781.54SroySRCS:=		${SRCS:M*.c}
791.1Stv
801.88SlukemCONFIGURE_ARGS=	--cache-file=config.cache
811.88Slukem.if ${MAKEVERBOSE} == 0
821.88SlukemCONFIGURE_ARGS+=--silent
831.88Slukem.endif
841.88Slukem
851.42Swizconfig.cache: include/.stamp configure nbtool_config.h.in defs.mk.in
861.20Slukem	rm -f ${.TARGET}
871.90Schristos	CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} CPPFLAGS=${HOST_CPPFLAGS:Q} \
881.90Schristos		LDFLAGS=${HOST_LDFLAGS:Q} \
891.88Slukem		${HOST_SH} ${.CURDIR}/configure ${CONFIGURE_ARGS}
901.20Slukem
911.20Slukemdefs.mk: config.cache
921.20Slukem	@touch ${.TARGET}
931.1Stv
941.61SapbINCFILES=	nbtool_config.h
951.66SchristosINCSUBDIRS=	sys machine rpc arpa
961.61SapbCLEANDIRFILES+= ${INCFILES}
971.61Sapb
981.61Sapb# CLEANDIRFILES may not contain directory names
991.61Sapbcleandir:	cleandir.include
1001.61Sapbcleandir.include: .PHONY
1011.61Sapb		rm -rf include
1021.61Sapb
1031.13Stvinclude/.stamp:
1041.61Sapb	mkdir -p ${INCSUBDIRS:@d@ include/$d @}
1051.20Slukem	@touch ${.TARGET}
1061.6Stv
1071.61Sapb# Install rules
1081.61Sapb
1091.61SapbHOST_LIBDIR=	${TOOLDIR}/lib
1101.61SapbHOST_INCSDIR=	${TOOLDIR}/include
1111.66SchristosHOST_SHAREDIR= ${TOOLDIR}/share
1121.61Sapb
1131.64Schristosinstall:	.PHONY install.lib includes install.defs.mk
1141.61Sapb
1151.61Sapb# Install lib${HOSTLIB}.a in ${TOOLDIR}/lib
1161.61Sapbinstall.lib: .PHONY ${HOST_LIBDIR}/lib${HOSTLIB}.a
1171.61Sapb${HOST_LIBDIR}/lib${HOSTLIB}.a: lib${HOSTLIB}.a
1181.61Sapb	${_MKTARGET_INSTALL}
1191.61Sapb	${HOST_INSTALL_DIR} ${HOST_LIBDIR}
1201.61Sapb	${HOST_INSTALL_FILE} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
1211.61Sapb
1221.64Schristos.for _f in ${INCFILES}
1231.64SchristosHOST_INCINSTFILES+= ${HOST_INCSDIR}/compat/${_f}
1241.64Schristos${HOST_INCSDIR}/compat/${_f}: ${_f}
1251.64Schristos	${_MKTARGET_INSTALL}
1261.64Schristos	${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
1271.64Schristos.endfor
1281.64Schristos
1291.61Sapb.for _d in ${INCSUBDIRS}
1301.64SchristosHOST_INCINSTDIRS+= ${HOST_INCSDIR}/compat/${_d}
1311.64Schristos${HOST_INCSDIR}/compat/${_d}:
1321.64Schristos	${_MKTARGET_INSTALL}
1331.64Schristos	${HOST_INSTALL_DIR} ${.TARGET}
1341.61Sapb.endfor
1351.64Schristos
1361.64Schristos# Install include files in ${TOOLDIR}/include/compat
1371.64Schristosincludes: .PHONY ${HOST_INCINSTDIRS} .WAIT ${HOST_INCINSTFILES}
1381.76Schristos	@(cd include && find . -name '*.h' -print | while read f ; do \
1391.66Schristos	    ${HOST_INSTALL_FILE} $$f ${HOST_INCSDIR}/compat/$$f ; \
1401.66Schristos	done)
1411.66Schristos
1421.61Sapb
1431.61Sapb# Install defs.mk in ${TOOLDIR}/share/compat
1441.61Sapbinstall.defs.mk: .PHONY ${HOST_SHAREDIR}/compat/defs.mk
1451.61Sapb${HOST_SHAREDIR}/compat/defs.mk: defs.mk
1461.61Sapb	${_MKTARGET_INSTALL}
1471.61Sapb	${HOST_INSTALL_DIR} ${HOST_SHAREDIR}
1481.61Sapb	${HOST_INSTALL_DIR} ${HOST_SHAREDIR}/compat
1491.61Sapb	${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
1501.61Sapb
1511.61Sapb# bsd.hostlib.mk wants HOST_CPPFLAGS, not CPPFLAGS
1521.6Stv
1531.90SchristosHOST_CPPFLAGS+=	${CPPFLAGS}
1541.1Stv
1551.1Stv.include <bsd.hostlib.mk>
1561.60Sapb
1571.60Sapb# Use uninstalled copy of host-mkdep
1581.60SapbHOST_MKDEP_OBJ!= cd ${.CURDIR}/../host-mkdep && ${PRINTOBJDIR}
1591.60SapbHOST_MKDEP=	${HOST_MKDEP_OBJ}/host-mkdep
1601.60SapbMKDEP=		${HOST_MKDEP}
1611.60Sapb
1621.61Sapb# Use uninstalled copy of the install program
1631.61SapbINSTALL_OBJ!=	cd ${NETBSDSRCDIR}/tools/binstall && ${PRINTOBJDIR}
1641.61SapbINSTALL=	${INSTALL_OBJ}/xinstall
1651.61Sapb
1661.60Sapb# Run "${TOOLDIR}/bin/nbmake-${MACHINE} regen" by hand after editing
1671.60Sapb# configure.ac.  See more detailed instructions in configure.ac.
1681.60Sapbregen:
1691.92Slukem	${_MKMSG_REGEN} configure nbtool_config.h.in
1701.92Slukem	cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoreconf \
1711.92Slukem		${${MAKEVERBOSE} >= 2 :? -v :}
172