# $Id$ # Makefile for zlib, derived from Makefile.dj2. # Modified for mingw32 by C. Spieler, 6/16/98. # Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003. # Last updated: 1-Aug-2003. # Tested under Cygwin and MinGW. # Copyright (C) 1995-2003 Jean-loup Gailly. # For conditions of distribution and use, see copyright notice in zlib.h # To compile, or to compile and test, type: # # make -fmakefile.gcc; make test testdll -fmakefile.gcc # # To use the asm code, type: # cp contrib/asm?86/match.S ./match.S # make LOC=-DASMV OBJA=match.o -fmakefile.gcc # # To install libz.a, zconf.h and zlib.h in the system directories, type: # # make install -fmakefile.gcc # Note: # If the platform is *not* MinGW (e.g. it is Cygwin or UWIN), # the DLL name should be changed from "zlib1.dll". STATICLIB = libz.a SHAREDLIB = zlib1.dll IMPLIB = libz.dll.a #LOC = -DASMV #LOC = -DDEBUG -g CC = i686-w64-mingw32-gcc CFLAGS = $(LOC) -march=i586 -O3 -Wall AS = $(CC) ASFLAGS = $(LOC) -march=i586 -Wall LD = $(CC) LDFLAGS = $(LOC) -s AR = i686-w64-mingw32-ar ARFLAGS = rcs RC = i686-w64-mingw32-windres RCFLAGS = --define GCC_WINDRES STRIP = i686-w64-mingw32-strip CP = cp -fp # If GNU install is available, replace $(CP) with install. INSTALL = install RM = rm -f prefix = /usr/i586-w64-mingw32 exec_prefix = $(prefix) srcdir=../../src INCLUDE_PATH=$(DESTDIR)$(prefix)/include LIBRARY_PATH=$(DESTDIR)$(prefix)/lib BIN_PATH=$(DESTDIR)$(exec_prefix)/bin OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \ gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o OBJA = all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe test: example.exe minigzip.exe ./example.exe echo hello world | ./minigzip.exe | ./minigzip.exe -d testdll: example_d.exe minigzip_d.exe ./example_d.exe echo hello world | ./minigzip_d.exe | ./minigzip_d.exe -d %.o: $(srcdir)/%.c $(CC) $(CFLAGS) -c -o $@ $< %.o: $(srcdir)/%.S $(AS) $(ASFLAGS) -c -o $@ $< $(STATICLIB): $(OBJS) $(OBJA) $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA) $(IMPLIB): $(SHAREDLIB) $(SHAREDLIB): $(srcdir)/win32/zlib.def $(OBJS) $(OBJA) zlibrc.o $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \ -o $@ $(srcdir)/win32/zlib.def $(OBJS) $(OBJA) zlibrc.o $(STRIP) $@ example.exe: example.o $(STATICLIB) $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB) minigzip.exe: minigzip.o $(STATICLIB) $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB) example_d.exe: example.o $(IMPLIB) $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB) minigzip_d.exe: minigzip.o $(IMPLIB) $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB) zlibrc.o: $(srcdir)/win32/zlib1.rc $(RC) $(RCFLAGS) -o $@ $(srcdir)/win32/zlib1.rc # INCLUDE_PATH and LIBRARY_PATH must be set. .PHONY: install uninstall clean install: $(srcdir)/zlib.h $(srcdir)/zconf.h $(LIB) -mkdir -p $(INCLUDE_PATH) -mkdir -p $(LIBRARY_PATH) -mkdir -p $(BIN_PATH) -$(INSTALL) $(srcdir)/zlib.h $(INCLUDE_PATH) -$(INSTALL) $(srcdir)/zconf.h $(INCLUDE_PATH) -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH) -$(INSTALL) $(IMPLIB) $(LIBRARY_PATH) -$(INSTALL) $(SHAREDLIB) $(BIN_PATH) cd $(LIBRARY_PATH) && ln -s ../bin/zlib1.dll libz.dll uninstall: -$(RM) $(INCLUDE_PATH)/zlib.h -$(RM) $(INCLUDE_PATH)/zconf.h -$(RM) $(LIBRARY_PATH)/$(STATICLIB) -$(RM) $(LIBRARY_PATH)/$(IMPLIB) -$(RM) $(LIBRARY_PATH)/libz.dll clean: -$(RM) $(STATICLIB) -$(RM) $(SHAREDLIB) -$(RM) $(IMPLIB) -$(RM) *.o -$(RM) *.exe -$(RM) foo.gz adler32.o: $(srcdir)/zlib.h $(srcdir)/zconf.h compress.o: $(srcdir)/zlib.h $(srcdir)/zconf.h crc32.o: $(srcdir)/crc32.h $(srcdir)/zlib.h $(srcdir)/zconf.h deflate.o: $(srcdir)/deflate.h $(srcdir)/zutil.h $(srcdir)/zlib.h $(srcdir)/zconf.h example.o: $(srcdir)/zlib.h $(srcdir)/zconf.h gzio.o: $(srcdir)/zutil.h $(srcdir)/zlib.h $(srcdir)/zconf.h inffast.o: $(srcdir)/zutil.h $(srcdir)/zlib.h $(srcdir)/zconf.h $(srcdir)/inftrees.h $(srcdir)/inflate.h $(srcdir)/inffast.h inflate.o: $(srcdir)/zutil.h $(srcdir)/zlib.h $(srcdir)/zconf.h $(srcdir)/inftrees.h $(srcdir)/inflate.h $(srcdir)/inffast.h infback.o: $(srcdir)/zutil.h $(srcdir)/zlib.h $(srcdir)/zconf.h $(srcdir)/inftrees.h $(srcdir)/inflate.h $(srcdir)/inffast.h inftrees.o: $(srcdir)/zutil.h $(srcdir)/zlib.h $(srcdir)/zconf.h $(srcdir)/inftrees.h minigzip.o: $(srcdir)/zlib.h $(srcdir)/zconf.h trees.o: $(srcdir)/deflate.h $(srcdir)/zutil.h $(srcdir)/zlib.h $(srcdir)/zconf.h $(srcdir)/trees.h uncompr.o: $(srcdir)/zlib.h $(srcdir)/zconf.h zutil.o: $(srcdir)/zutil.h $(srcdir)/zlib.h $(srcdir)/zconf.h