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

OBJECTS = dirname$O error$O filemode$O getopt$O getopt1$O \
listfile$O modechange$O nextelem$O savedir$O xmalloc$O xstrdup$O \
fnmatch$O stpcpy$O version$O
REGEX = regex$O

.PHONY: lib dll
lib: libfind.a
dll: libfind.lib gnufind.dll libregex.lib gnuregex.dll

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

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

libfind.lib: gnufind.def
	emximp -o libfind.imp gnufind.def
	emximp -o $@ libfind.imp
	rm -f libfind.imp

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

gnufind.dll: gnufind.def dllmain$O $(OBJECTS)
	$(CC) -Zdll gnufind.def -o $@ dllmain$O $(OBJECTS) -los2

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

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