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