xref: /minix/tools/compat/Makefile (revision 0a6a1f1d)
1*0a6a1f1dSLionel Sambuc#	$NetBSD: Makefile,v 1.76 2015/09/17 14:25:43 christos Exp $
2c8a0e2f4SThomas Veerman
3c8a0e2f4SThomas VeermanHOSTLIB=	nbcompat
4c8a0e2f4SThomas Veerman
584d9c625SLionel Sambuc.include <bsd.own.mk>
684d9c625SLionel Sambuc
79152e1c5SLionel SambucSRCS=		atoll.c basename.c cdbr.c cdbw.c dirname.c \
884d9c625SLionel Sambuc		dprintf.c fgetln.c flock.c fparseln.c fpurge.c \
99152e1c5SLionel Sambuc		getcap.c getline.c getmode.c getopt_long.c gettemp.c \
109152e1c5SLionel Sambuc		heapsort.c \
119152e1c5SLionel Sambuc		issetugid.c lchflags.c lchmod.c lchown.c libyywrap.c \
129152e1c5SLionel Sambuc		md2.c md2hl.c md4c.c md4hl.c md5c.c md5hl.c \
139152e1c5SLionel Sambuc		mi_vector_hash.c mkdtemp.c \
149152e1c5SLionel Sambuc		mkstemp.c pread.c putc_unlocked.c pwcache.c pwrite.c \
159152e1c5SLionel Sambuc		pw_scan.c \
16*0a6a1f1dSLionel Sambuc		raise_default_signal.c reallocarr.c rmd160.c rmd160hl.c \
179152e1c5SLionel Sambuc		setenv.c setgroupent.c \
189152e1c5SLionel Sambuc		setpassent.c setprogname.c sha1.c sha1hl.c sha2.c \
1984d9c625SLionel Sambuc		sha256hl.c sha384hl.c sha512hl.c snprintb.c snprintf.c \
20*0a6a1f1dSLionel Sambuc		stat_flags.c strlcat.c strlcpy.c strmode.c \
21*0a6a1f1dSLionel Sambuc		strndup.c strnlen.c \
2284d9c625SLionel Sambuc		strsep.c strsuftoll.c strtoll.c \
23*0a6a1f1dSLionel Sambuc		strtoi.c strtou.c \
24*0a6a1f1dSLionel Sambuc		unvis.c vis.c err.c errx.c errc.c verr.c verrx.c verrc.c \
25*0a6a1f1dSLionel Sambuc		vwarn.c vwarnx.c vwarnc.c warn.c warnx.c warnc.c \
26*0a6a1f1dSLionel Sambuc		fts.c glob.c efun.c
27c8a0e2f4SThomas Veerman
28c8a0e2f4SThomas VeermanBUILD_OSTYPE!=  uname -s
29c8a0e2f4SThomas Veerman
30c8a0e2f4SThomas Veerman# Disable use of pre-compiled headers on Darwin.
31c8a0e2f4SThomas Veerman.if ${BUILD_OSTYPE} == "Darwin"
32c8a0e2f4SThomas VeermanCPPFLAGS+=	-no-cpp-precomp
33c8a0e2f4SThomas Veerman.endif
34c8a0e2f4SThomas Veerman
35c8a0e2f4SThomas Veerman# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and
36c8a0e2f4SThomas Veerman# other file ops, on many systems, without changing function names.
37c8a0e2f4SThomas Veerman
38c8a0e2f4SThomas VeermanCPPFLAGS+=	-I. -I./include -I${.CURDIR} -I${.CURDIR}/sys \
39c8a0e2f4SThomas Veerman		-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
40c8a0e2f4SThomas Veerman
419152e1c5SLionel Sambuc.PATH:		${.CURDIR}/../../lib/libc/cdb \
429152e1c5SLionel Sambuc		${.CURDIR}/../../lib/libc/gen \
43c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libc/hash \
44c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libc/hash/md2 \
45c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libc/hash/md5 \
46c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libc/hash/rmd160 \
47c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libc/hash/sha1 \
48c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libc/hash/sha2 \
49c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libc/md \
50c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libc/stdio \
51c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libc/stdlib \
52c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libc/string \
53c8a0e2f4SThomas Veerman		${.CURDIR}/../../lib/libutil \
54*0a6a1f1dSLionel Sambuc		${.CURDIR}/../../common/lib/libc/cdb \
55c8a0e2f4SThomas Veerman		${.CURDIR}/../../common/lib/libc/string \
56c8a0e2f4SThomas Veerman		${.CURDIR}/../../common/lib/libc/hash/rmd160 \
57c8a0e2f4SThomas Veerman		${.CURDIR}/../../common/lib/libc/hash/sha1 \
58c8a0e2f4SThomas Veerman		${.CURDIR}/../../common/lib/libc/hash/sha2 \
59c8a0e2f4SThomas Veerman		${.CURDIR}/../../common/lib/libc/md \
60c8a0e2f4SThomas Veerman		${.CURDIR}/../../common/lib/libc/stdlib \
6184d9c625SLionel Sambuc		${.CURDIR}/../../common/lib/libutil \
62c8a0e2f4SThomas Veerman		${.CURDIR}/../../external/bsd/flex/dist
63c8a0e2f4SThomas Veerman
64c8a0e2f4SThomas VeermanDPSRCS+=	defs.mk
65c8a0e2f4SThomas VeermanCLEANFILES+=	config.log config.status configure.lineno *.stamp
6684d9c625SLionel SambucCLEANDIRFILES+=	defs.mk config.cache confdefs.h
67c8a0e2f4SThomas Veerman
68c8a0e2f4SThomas Veerman# Get components of Berkeley DB.
69c8a0e2f4SThomas Veerman_CURDIR:=	${.CURDIR}
70c8a0e2f4SThomas Veerman.CURDIR:=	${_CURDIR}/../../lib/libc
71c8a0e2f4SThomas Veerman.include "${.CURDIR}/db/Makefile.inc"
72c8a0e2f4SThomas Veerman.CURDIR:=	${_CURDIR}
73c8a0e2f4SThomas Veerman
74c8a0e2f4SThomas VeermanSRCS:=		${SRCS:M*.c}
75c8a0e2f4SThomas Veerman
76c8a0e2f4SThomas Veermanconfig.cache: include/.stamp configure nbtool_config.h.in defs.mk.in
77c8a0e2f4SThomas Veerman	rm -f ${.TARGET}
78c8a0e2f4SThomas Veerman	CC=${HOST_CC:Q} CFLAGS=${HOST_CFLAGS:Q} LDFLAGS=${HOST_LDFLAGS:Q} \
79c8a0e2f4SThomas Veerman		${HOST_SH} ${.CURDIR}/configure --cache-file=config.cache
80c8a0e2f4SThomas Veerman
81c8a0e2f4SThomas Veermandefs.mk: config.cache
82c8a0e2f4SThomas Veerman	@touch ${.TARGET}
83c8a0e2f4SThomas Veerman
8484d9c625SLionel SambucINCFILES=	nbtool_config.h
8584d9c625SLionel SambucINCSUBDIRS=	sys machine rpc arpa
8684d9c625SLionel SambucCLEANDIRFILES+= ${INCFILES}
8784d9c625SLionel Sambuc
8884d9c625SLionel Sambuc# CLEANDIRFILES may not contain directory names
8984d9c625SLionel Sambuccleandir:	cleandir.include
9084d9c625SLionel Sambuccleandir.include: .PHONY
9184d9c625SLionel Sambuc		rm -rf include
92c8a0e2f4SThomas Veerman
93c8a0e2f4SThomas Veermaninclude/.stamp:
9484d9c625SLionel Sambuc	mkdir -p ${INCSUBDIRS:@d@ include/$d @}
95c8a0e2f4SThomas Veerman	@touch ${.TARGET}
96c8a0e2f4SThomas Veerman
9784d9c625SLionel Sambuc# Install rules
9884d9c625SLionel Sambuc
9984d9c625SLionel SambucHOST_LIBDIR=	${TOOLDIR}/lib
10084d9c625SLionel SambucHOST_INCSDIR=	${TOOLDIR}/include
10184d9c625SLionel SambucHOST_SHAREDIR= ${TOOLDIR}/share
10284d9c625SLionel Sambuc
10384d9c625SLionel Sambucinstall:	.PHONY install.lib includes install.defs.mk
10484d9c625SLionel Sambuc
10584d9c625SLionel Sambuc# Install lib${HOSTLIB}.a in ${TOOLDIR}/lib
10684d9c625SLionel Sambucinstall.lib: .PHONY ${HOST_LIBDIR}/lib${HOSTLIB}.a
10784d9c625SLionel Sambuc${HOST_LIBDIR}/lib${HOSTLIB}.a: lib${HOSTLIB}.a
10884d9c625SLionel Sambuc	${_MKTARGET_INSTALL}
10984d9c625SLionel Sambuc	${HOST_INSTALL_DIR} ${HOST_LIBDIR}
11084d9c625SLionel Sambuc	${HOST_INSTALL_FILE} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
11184d9c625SLionel Sambuc
11284d9c625SLionel Sambuc.for _f in ${INCFILES}
11384d9c625SLionel SambucHOST_INCINSTFILES+= ${HOST_INCSDIR}/compat/${_f}
11484d9c625SLionel Sambuc${HOST_INCSDIR}/compat/${_f}: ${_f}
11584d9c625SLionel Sambuc	${_MKTARGET_INSTALL}
11684d9c625SLionel Sambuc	${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
11784d9c625SLionel Sambuc.endfor
11884d9c625SLionel Sambuc
11984d9c625SLionel Sambuc.for _d in ${INCSUBDIRS}
12084d9c625SLionel SambucHOST_INCINSTDIRS+= ${HOST_INCSDIR}/compat/${_d}
12184d9c625SLionel Sambuc${HOST_INCSDIR}/compat/${_d}:
12284d9c625SLionel Sambuc	${_MKTARGET_INSTALL}
12384d9c625SLionel Sambuc	${HOST_INSTALL_DIR} ${.TARGET}
12484d9c625SLionel Sambuc.endfor
12584d9c625SLionel Sambuc
12684d9c625SLionel Sambuc# Install include files in ${TOOLDIR}/include/compat
12784d9c625SLionel Sambucincludes: .PHONY ${HOST_INCINSTDIRS} .WAIT ${HOST_INCINSTFILES}
12884d9c625SLionel Sambuc	@(cd include && find . -name '*.h' -print | while read f ; do \
12984d9c625SLionel Sambuc	    ${HOST_INSTALL_FILE} $$f ${HOST_INCSDIR}/compat/$$f ; \
13084d9c625SLionel Sambuc	done)
13184d9c625SLionel Sambuc
13284d9c625SLionel Sambuc
13384d9c625SLionel Sambuc# Install defs.mk in ${TOOLDIR}/share/compat
13484d9c625SLionel Sambucinstall.defs.mk: .PHONY ${HOST_SHAREDIR}/compat/defs.mk
13584d9c625SLionel Sambuc${HOST_SHAREDIR}/compat/defs.mk: defs.mk
13684d9c625SLionel Sambuc	${_MKTARGET_INSTALL}
13784d9c625SLionel Sambuc	${HOST_INSTALL_DIR} ${HOST_SHAREDIR}
13884d9c625SLionel Sambuc	${HOST_INSTALL_DIR} ${HOST_SHAREDIR}/compat
13984d9c625SLionel Sambuc	${HOST_INSTALL_FILE} ${.ALLSRC} ${.TARGET}
14084d9c625SLionel Sambuc
14184d9c625SLionel Sambuc# bsd.hostlib.mk wants HOST_CPPFLAGS, not CPPFLAGS
142c8a0e2f4SThomas Veerman
143c8a0e2f4SThomas VeermanHOST_CPPFLAGS:=	${CPPFLAGS}
144c8a0e2f4SThomas VeermanCPPFLAGS:=	# empty
145c8a0e2f4SThomas Veerman
146c8a0e2f4SThomas Veerman.include <bsd.hostlib.mk>
14784d9c625SLionel Sambuc
14884d9c625SLionel Sambuc# Use uninstalled copy of host-mkdep
14984d9c625SLionel SambucHOST_MKDEP_OBJ!= cd ${.CURDIR}/../host-mkdep && ${PRINTOBJDIR}
15084d9c625SLionel SambucHOST_MKDEP=	${HOST_MKDEP_OBJ}/host-mkdep
15184d9c625SLionel SambucMKDEP=		${HOST_MKDEP}
15284d9c625SLionel Sambuc
15384d9c625SLionel Sambuc# Use uninstalled copy of the install program
15484d9c625SLionel SambucINSTALL_OBJ!=	cd ${NETBSDSRCDIR}/tools/binstall && ${PRINTOBJDIR}
15584d9c625SLionel SambucINSTALL=	${INSTALL_OBJ}/xinstall
15684d9c625SLionel Sambuc
15784d9c625SLionel Sambuc# Run "${TOOLDIR}/bin/nbmake-${MACHINE} regen" by hand after editing
15884d9c625SLionel Sambuc# configure.ac.  See more detailed instructions in configure.ac.
15984d9c625SLionel Sambucregen:
16084d9c625SLionel Sambuc	cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoconf
16184d9c625SLionel Sambuc	cd ${.CURDIR} && ${TOOLDIR}/bin/${_TOOL_PREFIX}autoheader
162