source: Vago/Libs/zlib-1.2.8/win32/Makefile.gcc@ 1064

Last change on this file since 1064 was 1050, checked in by s10k, 8 years ago
File size: 5.0 KB
Line 
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: Mar 2012.
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 from the top level zlib directory:
11#
12# make -fwin32/Makefile.gcc; make test testdll -fwin32/Makefile.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 -fwin32/Makefile.gcc
17#
18# To install libz.a, zconf.h and zlib.h in the system directories, type:
19#
20# make install -fwin32/Makefile.gcc
21#
22# BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set.
23#
24# To install the shared lib, append SHARED_MODE=1 to the make command :
25#
26# make install -fwin32/Makefile.gcc SHARED_MODE=1
27
28# Note:
29# If the platform is *not* MinGW (e.g. it is Cygwin or UWIN),
30# the DLL name should be changed from "zlib1.dll".
31
32STATICLIB = libz.a
33SHAREDLIB = zlib1.dll
34IMPLIB = libz.dll.a
35
36#
37# Set to 1 if shared object needs to be installed
38#
39SHARED_MODE=0
40
41#LOC = -DASMV
42#LOC = -DDEBUG -g
43
44PREFIX =
45CC = $(PREFIX)gcc
46CFLAGS = $(LOC) -O3 -Wall
47
48AS = $(CC)
49ASFLAGS = $(LOC) -Wall
50
51LD = $(CC)
52LDFLAGS = $(LOC)
53
54AR = $(PREFIX)ar
55ARFLAGS = rcs
56
57RC = $(PREFIX)windres
58RCFLAGS = --define GCC_WINDRES
59
60STRIP = $(PREFIX)strip
61
62CP = cp -fp
63# If GNU install is available, replace $(CP) with install.
64INSTALL = $(CP)
65RM = rm -f
66
67prefix ?= /usr/local
68exec_prefix = $(prefix)
69
70OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
71 gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
72OBJA =
73
74all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe
75
76test: example.exe minigzip.exe
77 ./example
78 echo hello world | ./minigzip | ./minigzip -d
79
80testdll: example_d.exe minigzip_d.exe
81 ./example_d
82 echo hello world | ./minigzip_d | ./minigzip_d -d
83
84.c.o:
85 $(CC) $(CFLAGS) -c -o $@ $<
86
87.S.o:
88 $(AS) $(ASFLAGS) -c -o $@ $<
89
90$(STATICLIB): $(OBJS) $(OBJA)
91 $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA)
92
93$(IMPLIB): $(SHAREDLIB)
94
95$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
96 $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \
97 -o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
98 $(STRIP) $@
99
100example.exe: example.o $(STATICLIB)
101 $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
102 $(STRIP) $@
103
104minigzip.exe: minigzip.o $(STATICLIB)
105 $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
106 $(STRIP) $@
107
108example_d.exe: example.o $(IMPLIB)
109 $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
110 $(STRIP) $@
111
112minigzip_d.exe: minigzip.o $(IMPLIB)
113 $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
114 $(STRIP) $@
115
116example.o: test/example.c zlib.h zconf.h
117 $(CC) $(CFLAGS) -I. -c -o $@ test/example.c
118
119minigzip.o: test/minigzip.c zlib.h zconf.h
120 $(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c
121
122zlibrc.o: win32/zlib1.rc
123 $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
124
125.PHONY: install uninstall clean
126
127install: zlib.h zconf.h $(STATICLIB) $(IMPLIB)
128 @if test -z "$(DESTDIR)$(INCLUDE_PATH)" -o -z "$(DESTDIR)$(LIBRARY_PATH)" -o -z "$(DESTDIR)$(BINARY_PATH)"; then \
129 echo INCLUDE_PATH, LIBRARY_PATH, and BINARY_PATH must be specified; \
130 exit 1; \
131 fi
132 -@mkdir -p '$(DESTDIR)$(INCLUDE_PATH)'
133 -@mkdir -p '$(DESTDIR)$(LIBRARY_PATH)' '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig
134 -if [ "$(SHARED_MODE)" = "1" ]; then \
135 mkdir -p '$(DESTDIR)$(BINARY_PATH)'; \
136 $(INSTALL) $(SHAREDLIB) '$(DESTDIR)$(BINARY_PATH)'; \
137 $(INSTALL) $(IMPLIB) '$(DESTDIR)$(LIBRARY_PATH)'; \
138 fi
139 -$(INSTALL) zlib.h '$(DESTDIR)$(INCLUDE_PATH)'
140 -$(INSTALL) zconf.h '$(DESTDIR)$(INCLUDE_PATH)'
141 -$(INSTALL) $(STATICLIB) '$(DESTDIR)$(LIBRARY_PATH)'
142 sed \
143 -e 's|@prefix@|${prefix}|g' \
144 -e 's|@exec_prefix@|${exec_prefix}|g' \
145 -e 's|@libdir@|$(LIBRARY_PATH)|g' \
146 -e 's|@sharedlibdir@|$(LIBRARY_PATH)|g' \
147 -e 's|@includedir@|$(INCLUDE_PATH)|g' \
148 -e 's|@VERSION@|'`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' zlib.h`'|g' \
149 zlib.pc.in > '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig/zlib.pc
150
151uninstall:
152 -if [ "$(SHARED_MODE)" = "1" ]; then \
153 $(RM) '$(DESTDIR)$(BINARY_PATH)'/$(SHAREDLIB); \
154 $(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(IMPLIB); \
155 fi
156 -$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zlib.h
157 -$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zconf.h
158 -$(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(STATICLIB)
159
160clean:
161 -$(RM) $(STATICLIB)
162 -$(RM) $(SHAREDLIB)
163 -$(RM) $(IMPLIB)
164 -$(RM) *.o
165 -$(RM) *.exe
166 -$(RM) foo.gz
167
168adler32.o: zlib.h zconf.h
169compress.o: zlib.h zconf.h
170crc32.o: crc32.h zlib.h zconf.h
171deflate.o: deflate.h zutil.h zlib.h zconf.h
172gzclose.o: zlib.h zconf.h gzguts.h
173gzlib.o: zlib.h zconf.h gzguts.h
174gzread.o: zlib.h zconf.h gzguts.h
175gzwrite.o: zlib.h zconf.h gzguts.h
176inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
177inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
178infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
179inftrees.o: zutil.h zlib.h zconf.h inftrees.h
180trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
181uncompr.o: zlib.h zconf.h
182zutil.o: zutil.h zlib.h zconf.h
Note: See TracBrowser for help on using the repository browser.