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