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