# Makefile for GNU DIFF
# *** Special Amiga Version *** SAS C LMK ***

CC	= LC:lc -O -cus
CFLAGS	= -DAMIGA -DSTDC_HEADERS -D__CHAR_UNSIGNED__ -DCHAR_UNSIGNED
L0	= LC:blink FROM LIB:c.o
L1	= LIBRARY LIB:lc.lib LIB:amiga.lib

objs = diff.o analyze.o io.o context.o ed.o normal.o util.o dir.o \
     regex.o ifdef.o version.o getopt.o getopt1.o fixupname.o alloca.o

diff: $(objs)
	$(L0) $(objs) TO diff $(L1)

alloca.o: alloca.c
	$(CC) $(CFLAGS) -DSTACK_DIRECTION=(-1) alloca.c

analyze.o: analyze.c diff.h regex.h
	$(CC) $(CFLAGS) analyze.c

context.o: context.c diff.h regex.h
	$(CC) $(CFLAGS) context.c

diff.o: diff.c diff.h regex.h
	$(CC) $(CFLAGS) diff.c

dir.o: dir.c diff.h regex.h
	$(CC) $(CFLAGS) dir.c

ed.o: ed.c diff.h regex.h
	$(CC) $(CFLAGS) ed.c

getopt.o: getopt.c diff.h regex.h
	$(CC) $(CFLAGS) getopt.c

getopt1.o: getopt1.c diff.h regex.h
	$(CC) $(CFLAGS) getopt1.c

ifdef.o: ifdef.c diff.h regex.h
	$(CC) $(CFLAGS) ifdef.c

io.o: io.c diff.h regex.h
	$(CC) $(CFLAGS) io.c

normal.o: normal.c diff.h regex.h
	$(CC) $(CFLAGS) normal.c

regex.o: regex.c regex.h
  LC:lc -p -oregex.p.c $(CFLAGS) regex.c	# LC by itself barfs here...
  $(CC) -oregex.o regex.p			# This if lots of memory...
# LC:lc -cus -oregex.o regex.p			# This if few memory...
  delete regex.p.c

util.o: util.c diff.h regex.h
	$(CC) $(CFLAGS) util.c

version.o: version.c diff.h regex.h
	$(CC) $(CFLAGS) version.c

fixupname.o: fixupname.c
	$(CC) $(CFLAGS) fixupname.c
