Makefile revision 1.96
1# $NetBSD: Makefile,v 1.96 2025/10/22 12:34:00 roy Exp $ 2 3HOSTLIB= nbcompat 4 5.include <bsd.hostinit.mk> 6 7SRCS= atoll.c basename.c cdbr.c cdbw.c dirname.c \ 8 dprintf.c fgetln.c flock.c fparseln.c fpurge.c \ 9 getcap.c getline.c getmode.c getopt_long.c gettemp.c \ 10 heapsort.c getsubopt.c \ 11 issetugid.c lchflags.c lchmod.c lchown.c libyywrap.c \ 12 md2.c md2hl.c md4c.c md4hl.c md5c.c md5hl.c \ 13 mi_vector_hash.c mkdtemp.c mkstemps.c \ 14 mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \ 15 pw_scan.c \ 16 raise_default_signal.c rbtree.c reallocarr.c reallocarray.c \ 17 rmd160.c rmd160hl.c \ 18 regcomp.c regerror.c regexec.c regfree.c \ 19 setenv.c setgroupent.c \ 20 setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \ 21 sha256hl.c sha384hl.c sha512hl.c \ 22 shquote.c \ 23 snprintb.c snprintf.c \ 24 stat_flags.c strlcat.c strlcpy.c strmode.c \ 25 strcasecmp.c strncasecmp.c strcasestr.c strndup.c strnlen.c \ 26 strsep.c strsuftoll.c strtonum.c strtoll.c \ 27 strtoi.c strtou.c \ 28 unvis.c vis.c err.c errx.c errc.c verr.c verrx.c verrc.c \ 29 vwarn.c vwarnx.c vwarnc.c warn.c warnx.c warnc.c \ 30 fts.c glob.c efun.c 31 32BUILD_OSTYPE!= uname -s 33 34# Disable use of pre-compiled headers on Darwin. 35.if ${BUILD_OSTYPE} == "Darwin" 36HOST_CPPFLAGS+= -no-cpp-precomp 37.endif 38 39# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and 40# other file ops, on many systems, without changing function names. 41 42HOST_CPPFLAGS+= -I. -I./include -I${.CURDIR} -I${.CURDIR}/sys \ 43 -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 44 45.PATH: ${.CURDIR}/../../lib/libc/cdb \ 46 ${.CURDIR}/../../lib/libc/gen \ 47 ${.CURDIR}/../../lib/libc/hash \ 48 ${.CURDIR}/../../lib/libc/hash/md2 \ 49 ${.CURDIR}/../../lib/libc/hash/md5 \ 50 ${.CURDIR}/../../lib/libc/hash/rmd160 \ 51 ${.CURDIR}/../../lib/libc/hash/sha1 \ 52 ${.CURDIR}/../../lib/libc/hash/sha2 \ 53 ${.CURDIR}/../../lib/libc/md \ 54 ${.CURDIR}/../../lib/libc/regex \ 55 ${.CURDIR}/../../lib/libc/stdio \ 56 ${.CURDIR}/../../lib/libc/stdlib \ 57 ${.CURDIR}/../../lib/libc/string \ 58 ${.CURDIR}/../../lib/libutil \ 59 ${.CURDIR}/../../common/lib/libc/cdb \ 60 ${.CURDIR}/../../common/lib/libc/gen \ 61 ${.CURDIR}/../../common/lib/libc/string \ 62 ${.CURDIR}/../../common/lib/libc/hash/rmd160 \ 63 ${.CURDIR}/../../common/lib/libc/hash/sha1 \ 64 ${.CURDIR}/../../common/lib/libc/hash/sha2 \ 65 ${.CURDIR}/../../common/lib/libc/md \ 66 ${.CURDIR}/../../common/lib/libc/stdlib \ 67 ${.CURDIR}/../../common/lib/libutil \ 68 ${.CURDIR}/../../external/bsd/flex/dist/src 69 70DPSRCS+= defs.mk 71CLEANFILES+= config.log config.status configure.lineno *.stamp 72CLEANFILES+= config.cache.tmp 73CLEANDIRFILES+= defs.mk config.cache confdefs.h 74 75# Get components of Berkeley DB. 76_CURDIR:= ${.CURDIR} 77.CURDIR:= ${_CURDIR}/../../lib/libc 78.include "${.CURDIR}/db/Makefile.inc" 79.CURDIR:= ${_CURDIR} 80 81SRCS:= ${SRCS:M*.c} 82 83.if ${MAKEVERBOSE} == 0 84CONFIGURE_ARGS+=--silent 85.endif 86 87config.cache: include/.stamp configure nbtool_config.h.in defs.mk.in 88 rm -f ${.TARGET}.tmp ${.TARGET} 89 CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} CPPFLAGS=${HOST_CPPFLAGS:Q} \ 90 LDFLAGS=${HOST_LDFLAGS:Q} \ 91 ${HOST_SH} ${.CURDIR}/configure \ 92 --cache-file=${.TARGET}.tmp \ 93 ${CONFIGURE_ARGS} 94 mv -f ${.TARGET}.tmp ${.TARGET} 95 96defs.mk: config.cache 97 @touch ${.TARGET} 98 99INCFILES= nbtool_config.h 100INCSUBDIRS= sys machine rpc arpa 101CLEANDIRFILES+= ${INCFILES} 102 103# CLEANDIRFILES may not contain directory names 104cleandir: cleandir.include 105cleandir.include: .PHONY 106 rm -rf include 107 108include/.stamp: 109 mkdir -p ${INCSUBDIRS:@d@ include/$d @} 110 @touch ${.TARGET} 111 112# Install rules 113 114HOST_LIBDIR= ${TOOLDIR}/lib 115HOST_INCSDIR= ${TOOLDIR}/include 116HOST_SHAREDIR= ${TOOLDIR}/share 117 118install: .PHONY install.lib includes install.defs.mk 119 120# Install lib${HOSTLIB}.a in ${TOOLDIR}/lib 121install.lib: .PHONY ${HOST_LIBDIR}/lib${HOSTLIB}.a 122${HOST_LIBDIR}/lib${HOSTLIB}.a: lib${HOSTLIB}.a 123 ${_MKTARGET_INSTALL} 124 ${HOST_INSTALL_DIR} ${HOST_LIBDIR} 125 ${HOST_INSTALL_FILE} -m ${LIBMODE} ${.ALLSRC} ${.TARGET} 126 127.for _f in ${INCFILES} 128HOST_INCINSTFILES+= ${HOST_INCSDIR}/compat/${_f} 129${HOST_INCSDIR}/compat/${_f}: ${_f} 130 ${_MKTARGET_INSTALL} 131 ${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET} 132.endfor 133 134.for _d in ${INCSUBDIRS} 135HOST_INCINSTDIRS+= ${HOST_INCSDIR}/compat/${_d} 136${HOST_INCSDIR}/compat/${_d}: 137 ${_MKTARGET_INSTALL} 138 ${HOST_INSTALL_DIR} ${.TARGET} 139.endfor 140 141# Install include files in ${TOOLDIR}/include/compat 142includes: .PHONY ${HOST_INCINSTDIRS} .WAIT ${HOST_INCINSTFILES} 143 @(cd include && find . -name '*.h' -print | while read f ; do \ 144 ${HOST_INSTALL_FILE} $$f ${HOST_INCSDIR}/compat/$$f ; \ 145 done) 146 147 148# Install defs.mk in ${TOOLDIR}/share/compat 149install.defs.mk: .PHONY ${HOST_SHAREDIR}/compat/defs.mk 150${HOST_SHAREDIR}/compat/defs.mk: defs.mk 151 ${_MKTARGET_INSTALL} 152 ${HOST_INSTALL_DIR} ${HOST_SHAREDIR} 153 ${HOST_INSTALL_DIR} ${HOST_SHAREDIR}/compat 154 ${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET} 155 156# bsd.hostlib.mk wants HOST_CPPFLAGS, not CPPFLAGS 157 158HOST_CPPFLAGS+= ${CPPFLAGS} 159 160.include <bsd.hostlib.mk> 161 162# Use uninstalled copy of host-mkdep 163HOST_MKDEP_OBJ!= cd ${.CURDIR}/../host-mkdep && ${PRINTOBJDIR} 164HOST_MKDEP= ${HOST_MKDEP_OBJ}/host-mkdep 165MKDEP= ${HOST_MKDEP} 166 167# Use uninstalled copy of the install program 168INSTALL_OBJ!= cd ${NETBSDSRCDIR}/tools/binstall && ${PRINTOBJDIR} 169INSTALL= ${INSTALL_OBJ}/xinstall 170 171# Run "${TOOLDIR}/bin/nbmake-${MACHINE} regen" by hand after editing 172# configure.ac. See more detailed instructions in configure.ac. 173regen: 174 ${_MKMSG_REGEN} configure nbtool_config.h.in 175 cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoreconf \ 176 ${${MAKEVERBOSE} >= 2 :? -v :} 177