11.10Sriastrad#	$NetBSD: Makefile,v 1.10 2024/04/01 18:33:24 riastradh Exp $
21.3Stron
31.3StronHOSTLIB=	ctf
41.1Sdarran
51.8Schristos.include <bsd.hostinit.mk>
61.1Sdarran
71.1SdarranSRCS=		ctf_create.c \
81.1Sdarran		ctf_decl.c \
91.1Sdarran		ctf_error.c \
101.1Sdarran		ctf_hash.c \
111.1Sdarran		ctf_labels.c \
121.1Sdarran		ctf_lib.c \
131.1Sdarran		ctf_lookup.c \
141.1Sdarran		ctf_open.c \
151.1Sdarran		ctf_subr.c \
161.1Sdarran		ctf_types.c \
171.1Sdarran		ctf_util.c
181.1Sdarran
191.1SdarranOSNETDIR=	${.CURDIR}/../../external/cddl/osnet
201.1SdarranOPENSOLARIS_DISTDIR= ${OSNETDIR}/dist
211.6SchristosLIBELF_DIR=	${.CURDIR}/../../external/bsd/elftoolchain/dist/libelf
221.1Sdarran
231.1SdarranCPPFLAGS+=	-DCTF_OLD_VERSIONS
241.1Sdarran
251.1Sdarran.ifndef NOCOMPATLIB
261.4SapbCOMPATLIB_NO_LIB= yes # only the include files, not the library
271.4Sapb.-include	"${TOOLDIR}/share/compat/defs.mk"
281.1Sdarran.endif
291.1Sdarran
301.1SdarranCPPFLAGS+=	-I${.CURDIR}/../compat \
311.1Sdarran		-I${OSNETDIR}/sys \
321.1Sdarran		-I${OSNETDIR}/include \
331.1Sdarran		-I${OPENSOLARIS_DISTDIR}/head \
341.1Sdarran		-I${OPENSOLARIS_DISTDIR}/common/ctf \
351.1Sdarran		-I${OPENSOLARIS_DISTDIR}/lib/libctf/common \
361.1Sdarran		-I${OPENSOLARIS_DISTDIR}/uts/common \
371.9Sjkoshy		-I${LIBELF_DIR} \
381.9Sjkoshy		-I${TOOLDIR}/include
391.1Sdarran
401.1SdarranBUILD_OSTYPE!=  uname -s
411.1Sdarran
421.1Sdarran# Disable use of pre-compiled headers on Darwin.
431.1Sdarran.if ${BUILD_OSTYPE} == "Darwin"
441.1SdarranCPPFLAGS+=	-no-cpp-precomp
451.1Sdarran.endif
461.1Sdarran
471.1Sdarran# -D_FILE_OFFSET_BITS=64 produces a much more amenable `struct stat', and
481.1Sdarran# other file ops, on many systems, without changing function names.
491.1Sdarran
501.1SdarranCPPFLAGS+=	-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
511.1Sdarran
521.1Sdarran.PATH:		${OPENSOLARIS_DISTDIR}/common/ctf
531.1Sdarran.PATH:		${OPENSOLARIS_DISTDIR}/lib/libctf/common
541.1Sdarran
551.5SapbHOST_CPPFLAGS:=	${CPPFLAGS} ${HOST_CPPFLAGS}
561.1SdarranCPPFLAGS:=	# empty
571.1Sdarran
581.1Sdarranrealinstall: install.host
591.1Sdarraninstall.host: ${TOOLDIR}/lib/libctf.a
601.1Sdarran${TOOLDIR}/lib/libctf.a:: libctf.a
611.1Sdarran	${_MKTARGET_INSTALL}
621.1Sdarran	mkdir -p ${TOOLDIR}/lib
631.1Sdarran	${HOST_INSTALL_FILE} -m ${BINMODE} libctf.a ${.TARGET}
641.1Sdarran
651.1Sdarran.include <bsd.hostlib.mk>
66