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