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