181293Sobrien# $FreeBSD$
28874Srgrimes# Makefile for file(1) cmd.
3234449Sobrien# Copyright (c) David E. O'Brien, 2000-2004, 2009
42479Scsgr# Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
52479Scsgr#
62479Scsgr# This software is not subject to any license of the American Telephone
72479Scsgr# and Telegraph Company or of the Regents of the University of California.
82479Scsgr#
92479Scsgr# Permission is granted to anyone to use this software for any purpose on
102479Scsgr# any computer system, and to alter it and redistribute it freely, subject
112479Scsgr# to the following restrictions:
122479Scsgr#
132479Scsgr# 1. The author is not responsible for the consequences of use of this
142479Scsgr#    software, no matter how awful, even if they arise from flaws in it.
152479Scsgr# 2. The origin of this software must not be misrepresented, either by
162479Scsgr#    explicit claim or by omission.  Since few users ever read sources,
172479Scsgr#    credits must appear in the documentation.
182479Scsgr# 3. Altered versions must be plainly marked as such, and must not be
192479Scsgr#    misrepresented as being the original software.  Since few users
202479Scsgr#    ever read sources, credits must appear in the documentation.
212479Scsgr# 4. This notice may not be removed or altered.
2220394Sbde
23133367SobrienSRCDIR=	${.CURDIR}/../../contrib/file
24268515Sdelphij.PATH: ${SRCDIR}/src
25268515Sdelphij.PATH: ${SRCDIR}/doc
262479Scsgr
2781293SobrienPROG=	file
282479Scsgr
29133370SobrienMAGICPATH?=	/usr/share/misc
3068352Sobrien
31133363SobrienCFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DHAVE_CONFIG_H
32191771SobrienCFLAGS+= -I${.CURDIR}/../../lib/libmagic
332479Scsgr
34133363SobrienDPADD=	${LIBMAGIC} ${LIBZ}
35133363SobrienLDADD=	-lmagic -lz
36103378Sobrien
37175820SruFILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \
38191771Sobrien			${.CURDIR}/../../lib/libmagic/config.h
39175820Sru
40175820SruCLEANFILES+=	${MAN}
41175820Sru
422482Scsgr.include <bsd.prog.mk>
43175820Sru
44175820Sru.for mp in ${MAN}
45175820Sru${mp}: ${mp:C/[0-9]/man/}
46175820Sru	sed -e 's/__FSECTION__/5/g' -e 's/__CSECTION__/1/g' \
47175820Sru		-e 's/__VERSION__/${FILEVER}/g' \
48175820Sru		-e 's,__MAGIC__,${MAGICPATH}/magic,g' ${.ALLSRC} > ${.TARGET}
49175820Sru.endfor
50