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