xref: /netbsd-src/external/mit/libcbor/lib/Makefile (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
1# $NetBSD: Makefile,v 1.3 2020/03/04 17:22:49 christos Exp $
2
3NOLINT=
4NOMAN=
5.include <bsd.own.mk>
6
7DIST = ${.CURDIR}/../dist
8
9.PATH: ${DIST}/src ${DIST}/src/cbor ${DIST}/src/cbor/internal
10
11CPPFLAGS+= -I${DIST}/src -DHAVE_ENDIAN_H -I. -DEIGHT_BYTE_SIZE_T
12
13.if ${MACHINE} == "vax"
14# vax does not have NaN (no ieee754, so this code will not work anyway)
15CPPFLAGS+=-DNAN=INFINITY
16.endif
17
18LIB=    cbor
19
20SRCS+=   cbor.c
21
22# For ldexp
23LIBDPLIBS = m ${NETBSDSRCDIR}/lib/libm
24
25VERS_FILE=${DIST}/CMakeLists.txt
26
27.for i in MAJOR MINOR PATCH
28CBOR_VERSION_${i} != \
29    ${TOOL_SED} -ne '/CBOR_VERSION_${i}/s/.*"\([0-9]*\)")$$/\1/p' ${VERS_FILE}
30.endfor
31
32CBOR_VERSION = ${CBOR_VERSION_MAJOR}.${CBOR_VERSION_MINOR}.${CBOR_VERSION_PATCH}
33
34# cbor/
35SRCS+= \
36arrays.c \
37bytestrings.c \
38callbacks.c \
39common.c \
40encoding.c \
41floats_ctrls.c \
42ints.c \
43maps.c \
44serialization.c \
45streaming.c \
46strings.c \
47tags.c
48
49# cbor/internal
50SRCS+= \
51builder_callbacks.c \
52encoders.c \
53loaders.c \
54memory_utils.c \
55stack.c \
56unicode.c
57
58INCS+= \
59cbor.h \
60cbor/arrays.h \
61cbor/bytestrings.h \
62cbor/callbacks.h \
63cbor/common.h \
64cbor/configuration.h \
65cbor/data.h \
66cbor/encoding.h \
67cbor/floats_ctrls.h \
68cbor/ints.h \
69cbor/maps.h \
70cbor/serialization.h \
71cbor/streaming.h \
72cbor/strings.h \
73cbor/tags.h
74
75INCSDIR=/usr/include
76
77PKGCONFIG=libcbor
78
79.SUFFIXES: .in
80
81.in:
82	${TOOL_SED} \
83	    -e s@CMAKE_INSTALL_PREFIX@/usr@ \
84	    -e s@CMAKE_INSTALL_LIBDIR@/lib@ \
85	    -e s@PROJECT_NAME@libcbor@ \
86	    -e s@CBOR_VERSION@${CBOR_VERSION}@ ${.ALLSRC} > ${.TARGET}
87
88libcbor.pc: libcbor.pc.in
89
90SHLIB_MAJOR=    0
91SHLIB_MINOR=    5
92
93.include <bsd.lib.mk>
94
95${OBJS}: cbor/configuration.h
96
97cbor/configuration.h: ${VERS_FILE}
98	@mkdir -p cbor && ( \
99	echo	'#define CBOR_MAJOR_VERSION ${CBOR_VERSION_MAJOR}' && \
100	echo	'#define CBOR_MINOR_VERSION ${CBOR_VERSION_MINOR}' && \
101	echo	'#define CBOR_PATCH_VERSION ${CBOR_VERSION_PATCH}' && \
102	echo	'#define CBOR_CUSTOM_ALLOC 0' && \
103	echo	'#define CBOR_BUFFER_GROWTH 2' && \
104	echo	'#define CBOR_PRETTY_PRINTER 1' && \
105	echo	'#define CBOR_RESTRICT_SPECIFIER restrict' && \
106	echo	'#define CBOR_INLINE_SPECIFIER ') > ${.TARGET}
107
108CLEANFILES+= cbor/configuration.h
109
110.BEGIN:
111
112