1# $FreeBSD: releng/10.2/lib/libmagic/Makefile 268515 2014-07-11 00:00:00Z delphij $ 2# Copyright (c) David E. O'Brien, 2000-2004, 2006, 2009 3 4CONTRDIR= ${.CURDIR}/../../contrib/file 5.PATH: ${CONTRDIR}/src 6.PATH: ${CONTRDIR}/doc 7 8LIB= magic 9SHLIB_MAJOR= 4 10DPADD= ${LIBZ} 11LDADD= -lz 12MAN= libmagic.3 magic.5 13 14SRCS= apprentice.c apptype.c ascmagic.c cdf.c cdf_time.c compress.c \ 15 encoding.c fsmagic.c funcs.c \ 16 is_tar.c magic.c print.c readcdf.c readelf.c softmagic.c 17INCS= magic.h 18 19MAGICPATH?= /usr/share/misc 20 21CFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DHAVE_CONFIG_H 22CFLAGS+= -I${.CURDIR} -I${CONTRDIR}/src 23 24WARNS?= 3 25 26CLEANFILES+= magic magic.mgc 27 28FILES= magic magic.mgc 29FILESDIR= ${MAGICPATH} 30 31MAGFILES= ${CONTRDIR}/magic/Header \ 32 ${CONTRDIR}/magic/Localstuff \ 33 ${CONTRDIR}/magic/Magdir/[a-z]* 34 35magic: ${MAGFILES} 36 cat ${.ALLSRC:O} > ${.TARGET} 37 38magic.mgc: mkmagic magic 39 ./mkmagic magic 40 41CLEANFILES+= mkmagic 42build-tools: mkmagic 43mkmagic: apprentice.c cdf_time.c encoding.c funcs.c magic.c print.c 44 ${CC} ${CFLAGS} -DCOMPILE_ONLY ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} \ 45 ${LDADD} 46 47FILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \ 48 ${.CURDIR}/config.h 49CLEANFILES+= ${MAN} 50.for mp in ${MAN} 51${mp}: ${mp:C/[0-9]/man/} 52 sed -e 's/__FSECTION__/5/g' -e 's/__CSECTION__/1/g' \ 53 -e 's/__VERSION__/${FILEVER}/g' \ 54 -e 's,__MAGIC__,${MAGICPATH}/magic,g' ${.ALLSRC} > ${.TARGET} 55.endfor 56 57.include <bsd.lib.mk> 58