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

OBJECTS = argmatch$O backupfile$O basename$O dirname$O eaccess$O \
error$O filemode$O fnmatch$O fsusage$O getopt$O getopt1$O userspec$O \
getversion$O idcache$O isdir$O makepath$O modechange$O savedir$O stpcpy$O \
stripslash$O xgetcwd$O xmalloc$O xstrdup$O yesno$O getdate$O posixtm$O \
mountlist$O os2ea$O disktape$O diskacc$O

.SUFFIXES: .c $O

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

.PHONY: lib dll
lib: libfu.a
dll: libfu.lib gnufu.dll

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

libfu.lib: gnufu.def
	emximp -o libfu.imp gnufu.def
	emximp -o $@ libfu.imp
	rm -f libfu.imp

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

getdate.c: getdate.y
	bison -o getdate.c getdate.y

posixtm.c: posixtm.y
	bison -o posixtm.tab.c posixtm.y
	sed -e "s/yy/zz/g" posixtm.tab.c > posixtm.c
	rm -f posixtm.tab.c

backupfile$O getversion$O: backupfile.h
fnmatch$O: fnmatch.h
fsusage$O: fsusage.h
getopt1$O: getopt.h
modechange$O: modechange.h
mountlist$O: mountlist.h

clean:
	rm -f *.o *.obj *.a *.lib getdate.c posixtm.c
