# Makefile for GNU DIFF with emx+gcc under OS/2 2.x or DOS

os2:
	$(MAKE) diff.exe diff3.exe gnuregex.dll \
	CC="gcc -Zomf -Zmtd -O -s" O=.obj REGEX=regex.lib
dos:
	$(MAKE) diff.exe CC="gcc -O -s" O=.o REGEX=regex.o

CFLAGS= -I. -DUSG -DOS2 -DHAVE_CONFIG_H -DHAVE_SYS_WAIT_H

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 $@ diff.def

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

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

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

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

regex.lib: gnuregex.def
	emximp -o $@ gnuregex.def

$(DIFF): diff.h

context$O diff$O: regex.h

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