386BSD 0.1 development
[unix-history] / usr / src / usr.bin / file / Makefile.ian
CommitLineData
e8e4ca4c
WJ
1# Makefile for file(1) cmd.
2# Copyright (c) Ian F. Darwin 86/09/01 - see LEGAL.NOTICE.
3# @(#)$Header: Makefile,v 1.17 88/01/15 13:03:16 ian Exp $
4#
5CC = cc
6SHELL = /bin/sh
7MAGIC = /etc/magic
8DEFS = -DMAGIC='"$(MAGIC)"' # -Dvoid=int
9COPTS = -g
10CFLAGS = $(COPTS) $(DEFS)
11SHAR = bundle
12OFILE = /bin/file.orig # old or distributed version, for comparison
13# Where new binary lives; typically /usr/local (BSD), /usr/lbin (USG).
14BINDIR = /usr/local
15# For installing our man pages;
16# MANCxxx is manual section for Commands, MANFxxx is section for file formats.
17# MANxDIR is directory names; MANxEXT is the filename extention. Usual values:
18# Variable V7 4BSD Sys V
19# MANCDIR /usr/man/man1 /usr/man/man1 /usr/man/u_man/man1
20# MANFDIR /usr/man/man5 /usr/man/man5 /usr/man/u_man/man4
21# MANCEXT 1 1 1
22# MANFEXT 5 5 4
23# --- possible alternative for 4BSD ---
24# MANCDIR /usr/man/manl
25# MANCEXT l
26# --- possible alternative for USG ---
27# MANCDIR /usr/man/local/man1
28# MANCEXT 1
29
30MANCDIR = /usr/man/manl
31MANFDIR = /usr/man/man5
32MANCEXT = l
33MANFEXT = 5
34
35# There are no system-dependant configuration options (except maybe CFLAGS).
36# Delete any of LOCALSRCS and LOCALOBJS that are in your C library.
37LOCALSRCS = getopt.c strtol.c strtok.c strchr.c
38SRCS = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c is_tar.c \
39 print.c $(LOCALSRCS)
40#LOCALOBJS = getopt.o strtol.o strtok.o strchr.o
41LOCALOBJS = # getopt.o strtol.o strtok.o strchr.o
42OBJS = file.o apprentice.o fsmagic.o softmagic.o ascmagic.o is_tar.o \
43 print.o $(LOCALOBJS)
44
45ALLSRC = LEGAL.NOTICE README PORTING $(SRCS) *.h \
46 Makefile file.1 magic.4 magdir/[a-z]* tst/Makefile
47
48all: file magic
49
50try: all $(OFILE)
51 cd tst; make
52 time $(OFILE) -m ./magic * tst/* >/tmp/t1
53 time ./file -m ./magic * tst/* >/tmp/t2
54 -diff -b /tmp/t[12]
55 what ./file >lastnocore
56
57file: $(OBJS)
58 $(CC) $(CFLAGS) $(OBJS) -o $@
59lint: $(SRCS)
60 lint -ha $(DEFS) $(SRCS) | tee $@
61magic: magdir
62# exclude RCS or SCCS dirs:
63 cat magdir/[a-z]* >$@
64
65ascmagic.o: names.h
66
67apprentice.o ascmagic.o file.o fsmagic.o print.o softmagic.o: file.h
68
69install: file magic file.1 magic.4 $(BINDIR) $(MANCDIR) $(MANCDIR)
70 cp file $(BINDIR)/file
71 cp magic $(MAGIC)
72 cp file.1 $(MANCDIR)/file.$(MANCEXT)
73 cp magic.4 $(MANFDIR)/magic.$(MANFEXT)
74
75clean:
76 rm -f *.o file magic lint.out
77 (cd tst; make clean)
78
79dist: $(ALLSRC)
80# Some versions of shar can't handle a single file from
81# a subdirectory, so we manually insert mkdir as needed.
82# Put the extra "mkdir" AFTER the ": to unbundle..." line.
83 $(SHAR) $(ALLSRC) | sed -e '1a\
84 mkdir magdir tst' >$@
85