1# $FreeBSD$ 2# Copyright (c) David E. O'Brien, 2000-2004 3 4CONTRDIR= ${.CURDIR}/../../contrib/file 5.PATH: ${CONTRDIR} 6 7LIB= magic 8SHLIB_MAJOR= 1 9MAN= libmagic.3 magic.5 10 11SRCS= apprentice.c apptype.c ascmagic.c compress.c fsmagic.c funcs.c \ 12 is_tar.c magic.c print.c readelf.c softmagic.c 13INCS= magic.h 14 15MAGICPATH?= /usr/share/misc 16 17CFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DBUILTIN_ELF -DELFCORE -DHAVE_CONFIG_H 18CFLAGS+= -I${.CURDIR} -I${CONTRDIR} 19 20CLEANFILES+= magic magic.mgc magic.mime.mgc 21 22FILES= magic magic.mgc ${CONTRDIR}/magic.mime magic.mime.mgc 23FILESDIR= ${MAGICPATH} 24 25MAGFILES= ${CONTRDIR}/Header\ 26 ${CONTRDIR}/Localstuff\ 27 ${CONTRDIR}/Magdir/[a-z]* 28 29magic: ${MAGFILES} 30 cat ${.ALLSRC} > ${.TARGET} 31 32magic.mgc: mkmagic magic 33 ./mkmagic magic 34 35magic.mime.mgc: mkmagic magic.mime 36 ./mkmagic ${CONTRDIR}/magic.mime 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