Commit | Line | Data |
---|---|---|
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 | # | |
5 | CC = cc | |
6 | SHELL = /bin/sh | |
7 | MAGIC = /etc/magic | |
8 | DEFS = -DMAGIC='"$(MAGIC)"' # -Dvoid=int | |
9 | COPTS = -g | |
10 | CFLAGS = $(COPTS) $(DEFS) | |
11 | SHAR = bundle | |
12 | OFILE = /bin/file.orig # old or distributed version, for comparison | |
13 | # Where new binary lives; typically /usr/local (BSD), /usr/lbin (USG). | |
14 | BINDIR = /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 | ||
30 | MANCDIR = /usr/man/manl | |
31 | MANFDIR = /usr/man/man5 | |
32 | MANCEXT = l | |
33 | MANFEXT = 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. | |
37 | LOCALSRCS = getopt.c strtol.c strtok.c strchr.c | |
38 | SRCS = 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 | |
41 | LOCALOBJS = # getopt.o strtol.o strtok.o strchr.o | |
42 | OBJS = file.o apprentice.o fsmagic.o softmagic.o ascmagic.o is_tar.o \ | |
43 | print.o $(LOCALOBJS) | |
44 | ||
45 | ALLSRC = LEGAL.NOTICE README PORTING $(SRCS) *.h \ | |
46 | Makefile file.1 magic.4 magdir/[a-z]* tst/Makefile | |
47 | ||
48 | all: file magic | |
49 | ||
50 | try: 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 | ||
57 | file: $(OBJS) | |
58 | $(CC) $(CFLAGS) $(OBJS) -o $@ | |
59 | lint: $(SRCS) | |
60 | lint -ha $(DEFS) $(SRCS) | tee $@ | |
61 | magic: magdir | |
62 | # exclude RCS or SCCS dirs: | |
63 | cat magdir/[a-z]* >$@ | |
64 | ||
65 | ascmagic.o: names.h | |
66 | ||
67 | apprentice.o ascmagic.o file.o fsmagic.o print.o softmagic.o: file.h | |
68 | ||
69 | install: 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 | ||
75 | clean: | |
76 | rm -f *.o file magic lint.out | |
77 | (cd tst; make clean) | |
78 | ||
79 | dist: $(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 |