• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
6
7# Copyright (C) 1995-2003 Jean-loup Gailly.
8# For conditions of distribution and use, see copyright notice in zlib.h
9
10# To compile, or to compile and test, type:
11#
12#   make -fmakefile.gcc;  make test testdll -fmakefile.gcc
13#
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
17#
18# To install libz.a, zconf.h and zlib.h in the system directories, type:
19#
20#   make install -fmakefile.gcc
21
22# Note:
23# If the platform is *not* MinGW (e.g. it is Cygwin or UWIN),
24# the DLL name should be changed from "zlib1.dll".
25
26STATICLIB = libz.a
27SHAREDLIB = zlib1.dll
28IMPLIB    = libzdll.a
29
30#LOC = -DASMV
31#LOC = -DDEBUG -g
32
33CC = gcc
34CFLAGS = $(LOC) -O3 -Wall
35
36AS = $(CC)
37ASFLAGS = $(LOC) -Wall
38
39LD = $(CC)
40LDFLAGS = $(LOC) -s
41
42AR = ar
43ARFLAGS = rcs
44
45RC = windres
46RCFLAGS = --define GCC_WINDRES
47
48CP = cp -fp
49# If GNU install is available, replace $(CP) with install.
50INSTALL = $(CP)
51RM = rm -f
52
53prefix = /usr/local
54exec_prefix = $(prefix)
55
56OBJS = 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
58OBJA =
59
60all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example minigzip example_d minigzip_d
61
62test: example minigzip
63	./example
64	echo hello world | ./minigzip | ./minigzip -d
65
66testdll: example_d minigzip_d
67	./example_d
68	echo hello world | ./minigzip_d | ./minigzip_d -d
69
70.c.o:
71	$(CC) $(CFLAGS) -c -o $@ $<
72
73.S.o:
74	$(AS) $(ASFLAGS) -c -o $@ $<
75
76$(STATICLIB): $(OBJS) $(OBJA)
77	$(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA)
78
79$(IMPLIB): $(SHAREDLIB)
80
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
84	strip $@
85
86example: example.o $(STATICLIB)
87	$(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
88
89minigzip: minigzip.o $(STATICLIB)
90	$(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
91
92example_d: example.o $(IMPLIB)
93	$(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
94
95minigzip_d: minigzip.o $(IMPLIB)
96	$(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
97
98zlibrc.o: win32/zlib1.rc
99	$(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
100
101
102# INCLUDE_PATH and LIBRARY_PATH must be set.
103
104.PHONY: install uninstall clean
105
106install: 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)
113
114uninstall:
115	-$(RM) $(INCLUDE_PATH)/zlib.h
116	-$(RM) $(INCLUDE_PATH)/zconf.h
117	-$(RM) $(LIBRARY_PATH)/$(STATICLIB)
118	-$(RM) $(LIBRARY_PATH)/$(IMPLIB)
119
120clean:
121	-$(RM) $(STATICLIB)
122	-$(RM) $(SHAREDLIB)
123	-$(RM) $(IMPLIB)
124	-$(RM) *.o
125	-$(RM) *.exe
126	-$(RM) foo.gz
127
128adler32.o: zlib.h zconf.h
129compress.o: zlib.h zconf.h
130crc32.o: crc32.h zlib.h zconf.h
131deflate.o: deflate.h zutil.h zlib.h zconf.h
132example.o: zlib.h zconf.h
133gzio.o: zutil.h zlib.h zconf.h
134inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
135inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
136infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
137inftrees.o: zutil.h zlib.h zconf.h inftrees.h
138minigzip.o: zlib.h zconf.h
139trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
140uncompr.o: zlib.h zconf.h
141zutil.o: zutil.h zlib.h zconf.h
142