# Makefile for GNU DIFF
# Copyright (C) 1988, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
#
# This file is part of GNU DIFF.
#
# GNU DIFF is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# GNU DIFF is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU DIFF; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

#### Start of system configuration section. ####

srcdir =
VPATH =

CC = SC
INSTALL = COPY CLONE
INSTALL_PROGRAM = COPY CLONE
INSTALL_DATA = COPY CLONE
MAKEINFO = makeinfo

DEFS = RESOPT "DEF=PR_FILE_NAME=*"LP*"" DEF=HAVE_CONFIG_H

CFLAGS = IGNORE=84,85,93,100,104,120,149,154,161 DEF=_AMIGA=1 DEF=AMIGA=1 \
    ANSI STRICT ERROR=ALL DEF=_STRICT_ANSI\
    "DEF=PRGVERSION=*"$$VER: HWGDIFFUTILSp1 2.6 (26.1.94) Changes 1993,1994 by HWG, For Joan Thuesen*""\
    IDIR=\
    NOSTKCHK PPBUF=16384\
    DEF=USE_BUILTIN_MATH DEF=__USE_SYSBASE\
    OPT

LDFLAGS = LINK MAP
LIBS = STRT=cres LIB hwgunix.lib

# Some System V machines do not come with libPW.
# If this is true for you, use the GNU alloca.o here.
ALLOCA = alloca.o

prefix =
exec_prefix =

# Prefix for each installed program, normally empty or `g'.
binprefix =

bindir =

infodir =

#### End of system configuration section. ####

SHELL =

# The source files for all of the programs.
srcs=diff.c analyze.c cmpbuf.c cmpbuf.h io.c context.c ed.c normal.c ifdef.c \
        util.c dir.c \
        version.c diff.h regex.c regex.h side.c system.h \
        diff3.c sdiff.c cmp.c error.c xmalloc.c getopt.c getopt1.c getopt.h \
        fnmatch.c fnmatch.h alloca.c\
        amiga.c
# Object files for diff only.
diff_o = diff.o analyze.o cmpbuf.o dir.o io.o util.o \
        context.o ed.o ifdef.o normal.o side.o \
        fnmatch.o getopt.o getopt1.o regex.o version.o $(ALLOCA) amiga.o
distfiles = $(srcs) README INSTALL NEWS diagmeet.note Makefile.in configure \
        configure.in COPYING ChangeLog diff.texi diff.info* texinfo.tex

all: config.h diff diff3 sdiff cmp diff.info

config.h:   config.h.amiga
    @copy   config.h.amiga config.h clone quiet

.c.o:
        $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) $<

amiga.o: amiga.c smakefile
        $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) $<

diff: $(diff_o)
        $(CC) TO $@ $(LDFLAGS) $(diff_o) $(LIBS)

diff3_o = diff3.o getopt.o getopt1.o version.o amiga.o
diff3: $(diff3_o)
        $(CC) TO $@ $(LDFLAGS) $(diff3_o) $(LIBS)

sdiff_o = sdiff.o getopt.o getopt1.o version.o amiga.o
sdiff: $(sdiff_o)
        $(CC) TO $@ $(LDFLAGS) $(sdiff_o) $(LIBS)

cmp_o = cmp.o cmpbuf.o error.o getopt.o getopt1.o xmalloc.o version.o amiga.o
cmp: $(cmp_o)
        $(CC) TO $@ $(LDFLAGS) $(cmp_o) $(LIBS)

diff.guide: diff.texi
        $(MAKEINFO) --amiga $(srcdir)/diff.texi
        @delete >NIL: diff.guide force quiet
        @rename diff.info diff.guide

diff.info: diff.texi
        $(MAKEINFO) $(srcdir)/diff.texi

$(diff_o): diff.h system.h
cmp.o diff3.o sdiff.o: system.h
context.o diff.o regex.o: regex.h
cmp.o diff.o diff3.o sdiff.o getopt.o getopt1.o: getopt.h
diff.o fnmatch.o: fnmatch.h
analyze.o cmpbuf.o cmp.o: cmpbuf.h

diff3.o: diff3.c
        $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) "DEF=DIFF_PROGRAM=*"$(bindir)diff*"" diff3.c

sdiff.o: sdiff.c
        $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) "DEF=DIFF_PROGRAM=*"$(bindir)diff*"" sdiff.c

TAGS: $(srcs)
        etags $(srcs)

clean: cleancmds cleanobjs

cleancmds:
        -DELETE FORCE diff diff3 sdiff cmp core

cleanobjs:
        -DELETE FORCE \#?.map \#?.o \#?.lnk

mostlyclean: clean

distclean: clean
        rm -f Makefile config.status

realclean: distclean
        rm -f TAGS *.info*

install: all
        -delete /bin/diff /bin/sdiff /bin/diff3 /bin/cmp all quiet
        -rename diff /bin
        -rename sdiff /bin
        -rename diff3 /bin
        -rename cmp /bin

uninstall:
        for p in diff diff3 sdiff cmp; \
        do rm -f $(bindir)/$(binprefix)$$p; done
        rm -f $(infodir)/diff.info*

dist: $(distfiles)
        echo diff-`sed -e '/version_string/!d' -e 's/[^0-9]*\([0-9a-z.]*\).*/\1/' -e q version.c` > .fname
        rm -rf `cat .fname`
        mkdir `cat .fname`
        -ln $(distfiles) `cat .fname`
        for file in $(distfiles); do \
          if [ ! -r `cat .fname`/$$file ]; then cp -p $$file `cat .fname`; fi \
        done
        tar chZf `cat .fname`.tar.Z `cat .fname`
        tar chf - `cat .fname` | gzip > `cat .fname`.tar.z
        rm -rf `cat .fname` .fname

# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:

diff.o: diff.c config.h
analyze.o: analyze.c config.h
cmpbuf.o: cmpbuf.c config.h
io.o: io.c config.h
context.o: context.c config.h
ed.o: ed.c config.h
normal.o: normal.c config.h
ifdef.o: ifdef.c config.h
util.o: util.c config.h
dir.o: dir.c config.h
version.o: version.c config.h
regex.o: regex.c config.h
side.o: side.c config.h
diff3.o: diff3.c config.h
sdiff.o: sdiff.c config.h
cmp.o: cmp.c config.h
error.o: error.c config.h
xmalloc.o: xmalloc.c config.h
getopt.o: getopt.c config.h
getopt1.o: getopt1.c config.h
alloca.o: alloca.c config.h
fnmatch.o: fnmatch.c config.h


