Home | History | Annotate | Line # | Download | only in lib
      1 # $NetBSD: Makefile,v 1.5 2024/06/24 18:01:03 riastradh Exp $
      2 
      3 NOLINT=
      4 NOMAN=
      5 .include <bsd.own.mk>
      6 
      7 DIST = ${.CURDIR}/../dist
      8 
      9 .PATH: ${DIST}/src ${DIST}/src/cbor ${DIST}/src/cbor/internal
     10 
     11 CPPFLAGS+= -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)
     15 CPPFLAGS+=-DNAN=INFINITY
     16 .endif
     17 
     18 LIB=    cbor
     19 
     20 SRCS+=   cbor.c
     21 
     22 # For ldexp
     23 LIBDPLIBS = m ${NETBSDSRCDIR}/lib/libm
     24 
     25 VERS_FILE=${DIST}/CMakeLists.txt
     26 
     27 .for i in MAJOR MINOR PATCH
     28 CBOR_VERSION_${i} != \
     29     ${TOOL_SED} -ne '/CBOR_VERSION_${i}/s/.*"\([0-9]*\)")$$/\1/p' ${VERS_FILE}
     30 .endfor
     31 
     32 CBOR_VERSION = ${CBOR_VERSION_MAJOR}.${CBOR_VERSION_MINOR}.${CBOR_VERSION_PATCH}
     33 
     34 # cbor/
     35 SRCS+= \
     36 arrays.c \
     37 bytestrings.c \
     38 callbacks.c \
     39 common.c \
     40 encoding.c \
     41 floats_ctrls.c \
     42 ints.c \
     43 maps.c \
     44 serialization.c \
     45 streaming.c \
     46 strings.c \
     47 tags.c
     48 
     49 # cbor/internal
     50 SRCS+= \
     51 builder_callbacks.c \
     52 encoders.c \
     53 loaders.c \
     54 memory_utils.c \
     55 stack.c \
     56 unicode.c
     57 
     58 INCS+= \
     59 cbor.h \
     60 cbor/arrays.h \
     61 cbor/bytestrings.h \
     62 cbor/callbacks.h \
     63 cbor/common.h \
     64 cbor/configuration.h \
     65 cbor/data.h \
     66 cbor/encoding.h \
     67 cbor/floats_ctrls.h \
     68 cbor/ints.h \
     69 cbor/maps.h \
     70 cbor/serialization.h \
     71 cbor/streaming.h \
     72 cbor/strings.h \
     73 cbor/tags.h
     74 
     75 INCSDIR=/usr/include
     76 
     77 PKGCONFIG=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 
     88 libcbor.pc: libcbor.pc.in
     89 
     90 SHLIB_MAJOR=    0
     91 SHLIB_MINOR=    5
     92 
     93 cbor/configuration.h: ${VERS_FILE}
     94 	${_MKTARGET_CREATE}
     95 	mkdir -p cbor && ( \
     96 	echo	'#define CBOR_MAJOR_VERSION ${CBOR_VERSION_MAJOR}' && \
     97 	echo	'#define CBOR_MINOR_VERSION ${CBOR_VERSION_MINOR}' && \
     98 	echo	'#define CBOR_PATCH_VERSION ${CBOR_VERSION_PATCH}' && \
     99 	echo	'#define CBOR_CUSTOM_ALLOC 0' && \
    100 	echo	'#define CBOR_BUFFER_GROWTH 2' && \
    101 	echo	'#define CBOR_PRETTY_PRINTER 1' && \
    102 	echo	'#define CBOR_RESTRICT_SPECIFIER restrict' && \
    103 	echo	'#define CBOR_INLINE_SPECIFIER ') > ${.TARGET}.tmp && \
    104 	${MV} ${.TARGET}.tmp ${.TARGET}
    105 
    106 CLEANFILES+= cbor/configuration.h
    107 CLEANFILES+= cbor/configuration.h.tmp
    108 
    109 .include <bsd.lib.mk>
    110