Home | History | Annotate | Line # | Download | only in compat
Makefile revision 1.70
      1 #	$NetBSD: Makefile,v 1.70 2013/12/11 01:24:08 joerg 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 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 
     25 BUILD_OSTYPE!=  uname -s
     26 
     27 # Disable use of pre-compiled headers on Darwin.
     28 .if ${BUILD_OSTYPE} == "Darwin"
     29 CPPFLAGS+=	-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 
     35 CPPFLAGS+=	-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 
     61 DPSRCS+=	defs.mk
     62 CLEANFILES+=	config.log config.status configure.lineno *.stamp
     63 CLEANDIRFILES+=	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 
     71 SRCS:=		${SRCS:M*.c}
     72 
     73 config.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 
     78 defs.mk: config.cache
     79 	@touch ${.TARGET}
     80 
     81 INCFILES=	nbtool_config.h
     82 INCSUBDIRS=	sys machine rpc arpa
     83 CLEANDIRFILES+= ${INCFILES}
     84 
     85 # CLEANDIRFILES may not contain directory names
     86 cleandir:	cleandir.include
     87 cleandir.include: .PHONY
     88 		rm -rf include
     89 
     90 include/.stamp:
     91 	mkdir -p ${INCSUBDIRS:@d@ include/$d @}
     92 	@touch ${.TARGET}
     93 
     94 # Install rules
     95 
     96 HOST_LIBDIR=	${TOOLDIR}/lib
     97 HOST_INCSDIR=	${TOOLDIR}/include
     98 HOST_SHAREDIR= ${TOOLDIR}/share
     99 
    100 install:	.PHONY install.lib includes install.defs.mk
    101 
    102 # Install lib${HOSTLIB}.a in ${TOOLDIR}/lib
    103 install.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}
    110 HOST_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}
    117 HOST_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
    124 includes: .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
    131 install.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 
    140 HOST_CPPFLAGS:=	${CPPFLAGS}
    141 CPPFLAGS:=	# empty
    142 
    143 .include <bsd.hostlib.mk>
    144 
    145 # Use uninstalled copy of host-mkdep
    146 HOST_MKDEP_OBJ!= cd ${.CURDIR}/../host-mkdep && ${PRINTOBJDIR}
    147 HOST_MKDEP=	${HOST_MKDEP_OBJ}/host-mkdep
    148 MKDEP=		${HOST_MKDEP}
    149 
    150 # Use uninstalled copy of the install program
    151 INSTALL_OBJ!=	cd ${NETBSDSRCDIR}/tools/binstall && ${PRINTOBJDIR}
    152 INSTALL=	${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.
    156 regen:
    157 	cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoconf
    158 	cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoheader
    159