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