1 # Makefile for zlib, derived from Makefile.dj2.
2 # Modified for mingw32 by C. Spieler, 6/16/98.
3 # Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003.
4 # Last updated: 1-Aug-2003.
5 # Tested under Cygwin and MinGW.
7 # Copyright (C) 1995-2003 Jean-loup Gailly.
8 # For conditions of distribution and use, see copyright notice in zlib.h
10 # To compile, or to compile and test, type:
12 # make -fmakefile.gcc; make test testdll -fmakefile.gcc
14 # To use the asm code, type:
15 # cp contrib/asm?86/match.S ./match.S
16 # make LOC=-DASMV OBJA=match.o -fmakefile.gcc
18 # To install libz.a, zconf.h and zlib.h in the system directories, type:
20 # make install -fmakefile.gcc
23 # If the platform is *not* MinGW (e.g. it is Cygwin or UWIN),
24 # the DLL name should be changed from "zlib1.dll".
34 CFLAGS = $(LOC) -O3 -Wall
37 ASFLAGS = $(LOC) -Wall
46 RCFLAGS = --define GCC_WINDRES
49 # If GNU install is available, replace $(CP) with install.
54 exec_prefix = $(prefix)
56 OBJS = adler32.o compress.o crc32.o deflate.o gzio.o infback.o \
57 inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
60 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example minigzip example_d minigzip_d
62 test: example minigzip
64 echo hello world | ./minigzip | ./minigzip -d
66 testdll: example_d minigzip_d
68 echo hello world | ./minigzip_d | ./minigzip_d -d
71 $(CC) $(CFLAGS) -c -o $@ $<
74 $(AS) $(ASFLAGS) -c -o $@ $<
76 $(STATICLIB): $(OBJS) $(OBJA)
77 $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA)
79 $(IMPLIB): $(SHAREDLIB)
81 $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
82 dllwrap --driver-name $(CC) --def win32/zlib.def \
83 --implib $(IMPLIB) -o $@ $(OBJS) $(OBJA) zlibrc.o
86 example: example.o $(STATICLIB)
87 $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
89 minigzip: minigzip.o $(STATICLIB)
90 $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
92 example_d: example.o $(IMPLIB)
93 $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
95 minigzip_d: minigzip.o $(IMPLIB)
96 $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
98 zlibrc.o: win32/zlib1.rc
99 $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
102 # INCLUDE_PATH and LIBRARY_PATH must be set.
104 .PHONY: install uninstall clean
106 install: zlib.h zconf.h $(LIB)
107 -@if not exist $(INCLUDE_PATH)/nul mkdir $(INCLUDE_PATH)
108 -@if not exist $(LIBRARY_PATH)/nul mkdir $(LIBRARY_PATH)
109 -$(INSTALL) zlib.h $(INCLUDE_PATH)
110 -$(INSTALL) zconf.h $(INCLUDE_PATH)
111 -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH)
112 -$(INSTALL) $(IMPLIB) $(LIBRARY_PATH)
115 -$(RM) $(INCLUDE_PATH)/zlib.h
116 -$(RM) $(INCLUDE_PATH)/zconf.h
117 -$(RM) $(LIBRARY_PATH)/$(STATICLIB)
118 -$(RM) $(LIBRARY_PATH)/$(IMPLIB)
128 adler32.o: zlib.h zconf.h
129 compress.o: zlib.h zconf.h
130 crc32.o: crc32.h zlib.h zconf.h
131 deflate.o: deflate.h zutil.h zlib.h zconf.h
132 example.o: zlib.h zconf.h
133 gzio.o: zutil.h zlib.h zconf.h
134 inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
135 inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
136 infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
137 inftrees.o: zutil.h zlib.h zconf.h inftrees.h
138 minigzip.o: zlib.h zconf.h
139 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
140 uncompr.o: zlib.h zconf.h
141 zutil.o: zutil.h zlib.h zconf.h