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 compress.c fsmagic.c funcs.c \ 14 is_tar.c magic.c print.c readelf.c softmagic.c 15INCS= magic.h 16 17MAGICPATH?= /usr/share/misc 18 19CFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DHAVE_CONFIG_H 20CFLAGS+= -I${.CURDIR} -I${CONTRDIR} 21 22CLEANFILES+= magic magic.mgc 23 24FILES= magic magic.mgc 25FILESDIR= ${MAGICPATH} 26 27MAGFILES= ${CONTRDIR}/Header\ 28 ${CONTRDIR}/Localstuff\ 29 ${CONTRDIR}/Magdir/[a-z]* 30 31magic: ${MAGFILES} 32 cat ${.ALLSRC} > ${.TARGET} 33 34magic.mgc: mkmagic magic 35 ./mkmagic magic 36 37CLEANFILES+= mkmagic 38build-tools: mkmagic 39mkmagic: apprentice.c funcs.c magic.c print.c 40 ${CC} -DHAVE_CONFIG_H -DCOMPILE_ONLY \ 41 -I${.CURDIR} -I${CONTRDIR} -o ${.TARGET} ${.ALLSRC} 42 43FILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \ 44 ${.CURDIR}/config.h 45CLEANFILES+= ${MAN} 46.for mp in ${MAN} 47${mp}: ${mp:C/[0-9]/man/} 48 sed -e 's/__FSECTION__/5/g' -e 's/__CSECTION__/1/g' \ 49 -e 's/__VERSION__/${FILEVER}/g' \ 50 -e 's,__MAGIC__,${MAGICPATH}/magic,g' ${.ALLSRC} > ${.TARGET} 51.endfor 52 53.include <bsd.lib.mk> 54