# Makefile for GNU DIFF with emx+gcc under OS/2 2.0

release:
	$(MAKE) all CC="gcc -Zomf -Zmtd -O -s" O=.obj \
	REGEX=libregex.lib DYNLIB=gnuregex.dll
debug:
	$(MAKE) all CC="gcc -g" O=.o REGEX=regex.o

CFLAGS= -I. -DUSG -DOS2 -DHAVE_CONFIG_H -DHAVE_SYS_WAIT_H
LIBS =	diff.def

DIFF =	diff$O analyze$O io$O context$O ed$O normal$O util$O dir$O \
	fnmatch$O ifdef$O side$O cmpbuf$O getopt$O getopt1$O version$O
DIFF3 =	diff3$O getopt$O getopt1$O version$O
SDIFF =	sdiff$O getopt$O getopt1$O version$O
CMP =	cmp$O error$O xmalloc$O cmpbuf$O getopt$O getopt1$O version$O
DLL =	regex$O

.SUFFIXES: .c $O

.c$O:
	$(CC) $(CFLAGS) -c $<

all: $(DYNLIB) diff.exe diff3.exe sdiff.exe cmp.exe

diff.exe: $(DIFF) $(REGEX)
	$(CC) $(DIFF) $(REGEX) -o $@ $(LIBS)

diff3.exe: $(DIFF3)
	$(CC) $(DIFF3) -o $@ $(LIBS)

sdiff.exe: $(SDIFF) 
	$(CC) $(SDIFF) -o $@ $(LIBS)

cmp.exe: $(CMP) 
	$(CC) $(CMP) -o $@ $(LIBS)

gnuregex.dll: gnuregex.def $(DLL)
	$(CC) -Zdll $(DLL) -o $@ gnuregex.def

libregex.lib: gnuregex.def
	emximp -o libregex.imp gnuregex.def
	emximp -o $@ libregex.imp
	rm -f libregex.imp

$(DIFF): diff.h

context$O diff$O: regex.h

clean:
	rm -f *.o *.obj *.lib
