# 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 = x86_64-pc-mingw32-gcc CFLAGS = $(LOC) -O3 -Wall AS = $(CC) ASFLAGS = $(LOC) -Wall LD = $(CC) LDFLAGS = $(LOC) -s AR = x86_64-pc-mingw32-ar ARFLAGS = rcs RC = x86_64-pc-mingw32-windres RCFLAGS = --define GCC_WINDRES STRIP = x86_64-pc-mingw32-strip DLLWRAP = x86_64-pc-mingw32-dllwrap CP = cp -fp # If GNU install is available, replace $(CP) with install. INSTALL = install RM = rm -f prefix = /usr/x86_64-pc-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 gzio.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 $(DLLWRAP) --driver-name $(CC) --def $(srcdir)/win32/zlib.def \ --implib $(IMPLIB) -o $@ $(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