xref: /freebsd/usr.bin/file/Makefile (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1c7510038SGeoff Rehmet# Makefile for file(1) cmd.
280c86c36SDavid E. O'Brien# Copyright (c) David E. O'Brien, 2000-2004, 2009
3c7510038SGeoff Rehmet# Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
4c7510038SGeoff Rehmet#
5c7510038SGeoff Rehmet# This software is not subject to any license of the American Telephone
6c7510038SGeoff Rehmet# and Telegraph Company or of the Regents of the University of California.
7c7510038SGeoff Rehmet#
8c7510038SGeoff Rehmet# Permission is granted to anyone to use this software for any purpose on
9c7510038SGeoff Rehmet# any computer system, and to alter it and redistribute it freely, subject
10c7510038SGeoff Rehmet# to the following restrictions:
11c7510038SGeoff Rehmet#
12c7510038SGeoff Rehmet# 1. The author is not responsible for the consequences of use of this
13c7510038SGeoff Rehmet#    software, no matter how awful, even if they arise from flaws in it.
14c7510038SGeoff Rehmet# 2. The origin of this software must not be misrepresented, either by
15c7510038SGeoff Rehmet#    explicit claim or by omission.  Since few users ever read sources,
16c7510038SGeoff Rehmet#    credits must appear in the documentation.
17c7510038SGeoff Rehmet# 3. Altered versions must be plainly marked as such, and must not be
18c7510038SGeoff Rehmet#    misrepresented as being the original software.  Since few users
19c7510038SGeoff Rehmet#    ever read sources, credits must appear in the documentation.
20c7510038SGeoff Rehmet# 4. This notice may not be removed or altered.
21c7510038SGeoff Rehmet
22*1581ec9aSEric van Gyzen.include <src.opts.mk>
23*1581ec9aSEric van Gyzen
24a35f04fbSWarner LoshSRCDIR=	${SRCTOP}/contrib/file
25b6cee71dSXin LI.PATH: ${SRCDIR}/src
26b6cee71dSXin LI.PATH: ${SRCDIR}/doc
27de16accdSDavid E. O'Brien
2853d5f088SGeoff RehmetPROG=	file
29c7510038SGeoff Rehmet
307866c62aSDavid E. O'BrienMAGICPATH?=	/usr/share/misc
31bef2f61dSDavid E. O'Brien
32c44c5361SDavid E. O'BrienCFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DHAVE_CONFIG_H
33a35f04fbSWarner LoshCFLAGS+= -I${SRCTOP}/lib/libmagic
34c7510038SGeoff Rehmet
353e11bd9eSBaptiste DaroussinLIBADD=	magic
361687fcd3SDavid E. O'Brien
373aefeab5SRuslan ErmilovFILEVER!= awk '$$1 == "\#define" && $$2 == "VERSION" { print $$3; exit }' \
38a35f04fbSWarner Losh			${SRCTOP}/lib/libmagic/config.h
393aefeab5SRuslan Ermilov
403aefeab5SRuslan ErmilovCLEANFILES+=	${MAN}
413aefeab5SRuslan Ermilov
42*1581ec9aSEric van GyzenHAS_TESTS=
43*1581ec9aSEric van GyzenSUBDIR.${MK_TESTS}+= tests
44*1581ec9aSEric van Gyzen
4553d5f088SGeoff Rehmet.include <bsd.prog.mk>
463aefeab5SRuslan Ermilov
473aefeab5SRuslan Ermilov.for mp in ${MAN}
483aefeab5SRuslan Ermilov${mp}: ${mp:C/[0-9]/man/}
493aefeab5SRuslan Ermilov	sed -e 's/__FSECTION__/5/g' -e 's/__CSECTION__/1/g' \
503aefeab5SRuslan Ermilov		-e 's/__VERSION__/${FILEVER}/g' \
513aefeab5SRuslan Ermilov		-e 's,__MAGIC__,${MAGICPATH}/magic,g' ${.ALLSRC} > ${.TARGET}
523aefeab5SRuslan Ermilov.endfor
53