xref: /plan9/sys/src/cmd/gs/src/zlib.mak (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1#    Copyright (C) 1995-2004 artofcode LLC. All rights reserved.
2#
3# This software is provided AS-IS with no warranty, either express or
4# implied.
5#
6# This software is distributed under license and may not be copied,
7# modified or distributed except as expressly authorized under the terms
8# of the license contained in the file LICENSE in this distribution.
9#
10# For more information about licensing, please refer to
11# http://www.ghostscript.com/licensing/. For information on
12# commercial licensing, go to http://www.artifex.com/licensing/ or
13# contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14# San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15
16# $Id: zlib.mak,v 1.10 2005/03/08 07:40:45 giles Exp $
17# makefile for zlib library code.
18# Users of this makefile must define the following:
19#	GSSRCDIR - the GS library source directory
20#	ZSRCDIR - the source directory
21#	ZGENDIR - the generated intermediate file directory
22#	ZOBJDIR - the object directory
23#	SHARE_ZLIB - 0 to compile zlib, 1 to share
24#	ZLIB_NAME - if SHARE_ZLIB=1, the name of the shared library
25
26# This partial makefile compiles the zlib library for use in Ghostscript.
27# You can get the source code for this library from:
28#   http://www.gzip.org/zlib/
29#   http://www.libpng.org/pub/png/src/
30#	zlib-#.#.#.tar.gz or zlib###.zip
31# Please see Ghostscript's `Make.htm' file for instructions about how to
32# unpack these archives.
33#
34# When each version of Ghostscript is released, we copy the associated
35# version of the zlib library to
36#	ftp://ftp.cs.wisc.edu/ghost/3rdparty/
37# for more convenient access.
38#
39# This makefile is known to work with zlib source version 1.2.1.
40# It will only work with earlier versions (1.1.4) when SHARE_ZLIB=1.
41# Note that there are obscure bugs in zlib versions before 1.1.3 that
42# may cause the FlateDecode filter to produce an occasional ioerror
43# and there is a serious security problem with 1.1.3: we strongly
44# recommend using version 1.1.4 or later.
45
46ZSRC=$(ZSRCDIR)$(D)
47ZGEN=$(ZGENDIR)$(D)
48ZOBJ=$(ZOBJDIR)$(D)
49ZO_=$(O_)$(ZOBJ)
50
51# We need D_, _D_, and _D because the OpenVMS compiler uses different
52# syntax from other compilers.
53# ZI_ and ZF_ are defined in gs.mak.
54ZCCFLAGS=$(I_)$(ZI_)$(_I) $(ZF_) $(D_)verbose$(_D_)-1$(_D)
55ZCC=$(CC_) $(ZCCFLAGS)
56
57# Define the name of this makefile.
58ZLIB_MAK=$(GLSRC)zlib.mak
59
60z.clean : z.config-clean z.clean-not-config-clean
61
62### WRONG.  MUST DELETE OBJ AND GEN FILES SELECTIVELY.
63z.clean-not-config-clean :
64	$(RM_) $(ZOBJ)*.$(OBJ)
65
66z.config-clean :
67	$(RMN_) $(ZGEN)zlib*.dev $(ZGEN)crc32*.dev
68
69ZDEP=$(AK)
70
71# Code common to compression and decompression.
72
73zlibc_=$(ZOBJ)zutil.$(OBJ)
74$(ZGEN)zlibc.dev : $(ZLIB_MAK) $(ECHOGS_XE) $(zlibc_)
75	$(SETMOD) $(ZGEN)zlibc $(zlibc_)
76
77$(ZOBJ)zutil.$(OBJ) : $(ZSRC)zutil.c $(ZDEP)
78	$(ZCC) $(ZO_)zutil.$(OBJ) $(C_) $(ZSRC)zutil.c
79
80# Encoding (compression) code.
81
82$(ZGEN)zlibe.dev : $(TOP_MAKEFILES) $(ZGEN)zlibe_$(SHARE_ZLIB).dev
83	$(CP_) $(ZGEN)zlibe_$(SHARE_ZLIB).dev $(ZGEN)zlibe.dev
84
85$(ZGEN)zlibe_1.dev : $(TOP_MAKEFILES) $(ZLIB_MAK) $(ECHOGS_XE)
86	$(SETMOD) $(ZGEN)zlibe_1 -lib $(ZLIB_NAME)
87
88zlibe_=$(ZOBJ)adler32.$(OBJ) $(ZOBJ)deflate.$(OBJ) \
89	$(ZOBJ)compress.$(OBJ) $(ZOBJ)trees.$(OBJ) $(ZOBJ)crc32.$(OBJ)
90$(ZGEN)zlibe_0.dev : $(ZLIB_MAK) $(ECHOGS_XE) $(ZGEN)zlibc.dev $(zlibe_)
91	$(SETMOD) $(ZGEN)zlibe_0 $(zlibe_)
92	$(ADDMOD) $(ZGEN)zlibe_0 -include $(ZGEN)zlibc.dev
93
94$(ZOBJ)adler32.$(OBJ) : $(ZSRC)adler32.c $(ZDEP)
95	$(ZCC) $(ZO_)adler32.$(OBJ) $(C_) $(ZSRC)adler32.c
96
97$(ZOBJ)deflate.$(OBJ) : $(ZSRC)deflate.c $(ZDEP)
98	$(ZCC) $(ZO_)deflate.$(OBJ) $(C_) $(ZSRC)deflate.c
99
100# new file in zlib 1.2.x
101$(ZOBJ)compress.$(OBJ) : $(ZSRC)compress.c $(ZDEP)
102	$(ZCC) $(ZO_)compress.$(OBJ) $(C_) $(ZSRC)compress.c
103
104$(ZOBJ)trees.$(OBJ) : $(ZSRC)trees.c $(ZDEP)
105	$(ZCC) $(ZO_)trees.$(OBJ) $(C_) $(ZSRC)trees.c
106
107# The zlib filters per se don't need crc32, but libpng versions starting
108# with 0.90 do.
109
110$(ZGEN)crc32.dev : $(TOP_MAKEFILES) $(ZGEN)crc32_$(SHARE_ZLIB).dev
111	$(CP_) $(ZGEN)crc32_$(SHARE_ZLIB).dev $(ZGEN)crc32.dev
112
113$(ZGEN)crc32_1.dev : $(TOP_MAKEFILES) $(ZLIB_MAK) $(ECHOGS_XE)
114	$(SETMOD) $(ZGEN)crc32_1 -lib $(ZLIB_NAME)
115
116$(ZGEN)crc32_0.dev : $(ZLIB_MAK) $(ECHOGS_XE) $(ZOBJ)crc32.$(OBJ)
117	$(SETMOD) $(ZGEN)crc32_0 $(ZOBJ)crc32.$(OBJ)
118
119# We have to compile crc32 without warnings, because it defines 32-bit
120# constants that produces gcc warnings with -Wtraditional.
121$(ZOBJ)crc32.$(OBJ) : $(ZSRC)crc32.c $(ZDEP)
122	$(CC_NO_WARN) $(ZCCFLAGS) $(ZO_)crc32.$(OBJ) $(C_) $(ZSRC)crc32.c
123
124# Decoding (decompression) code.
125
126$(ZGEN)zlibd.dev : $(TOP_MAKEFILES) $(ZGEN)zlibd_$(SHARE_ZLIB).dev
127	$(CP_) $(ZGEN)zlibd_$(SHARE_ZLIB).dev $(ZGEN)zlibd.dev
128
129$(ZGEN)zlibd_1.dev : $(TOP_MAKEFILES) $(ZLIB_MAK) $(ECHOGS_XE)
130	$(SETMOD) $(ZGEN)zlibd_1 -lib $(ZLIB_NAME)
131
132# zlibd[12]_ list the decompression source files for zlib 1.4.x
133zlibd1_=$(ZOBJ)infblock.$(OBJ) $(ZOBJ)infcodes.$(OBJ) $(ZOBJ)inffast.$(OBJ)
134zlibd2_=$(ZOBJ)inflate.$(OBJ) $(ZOBJ)inftrees.$(OBJ) $(ZOBJ)infutil.$(OBJ) $(ZOBJ)crc32.$(OBJ)
135
136# shorter list of files for zlib 1.2.x
137zlibd_=$(ZOBJ)inffast.$(OBJ) $(ZOBJ)inflate.$(OBJ) $(ZOBJ)inftrees.$(OBJ) $(ZOBJ)uncompr.$(OBJ)
138
139
140$(ZGEN)zlibd_0.dev : $(ZLIB_MAK) $(ECHOGS_XE) $(ZGEN)zlibc.dev $(zlibd_)
141	$(SETMOD) $(ZGEN)zlibd_0 $(zlibd_)
142	$(ADDMOD) $(ZGEN)zlibd_0 -include $(ZGEN)zlibc.dev
143
144$(ZOBJ)infblock.$(OBJ) : $(ZSRC)infblock.c $(ZDEP)
145	$(ZCC) $(ZO_)infblock.$(OBJ) $(C_) $(ZSRC)infblock.c
146
147$(ZOBJ)infcodes.$(OBJ) : $(ZSRC)infcodes.c $(ZDEP)
148	$(ZCC) $(ZO_)infcodes.$(OBJ) $(C_) $(ZSRC)infcodes.c
149
150$(ZOBJ)inffast.$(OBJ) : $(ZSRC)inffast.c $(ZDEP)
151	$(ZCC) $(ZO_)inffast.$(OBJ) $(C_) $(ZSRC)inffast.c
152
153$(ZOBJ)inflate.$(OBJ) : $(ZSRC)inflate.c $(ZDEP)
154	$(ZCC) $(ZO_)inflate.$(OBJ) $(C_) $(ZSRC)inflate.c
155
156$(ZOBJ)inftrees.$(OBJ) : $(ZSRC)inftrees.c $(ZDEP)
157	$(ZCC) $(ZO_)inftrees.$(OBJ) $(C_) $(ZSRC)inftrees.c
158
159$(ZOBJ)infutil.$(OBJ) : $(ZSRC)infutil.c $(ZDEP)
160	$(ZCC) $(ZO_)infutil.$(OBJ) $(C_) $(ZSRC)infutil.c
161
162# new file in zlib 1.2.x
163$(ZOBJ)uncompr.$(OBJ) : $(ZSRC)uncompr.c $(ZDEP)
164	$(ZCC) $(ZO_)uncompr.$(OBJ) $(C_) $(ZSRC)uncompr.c
165
166