xref: /dragonfly/usr.bin/file/Makefile (revision 17b61719)
1# $FreeBSD: src/usr.bin/file/Makefile,v 1.13.2.8 2003/03/16 04:47:04 obrien Exp $
2# $DragonFly: src/usr.bin/file/Makefile,v 1.3 2004/03/22 20:58:27 dillon Exp $
3# Makefile for file(1) cmd.
4# Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
5#
6# This software is not subject to any license of the American Telephone
7# and Telegraph Company or of the Regents of the University of California.
8#
9# Permission is granted to anyone to use this software for any purpose on
10# any computer system, and to alter it and redistribute it freely, subject
11# to the following restrictions:
12#
13# 1. The author is not responsible for the consequences of use of this
14#    software, no matter how awful, even if they arise from flaws in it.
15# 2. The origin of this software must not be misrepresented, either by
16#    explicit claim or by omission.  Since few users ever read sources,
17#    credits must appear in the documentation.
18# 3. Altered versions must be plainly marked as such, and must not be
19#    misrepresented as being the original software.  Since few users
20#    ever read sources, credits must appear in the documentation.
21# 4. This notice may not be removed or altered.
22
23SRCDIR=	${.CURDIR}/../../contrib/file
24.PATH: ${SRCDIR}
25
26PROG=	file
27MAN=	file.1 magic.5
28SRCS=	file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \
29	compress.c is_tar.c  readelf.c print.c
30#	compress.c is_tar.c  readelf.c internat.c print.c
31
32MAGICPATH=	/usr/share/misc
33
34CFLAGS+= -DMAGIC='"${MAGICPATH}/magic"' -DBUILTIN_ELF -DELFCORE -DHAVE_CONFIG_H
35CFLAGS+= -I${.CURDIR} -I${SRCDIR}
36
37LDADD+=	-lz
38DPADD+=	${LIBZ}
39
40CLEANFILES+=	magic magic.mgc magic.mime.mgc magic.mime.PITA
41
42FILES=		magic magic.mgc ${SRCDIR}/magic.mime magic.mime.mgc
43FILESDIR=	${MAGICPATH}
44
45MAGFILES=	${SRCDIR}/Header\
46		${SRCDIR}/Localstuff\
47		${SRCDIR}/Magdir/[a-z]*
48
49all: ${PROG} magic.mgc magic.mime.mgc
50
51magic: ${MAGFILES}
52	cat ${.ALLSRC} > ${.TARGET}
53
54magic.mgc: mkmagic.nx magic
55	./mkmagic.nx magic
56
57magic.mime.mgc: mkmagic.nx magic.mime
58	ln -sf ${SRCDIR}/magic.mime magic.mime.PITA
59	./mkmagic.nx magic.mime.PITA
60	mv magic.mime.PITA.mgc magic.mime.mgc
61
62CLEANFILES+=	mkmagic.nx
63build-tools: mkmagic.nx
64mkmagic.nx: apprentice.c print.c
65	${NXCC} -DHAVE_CONFIG_H -DCOMPILE_ONLY \
66	    -I${.CURDIR} -I${SRCDIR} -o ${.TARGET} ${.ALLSRC}
67
68.include <bsd.prog.mk>
69