386BSD 0.1 development
[unix-history] / usr / src / usr.bin / diff / Makefile.gnu
CommitLineData
39af70d6
WJ
1# Makefile for GNU DIFF
2# Copyright (C) 1988, 1989 Free Software Foundation, Inc.
3
4# This file is part of GNU DIFF.
5
6# GNU DIFF is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 1, or (at your option)
9# any later version.
10#
11# GNU DIFF is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with GNU DIFF; see the file COPYING. If not, write to
18# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20# You can compile this with ordinary cc as well,
21# but gcc makes it faster.
22# Also, gcc supports -O and -g together.
23CC=gcc -O
24CFLAGS =
25INSTALL = install
26
27# On system V, enable these three lines:
28# CFLAGS = -g -DUSG
29# LIBS = -lPW
30# INSTALL = cp
31# (If you compile with GCC, you don't need to define LIBS.)
32# And, depending on the names and contents of your header files,
33# add either -DHAVE_NDIR or -DHAVE_DIRECT or both to CFLAGS.
34# Add -DHAVE_NDIR to CFLAGS if your system used ndir.h instead of dirent.h
35# Add -DHAVE_DIRECT to CFLAGS if your system uses 'struct direct' instead of
36# 'struct dirent' (this is the case at least with one add-on ndir library).
37
38# Use these definitions for XENIX:
39# There are rumors of bugs in various Xenix's dirent.h and -ldir. As
40# a result, we suggest using HAVE_NDIR and not using -ldir.
41# CFLAGS = -O -DUSG -DXENIX -DHAVE_NDIR -DHAVE_DIRECT -DNDIR_IN_SYS
42# LIBS = -lx -lPW
43# INSTALL = cp
44
45# Some System V machines do not come with libPW. If this is true, use
46# the GNU alloca by switching the comment on the following lines.
47ALLOCA =
48# ALLOCA = $(archpfx)/alloca.o
49
50bindir=/usr/contrib/bin
51prefix=
52
53# All source files
54srcs=diff.c analyze.c io.c context.c ed.c normal.c ifdef.c util.c dir.c \
55 version.c diff.h regex.c regex.h limits.h diff3.c \
56 getopt.c getopt1.c getopt.h alloca.c
57# Object files for diff only.
58objs=$(archpfx)diff.o $(archpfx)analyze.o $(archpfx)io.o $(archpfx)context.o \
59 $(archpfx)ed.o $(archpfx)normal.o $(archpfx)util.o $(archpfx)dir.o \
60 $(archpfx)regex.o $(archpfx)ifdef.o $(archpfx)version.o \
61 $(archpfx)getopt.o $(archpfx)getopt1.o
62tapefiles = $(srcs) README diagmeet.note Makefile COPYING ChangeLog
63
64all: $(archpfx)diff $(archpfx)diff3
65
66$(archpfx)diff3: $(archpfx)diff3.o
67 $(CC) -o $(archpfx)diff3 $(CFLAGS) $(LDFLAGS) $(archpfx)diff3.o $(LIBS)
68
69$(archpfx)diff: $(objs)
70 $(CC) -o $(archpfx)diff $(CFLAGS) $(LDFLAGS) $(objs) $(LIBS)
71
72$(objs): diff.h
73
74$(archpfx)context.o $(archpfx)diff.o: regex.h
75
76$(archpfx)diff3.o: diff3.c
77 $(CC) -c $(CFLAGS) -DDIFF_PROGRAM=\"$(bindir)/diff\" diff3.c \
78 $(OUTPUT_OPTION)
79
80clean:
81 rm -f *.o $(archpfx)diff $(archpfx)diff3 diff.tar diff.tar.Z
82
83install: install-diff install-diff3
84
85install-diff: $(prefix)$(bindir)/diff
86
87$(prefix)$(bindir)/diff: $(archpfx)diff
88 $(INSTALL) $(archpfx)diff $(prefix)$(bindir)/diff
89
90install-diff3: $(prefix)$(bindir)/diff3
91
92$(prefix)$(bindir)/diff3: $(archpfx)diff3
93 $(INSTALL) $(archpfx)diff3 $(prefix)$(bindir)/diff3
94
95diff.tar: $(tapefiles)
96 mkdir tmp
97 mkdir tmp/diff
98 -ln $(tapefiles) tmp/diff
99 for file in $(tapefiles); do \
100 if [ ! -r tmp/diff/$$file ]; then cp $$file tmp/diff; fi \
101 done
102 cd tmp; tar cf ../diff.tar diff
103 rm -rf tmp
104
105diff.tar.Z: diff.tar
106 compress < diff.tar > diff.tar.Z