1# Makefile for file(1) cmd. 2# Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE. 3# @(#)$FreeBSD$ 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# 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# 19# 3. Altered versions must be plainly marked as such, and must not be 20# misrepresented as being the original software. Since few users 21# ever read sources, credits must appear in the documentation. 22# 23# 4. This notice may not be removed or altered. 24# 25# Hacked and dismembered for bmake (Geoff Rehmet). 26 27MAGICFILE= /usr/share/misc/magic 28MAGICMODE= 444 29 30SRCDIR= ${.CURDIR}/../../contrib/file 31.PATH: ${SRCDIR} 32 33CFLAGS+= -DMAGIC='"$(MAGICFILE)"' -DBUILTIN_ELF -DELFCORE -DHAVE_CONFIG_H 34CFLAGS+= -I${.CURDIR} 35 36PROG= file 37SRCS= file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \ 38 compress.c is_tar.c readelf.c print.c 39# compress.c is_tar.c readelf.c internat.c print.c 40 41MAN1= file.1 42MAN5= magic.5 43 44CLEANFILES+= magic file.1 magic.5 version 45 46MAGFILES= ${SRCDIR}/Header\ 47 ${SRCDIR}/Localstuff\ 48 ${SRCDIR}/Magdir/[a-z]* 49 50all: file magic 51 52magic: $(MAGFILES) 53 cat $(MAGFILES) > $(.TARGET) 54 55version: Makefile.std 56 @sed '/.*VERSION.*=[ ]*/s///w ${.TARGET}' ${.ALLSRC} > /dev/null 57 58.for MP in file.1 magic.5 59${MP}: ${SRCDIR}/${MP:C/[0-9]$/man/} version 60 sed -e 's|__CSECTION__|1|g'\ 61 -e 's|__FSECTION__|5|g'\ 62 -e 's|__MAGIC__|${MAGICFILE}|g'\ 63 -e "s|__VERSION__|`cat version`|g"\ 64 ${SRCDIR}/${MP:C/[0-9]$/man/} > ${.TARGET} 65.endfor 66 67beforeinstall: 68 $(INSTALL) $(COPY) -o $(BINOWN) -g $(BINGRP) -m $(MAGICMODE) \ 69 magic $(DESTDIR)$(MAGICFILE) 70 71.include <bsd.prog.mk> 72