2004-08-09 08:48:28 +00:00
|
|
|
# $FreeBSD$
|
2012-04-19 03:20:13 +00:00
|
|
|
# Copyright (c) David E. O'Brien, 2000-2004, 2006, 2009
|
2004-08-09 08:48:28 +00:00
|
|
|
|
2016-02-04 21:16:35 +00:00
|
|
|
PACKAGE=lib${LIB}
|
2017-01-20 04:45:09 +00:00
|
|
|
CONTRDIR= ${SRCTOP}/contrib/file
|
2020-06-17 07:41:28 +00:00
|
|
|
.PATH: ${CONTRDIR}
|
2014-06-26 06:03:39 +00:00
|
|
|
.PATH: ${CONTRDIR}/src
|
|
|
|
.PATH: ${CONTRDIR}/doc
|
2004-08-09 08:48:28 +00:00
|
|
|
|
|
|
|
LIB= magic
|
2009-07-19 17:25:24 +00:00
|
|
|
SHLIB_MAJOR= 4
|
2018-03-09 18:51:24 +00:00
|
|
|
.if !make(build-tools)
|
2014-11-25 11:07:26 +00:00
|
|
|
LIBADD= z
|
2018-03-09 18:51:24 +00:00
|
|
|
.endif
|
2004-08-09 08:48:28 +00:00
|
|
|
MAN= libmagic.3 magic.5
|
|
|
|
|
2018-05-20 05:59:42 +00:00
|
|
|
SRCS= apprentice.c apptype.c ascmagic.c buffer.c cdf.c cdf_time.c \
|
2019-11-10 17:00:23 +00:00
|
|
|
compress.c der.c encoding.c fsmagic.c funcs.c is_json.c \
|
2020-02-11 07:02:48 +00:00
|
|
|
is_csv.c \
|
2018-05-20 05:59:35 +00:00
|
|
|
is_tar.c magic.c print.c readcdf.c readelf.c seccomp.c softmagic.c
|
2004-11-19 04:04:14 +00:00
|
|
|
INCS= magic.h
|
2004-08-09 08:48:28 +00:00
|
|
|
|
2004-08-09 11:05:09 +00:00
|
|
|
MAGICPATH?= /usr/share/misc
|
2004-08-09 08:48:28 +00:00
|
|
|
|
2006-06-19 08:10:23 +00:00
|
|
|
CFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DHAVE_CONFIG_H
|
2016-06-27 06:41:11 +00:00
|
|
|
CFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${CONTRDIR}/src
|
2004-08-09 08:48:28 +00:00
|
|
|
|
2010-05-20 09:00:11 +00:00
|
|
|
WARNS?= 3
|
2010-01-02 09:58:07 +00:00
|
|
|
|
2009-01-02 03:38:21 +00:00
|
|
|
CLEANFILES+= magic magic.mgc
|
2004-08-09 08:48:28 +00:00
|
|
|
|
2009-01-02 03:38:21 +00:00
|
|
|
FILES= magic magic.mgc
|
2004-08-09 08:48:28 +00:00
|
|
|
FILESDIR= ${MAGICPATH}
|
|
|
|
|
2014-06-26 06:03:39 +00:00
|
|
|
MAGFILES= ${CONTRDIR}/magic/Header \
|
|
|
|
${CONTRDIR}/magic/Localstuff \
|
|
|
|
${CONTRDIR}/magic/Magdir/[a-z]*
|
2004-08-09 08:48:28 +00:00
|
|
|
|
2020-06-17 07:41:28 +00:00
|
|
|
|
|
|
|
PACKAGE_VERSION!= sed -n '/define.*PACKAGE_VERSION/{s,[^0-9.],,gp;q;}' ${.CURDIR}/config.h
|
|
|
|
|
|
|
|
libmagic.pc: libmagic.pc.in
|
|
|
|
sed -e 's,@prefix@,/usr,g ; \
|
|
|
|
s,@exec_prefix@,$${prefix},g ; \
|
|
|
|
s,@libdir@,$${exec_prefix}/lib,g ; \
|
|
|
|
s,@sharedlibdir@,$${libdir},g ; \
|
|
|
|
s,@includedir@,$${prefix}/include,g ; \
|
|
|
|
s,@VERSION@,${PACKAGE_VERSION},g ; \
|
|
|
|
s,@LIBS@,,g ;' \
|
|
|
|
${.ALLSRC} > ${.TARGET}
|
|
|
|
|
2004-08-09 08:48:28 +00:00
|
|
|
magic: ${MAGFILES}
|
2014-05-06 21:30:58 +00:00
|
|
|
cat ${.ALLSRC:O} > ${.TARGET}
|
2004-08-09 08:48:28 +00:00
|
|
|
|
2019-12-19 02:40:04 +00:00
|
|
|
magic.mgc: magic
|
2016-05-09 22:21:09 +00:00
|
|
|
${BTOOLSPATH:U.}/mkmagic magic
|
2004-08-09 08:48:28 +00:00
|
|
|
|
2019-12-11 17:38:15 +00:00
|
|
|
.if ${MACHINE} == "host" || ${MK_DIRDEPS_BUILD} == "no"
|
2004-08-09 08:48:28 +00:00
|
|
|
CLEANFILES+= mkmagic
|
2019-06-15 17:08:13 +00:00
|
|
|
DEPENDOBJS+= mkmagic
|
2004-08-09 08:48:28 +00:00
|
|
|
build-tools: mkmagic
|
2016-06-27 06:41:11 +00:00
|
|
|
mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c ${INCS} ${BUILD_TOOLS_META}
|
2019-06-15 17:08:13 +00:00
|
|
|
${CC:N${CCACHE_BIN}} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} \
|
|
|
|
${.ALLSRC:N*.h:O:u} ${LDADD}
|
2004-08-09 08:48:28 +00:00
|
|
|
|
2019-12-11 17:38:15 +00:00
|
|
|
.endif
|
|
|
|
.if ${MK_DIRDEPS_BUILD} == "yes"
|
|
|
|
BTOOLSPATH= ${HOST_OBJTOP}/${RELDIR}
|
2019-12-19 02:40:04 +00:00
|
|
|
.else
|
|
|
|
magic.mgc: mkmagic
|
2019-12-11 17:38:15 +00:00
|
|
|
.endif
|
|
|
|
|
2004-10-18 22:18:23 +00:00
|
|
|
FILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \
|
|
|
|
${.CURDIR}/config.h
|
2004-08-09 08:48:28 +00:00
|
|
|
CLEANFILES+= ${MAN}
|
|
|
|
.for mp in ${MAN}
|
|
|
|
${mp}: ${mp:C/[0-9]/man/}
|
|
|
|
sed -e 's/__FSECTION__/5/g' -e 's/__CSECTION__/1/g' \
|
|
|
|
-e 's/__VERSION__/${FILEVER}/g' \
|
|
|
|
-e 's,__MAGIC__,${MAGICPATH}/magic,g' ${.ALLSRC} > ${.TARGET}
|
|
|
|
.endfor
|
|
|
|
|
2016-06-27 01:29:17 +00:00
|
|
|
CLEANFILES+= ${INCS}
|
|
|
|
.for inc in ${INCS}
|
|
|
|
${inc}: ${inc}.in
|
|
|
|
sed -e 's,X.YY,${FILEVER:S,",,g:S,.,,g},g' ${.ALLSRC} > ${.TARGET}
|
|
|
|
.endfor
|
|
|
|
|
2020-06-17 15:57:59 +00:00
|
|
|
FILES+= libmagic.pc
|
|
|
|
FILESDIR_libmagic.pc= ${LIBDATADIR}/pkgconfig
|
2020-06-17 07:41:28 +00:00
|
|
|
|
2004-08-09 08:48:28 +00:00
|
|
|
.include <bsd.lib.mk>
|