xref: /plan9/sys/src/cmd/gs/src/libpng.mak (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1#    Copyright (C) 1995-2002 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: libpng.mak,v 1.14 2003/05/15 10:01:38 ghostgum Exp $
17# makefile for PNG (Portable Network Graphics) code.
18# Users of this makefile must define the following:
19#	ZSRCDIR - the zlib source directory
20#	ZGENDIR - the zlib generated intermediate file directory
21#	ZOBJDIR - the zlib object directory
22#	PNGSRCDIR - the source directory
23#	PNGGENDIR - the generated intermediate file directory
24#	PNGOBJDIR - the object directory
25#	PNGVERSION - the library version number ("90", "95", "96",
26#	  and "10001" through "10012" and "10201").
27#	  For historical reasons, "101" and "102" are also acceptable,
28#	  even though they don't match libpng's numbering scheme
29#	  (see png.h for more details).
30#         versions prior 0.90 is not supported.
31#	SHARE_LIBPNG - 0 to compile libpng, 1 to share
32#	LIBPNG_NAME - if SHARE_LIBPNG=1, the name of the shared library
33# NOTE: currently users of this makefile define PSRCDIR and PVERSION,
34# not PNGSRCDIR and PNGVERSION.  This is a bug.
35
36# This partial makefile compiles the png library for use in the Ghostscript
37# PNG drivers.  You can get the source code for this library from:
38#   http://www.libpng.org/pub/png/src/
39#   ftp://swrinde.nde.swri.edu/pub/png/src/
40#   ftp://ftp.uu.net/graphics/png/src/
41#   http://libpng.sourceforge.net/
42# Please see Ghostscript's `Make.htm' file for instructions about how to
43# unpack these archives.
44#
45# When each version of Ghostscript is released, we copy the associated
46# version of the png library to
47#	ftp://ftp.cs.wisc.edu/ghost/3rdparty/
48# for more convenient access.
49#
50# this makefile should work with libpng versions 0.90 and above
51#
52# NOTE: the archive for libpng 0.95 may be inconsistent: if you have
53# compilation problems, use a newer version.
54#
55# Please see Ghostscript's Make.htm file for instructions about how to
56# unpack these archives.
57#
58# The specification for the PNG file format is available from:
59#   http://www.group42.com/png.htm
60#   http://www.w3.org/pub/WWW/TR/WD-png
61
62# (Rename directories.)
63PNGSRCDIR=$(PSRCDIR)
64PNGVERSION=$(PVERSION)
65PNGSRC=$(PNGSRCDIR)$(D)
66PNGGEN=$(PNGGENDIR)$(D)
67PNGOBJ=$(PNGOBJDIR)$(D)
68PNGO_=$(O_)$(PNGOBJ)
69PZGEN=$(ZGENDIR)$(D)
70
71# PI_ and PF_ are defined in gs.mak.
72PNGCC=$(CC_) $(I_)$(PI_)$(_I) $(PF_)
73
74# Define the name of this makefile.
75LIBPNG_MAK=$(GLSRC)libpng.mak
76
77png.clean : png.config-clean png.clean-not-config-clean
78
79### WRONG.  MUST DELETE OBJ AND GEN FILES SELECTIVELY.
80png.clean-not-config-clean :
81	$(RM_) $(PNGOBJ)*.$(OBJ)
82
83png.config-clean :
84	$(RM_) $(PNGGEN)lpg*.dev
85
86PDEP=$(AK)
87
88png_1=$(PNGOBJ)png.$(OBJ) $(PNGOBJ)pngmem.$(OBJ) $(PNGOBJ)pngerror.$(OBJ) $(PNGOBJ)pngset.$(OBJ)
89png_2=$(PNGOBJ)pngtrans.$(OBJ) $(PNGOBJ)pngwrite.$(OBJ) $(PNGOBJ)pngwtran.$(OBJ) $(PNGOBJ)pngwutil.$(OBJ)
90
91# libpng modules
92
93$(PNGOBJ)png.$(OBJ) : $(PNGSRC)png.c $(PDEP)
94	$(PNGCC) $(PNGO_)png.$(OBJ) $(C_) $(PNGSRC)png.c
95
96$(PNGOBJ)pngwio.$(OBJ) : $(PNGSRC)pngwio.c $(PDEP)
97	$(PNGCC) $(PNGO_)pngwio.$(OBJ) $(C_) $(PNGSRC)pngwio.c
98
99$(PNGOBJ)pngmem.$(OBJ) : $(PNGSRC)pngmem.c $(PDEP)
100	$(PNGCC) $(PNGO_)pngmem.$(OBJ) $(C_) $(PNGSRC)pngmem.c
101
102$(PNGOBJ)pngerror.$(OBJ) : $(PNGSRC)pngerror.c $(PDEP)
103	$(PNGCC) $(PNGO_)pngerror.$(OBJ) $(C_) $(PNGSRC)pngerror.c
104
105$(PNGOBJ)pngset.$(OBJ) : $(PNGSRC)pngset.c $(PDEP)
106	$(PNGCC) $(PNGO_)pngset.$(OBJ) $(C_) $(PNGSRC)pngset.c
107
108$(PNGOBJ)pngtrans.$(OBJ) : $(PNGSRC)pngtrans.c $(PDEP)
109	$(PNGCC) $(PNGO_)pngtrans.$(OBJ) $(C_) $(PNGSRC)pngtrans.c
110
111$(PNGOBJ)pngwrite.$(OBJ) : $(PNGSRC)pngwrite.c $(PDEP)
112	$(PNGCC) $(PNGO_)pngwrite.$(OBJ) $(C_) $(PNGSRC)pngwrite.c
113
114$(PNGOBJ)pngwtran.$(OBJ) : $(PNGSRC)pngwtran.c $(PDEP)
115	$(PNGCC) $(PNGO_)pngwtran.$(OBJ) $(C_) $(PNGSRC)pngwtran.c
116
117$(PNGOBJ)pngwutil.$(OBJ) : $(PNGSRC)pngwutil.c $(PDEP)
118	$(PNGCC) $(PNGO_)pngwutil.$(OBJ) $(C_) $(PNGSRC)pngwutil.c
119
120# Define the version of libpng.dev that we are actually using.
121$(PNGGEN)libpng.dev : $(TOP_MAKEFILES) $(PNGGEN)libpng_$(SHARE_LIBPNG).dev
122	$(CP_) $(PNGGEN)libpng_$(SHARE_LIBPNG).dev $(PNGGEN)libpng.dev
123
124# Define the shared version of libpng.
125# Note that it requires libz, which must be searched *after* libpng.
126$(PNGGEN)libpng_1.dev : $(TOP_MAKEFILES) $(LIBPNG_MAK) $(ECHOGS_XE) $(PZGEN)zlibe.dev
127	$(SETMOD) $(PNGGEN)libpng_1 -lib $(LIBPNG_NAME)
128	$(ADDMOD) $(PNGGEN)libpng_1 -include $(PZGEN)zlibe.dev
129
130# Define the non-shared version of libpng.
131$(PNGGEN)libpng_0.dev : $(LIBPNG_MAK) $(ECHOGS_XE) $(png_1) $(png_2)\
132 $(PZGEN)zlibe.dev $(PNGGEN)lpg$(PNGVERSION).dev
133	$(SETMOD) $(PNGGEN)libpng_0 $(png_1)
134	$(ADDMOD) $(PNGGEN)libpng_0 $(png_2)
135	$(ADDMOD) $(PNGGEN)libpng_0 -include $(PZGEN)zlibe.dev $(PNGGEN)lpg$(PNGVERSION).dev
136
137$(PNGGEN)lpg$(PNGVERSION).dev : $(LIBPNG_MAK) $(ECHOGS_XE) $(PNGOBJ)pngwio.$(OBJ) $(PZGEN)crc32.dev
138	$(SETMOD) $(PNGGEN)lpg$(PNGVERSION) $(PNGOBJ)pngwio.$(OBJ) -include $(PZGEN)crc32.dev
139