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

OBJECTS = error$O getopt$O getopt1$O linebuffer$O xmalloc$O xwrite$O \
stpcpy$O strcase$O
REGEX = regex$O

.SUFFIXES: .c $O

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

.PHONY: lib dll
lib: libtu.a
dll: libtu.lib gnutu.dll libregex.lib gnuregex.dll

libtu.a: $(OBJECTS) $(REGEX)
	rm -f $@
	$(AR) cr $@ $(OBJECTS) $(REGEX)
	$(RANLIB) $@

libtu.lib: gnutu.def
	emximp -o libtu.imp gnutu.def
	emximp -o $@ libtu.imp
	rm -f libtu.imp

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

gnutu.dll: gnutu.def $(OBJECTS)
	$(CC) -Zdll gnutu.def -o $@ $(OBJECTS)

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

getopt1$O: getopt.h
regex$O: regex.h

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