#-*- Makefile -*-
include ../../gnuwin32/MkRules

all: makeMakedeps DLL implib headers

SOURCES = adler32.c compress.c crc32.c deflate.c infback.c \
  inffast.c inflate.c inftrees.c trees.c uncompr.c zutil.c
OBJECTS = $(SOURCES:.c=.o)

CPPFLAGS=-I../../include -DHAVE_CONFIG_H

# libz.a: $(OBJECTS)

DLL: Rzlib.dll
	@cp Rzlib.dll ../../../$(BINDIR)

Rzlib.dll: $(OBJECTS) Rzlib.def
	$(DLL) -shared $(DLLFLAGS) -o $@ Rzlib.def $(OBJECTS)

ifdef USE_IMPLIBS
implib: libRzlib.dll.a
	@$(MKDIR) -p ../../../lib
	@$(CP) libRzlib.dll.a ../../../lib
else
implib:
endif

libRzlib.dll.a: Rzlib.def

headers:
	@$(CP) -p zlib.h zconf.h ../../../include

clean:
	@$(RM) *.o *~ *.d Makedeps
distclean: clean
	@$(RM) libz.a Rzlib.dll libRzlib.dll.a

# Dependencies
DEPS=$(SOURCES:.c=.d)

makeMakedeps: $(DEPS)
	@$(RM) Makedeps
	@cat $(DEPS) >> Makedeps

-include Makedeps
