1# $FreeBSD$ 2# Copyright (c) David E. O'Brien, 2000-2004 3 4CONTRDIR= ${.CURDIR}/../../contrib/file 5.PATH: ${CONTRDIR} 6 7LIB= magic 8SHLIB_MAJOR= 3 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 23CLEANFILES+= magic magic.mgc 24 25FILES= magic magic.mgc 26FILESDIR= ${MAGICPATH} 27 28MAGFILES= ${CONTRDIR}/Header\ 29 ${CONTRDIR}/Localstuff\ 30 ${CONTRDIR}/Magdir/[a-z]* 31 32magic: ${MAGFILES} 33 cat ${.ALLSRC} > ${.TARGET} 34 35magic.mgc: mkmagic magic 36 ./mkmagic magic 37 38CLEANFILES+= mkmagic 39build-tools: mkmagic 40mkmagic: apprentice.c funcs.c magic.c print.c 41 ${CC} -DHAVE_CONFIG_H -DCOMPILE_ONLY \ 42 -I${.CURDIR} -I${CONTRDIR} -o ${.TARGET} ${.ALLSRC} 43 44FILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \ 45 ${.CURDIR}/config.h 46CLEANFILES+= ${MAN} 47.for mp in ${MAN} 48${mp}: ${mp:C/[0-9]/man/} 49 sed -e 's/__FSECTION__/5/g' -e 's/__CSECTION__/1/g' \ 50 -e 's/__VERSION__/${FILEVER}/g' \ 51 -e 's,__MAGIC__,${MAGICPATH}/magic,g' ${.ALLSRC} > ${.TARGET} 52.endfor 53 54.include <bsd.lib.mk> 55