# Makefile for GNU textutils programs.
# Do not use this makefile directly, but only from `../Makefile'.
# Copyright (C) 1991 Free Software Foundation, Inc.

PROGS = cat.exe cksum.exe comm.exe csplit.exe cut.exe expand.exe fold.exe \
head.exe join.exe nl.exe od.exe paste.exe pr.exe sort.exe split.exe sum.exe \
tac.exe tail.exe tr.exe unexpand.exe uniq.exe wc.exe

.SUFFIXES: .c $O

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

.PHONY: all
all: $(PROGS)

$(PROGS): version$O gnutext.def

cat.exe: cat$O
	$(CC) -o $@ cat$O $(LDFLAGS) $(LIBS)

cksum.exe: cksum$O
	$(CC) -o $@ cksum$O $(LDFLAGS) $(LIBS)

comm.exe: comm$O
	$(CC) -o $@ comm$O $(LDFLAGS) $(LIBS)

csplit.exe: csplit$O
	$(CC) -o $@ csplit$O $(LDFLAGS) $(LIBS)

cut.exe: cut$O
	$(CC) -o $@ cut$O $(LDFLAGS) $(LIBS)

expand.exe: expand$O
	$(CC) -o $@ expand$O $(LDFLAGS) $(LIBS)

fold.exe: fold$O
	$(CC) -o $@ fold$O $(LDFLAGS) $(LIBS)

head.exe: head$O
	$(CC) -o $@ head$O $(LDFLAGS) $(LIBS)

join.exe: join$O long-options$O
	$(CC) -o $@ join$O long-options$O $(LDFLAGS) $(LIBS)

nl.exe: nl$O
	$(CC) -o $@ nl$O $(LDFLAGS) $(LIBS)

od.exe: od$O
	$(CC) -o $@ od$O $(LDFLAGS) $(LIBS)

paste.exe: paste$O
	$(CC) -o $@ paste$O $(LDFLAGS) $(LIBS)

pr.exe: pr$O
	$(CC) -o $@ pr$O $(LDFLAGS) $(LIBS)

sort.exe: sort$O long-options$O
	$(CC) -o $@ sort$O long-options$O $(LDFLAGS) $(LIBS)
#	emxbind -a $@ -h32

split.exe: split$O
	$(CC) -o $@ split$O $(LDFLAGS) $(LIBS)

sum.exe: sum$O
	$(CC) -o $@ sum$O $(LDFLAGS) $(LIBS)

tac.exe: tac$O
	$(CC) -o $@ tac$O $(LDFLAGS) $(LIBS)

tail.exe: tail$O
	$(CC) -o $@ tail$O $(LDFLAGS) $(LIBS)

tr.exe: tr$O
	$(CC) -o $@ tr$O $(LDFLAGS) $(LIBS)

unexpand.exe: unexpand$O
	$(CC) -o $@ unexpand$O $(LDFLAGS) $(LIBS)

uniq.exe: uniq$O
	$(CC) -o $@ uniq$O $(LDFLAGS) $(LIBS)

wc.exe: wc$O
	$(CC) -o $@ wc$O $(LDFLAGS) $(LIBS)

# Compilation rules.

nl$O tac$O: ../lib/regex.h
comm$O nl$O uniq$O: ../lib/linebuffer.h
cat$O cksum$O comm$O csplit$O cut$O expand$O fold$O head$O: system.h
join$O nl$O od$O paste$O pr$O sort$O split$O sum$O tac$O: system.h
tail$O tr$O unexpand$O uniq$O wc$O: system.h
join$O sort$O long-options$O: long-options.h

clean:
	rm -f *.o *.obj
