blob: 2a4a0b3dbbadbb5fced466af17f188d446ef9903 [file] [log] [blame]
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -05001# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
Glenn Randers-Pehrson5af03072014-01-20 12:36:30 -06002# Copyright (C) 1999-2002, 2006, 2010-2014 Glenn Randers-Pehrson
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05003# Copyright (C) 1995 Guy Eric Schalnat, Group 42
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -05004# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -05005#
Glenn Randers-Pehrsonbfbf8652009-06-26 21:46:52 -05006# This code is released under the libpng license.
Glenn Randers-Pehrsonc332bbc2009-06-25 13:43:50 -05007# For conditions of distribution and use, see the disclaimer
Glenn Randers-Pehrson037023b2009-06-24 10:27:36 -05008# and license in png.h
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -06009
10# Where the zlib library and include files are located
11ZLIBLIB=/opt/zlib/lib
12ZLIBINC=/opt/zlib/include
13
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -050014# Note that if you plan to build a libpng shared library, zlib must also
15# be a shared library, which zlib's configure does not do. After running
16# zlib's configure, edit the appropriate lines of makefile to read:
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060017# CPPFLAGS=-DHAVE_UNISTD -DUSE_MAP
18# CFLAGS=-O1 -fPIC
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -050019# LDSHARED=ld -b
20# SHAREDLIB=libz.sl
21
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060022# Library name:
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -060023LIBNAME = libpng16
24PNGMAJ = 16
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060025
26# Shared library names:
27LIBSO=$(LIBNAME).sl
28LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -060029LIBSOREL=$(LIBSOMAJ).$(RELEASE)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060030OLDSO=libpng.sl
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060031
32# Utilities:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060033AR_RC=ar rc
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060034CC=cc
Glenn Randers-Pehrson170b70c2006-03-10 10:19:04 -060035MKDIR_P=mkdir -p
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060036LN_SF=ln -sf
37RANLIB=ranlib
38RM_F=/bin/rm -f
39
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -060040# where make install puts libpng.a, libpng16.sl, and png.h
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050041prefix=/opt/libpng
Glenn Randers-Pehrsonad310542006-04-18 05:31:20 -050042exec_prefix=$(prefix)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050043INCPATH=$(prefix)/include
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060044LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050045MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060046BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050047
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060048CPPFLAGS=-I$(ZLIBINC)
49CFLAGS=-O -Ae +DA1.1 +DS2.0
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060050# Caution: be sure you have built zlib with the same CFLAGS.
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060051CCFLAGS=-O -Ae +DA1.1 +DS2.0
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060052LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
53
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050054# override DESTDIR= on the make install command line to easily support
55# installing into a temporary location. Example:
56#
57# make install DESTDIR=/tmp/build/libpng
58#
59# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050060# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050061# you execute make install.
62DESTDIR=
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060063
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050064DB=$(DESTDIR)$(BINPATH)
65DI=$(DESTDIR)$(INCPATH)
66DL=$(DESTDIR)$(LIBPATH)
67DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050068
Cosmin Truta9ab7b4c2014-03-22 13:13:11 -050069# Pre-built configuration
70# See scripts/pnglibconf.mak for more options
71PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
72
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060073OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050074 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
75 pngwtran.o pngmem.o pngerror.o pngpread.o
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060076
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -050077OBJSDLL = $(OBJS:.o=.pic.o)
78
79.SUFFIXES: .c .o .pic.o
80
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060081.c.o:
82 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
83
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -050084.c.pic.o:
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060085 $(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -050086
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050087all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060088
Cosmin Truta9ab7b4c2014-03-22 13:13:11 -050089pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
Cosmin Truta82200da2014-03-22 09:29:59 -050090 $(CP) $< $@
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050091
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060092libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060093 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050094 $(RANLIB) $@
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060095
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050096libpng.pc:
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050097 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
98 -e s!@exec_prefix@!$(exec_prefix)! \
99 -e s!@libdir@!$(LIBPATH)! \
100 -e s!@includedir@!$(INCPATH)! \
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -0600101 -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500102
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500103libpng-config:
104 ( cat scripts/libpng-config-head.in; \
105 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500106 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -0500107 echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500108 echo L_opts=\"-L$(LIBPATH)\"; \
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -0600109 echo libs=\"-lpng16 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500110 cat scripts/libpng-config-body.in ) > libpng-config
111 chmod +x libpng-config
112
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600113$(LIBSO): $(LIBSOMAJ)
114 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -0500115
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600116$(LIBSOMAJ): $(OBJSDLL)
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -0500117 $(LD) -b +s \
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600118 +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500119
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600120pngtest: pngtest.o libpng.a
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500121 $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600122
123test: pngtest
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500124 ./pngtest
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600125
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600126install-headers: png.h pngconf.h pnglibconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600127 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
128 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600129 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
130 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
131 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600132 -@$(RM_F) $(DI)/libpng
133 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600134
135install-static: install-headers libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600136 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500137 cp libpng.a $(DL)/$(LIBNAME).a
138 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600139 -@$(RM_F) $(DL)/libpng.a
140 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600141
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600142install-shared: install-headers $(LIBSOMAJ) libpng.pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600143 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600144 -@$(RM_F) $(DL)/$(LIBSO)
145 -@$(RM_F) $(DL)/$(LIBSOREL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600146 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600147 cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
148 chmod 755 $(DL)/$(LIBSOREL)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500149 (cd $(DL); \
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600150 $(LN_SF) $(LIBSOREL) $(LIBSO); \
151 $(LN_SF) $(LIBSO) $(OLDSO))
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600152 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
153 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
154 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500155 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
156 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600157 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600158
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500159install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600160 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
161 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
162 -@$(RM_F) $(DM)/man3/libpng.3
163 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500164 cp libpng.3 $(DM)/man3
165 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600166 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
167 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500168 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500169
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500170install-config: libpng-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600171 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
172 -@$(RM_F) $(DB)/libpng-config
173 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500174 cp libpng-config $(DB)/$(LIBNAME)-config
175 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600176 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500177
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500178install: install-static install-shared install-man install-config
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600179
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500180# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500181# move the library to its final location. Use test-dd to test it
182# before then.
183
184test-dd:
185 echo
186 echo Testing installed dynamic shared library in $(DL).
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -0600187 $(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600188 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500189 -L$(DL) -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600190 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500191 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500192
193test-installed:
194 echo
195 echo Testing installed dynamic shared library.
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -0600196 $(CC) $(CPPFLAGS) $(CCFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600197 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500198 -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600199 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500200 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500201
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600202clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600203 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600204 libpng-config $(LIBSO) $(LIBSOMAJ)* \
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -0500205 libpng.pc pnglibconf.h
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600206
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600207DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
208writelock:
209 chmod a-w *.[ch35] $(DOCS) scripts/*
210
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600211# DO NOT DELETE THIS LINE -- make depend depends on it.
212
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -0600213png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
214pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
215pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
216pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
217pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
218pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
219pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
220pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
221pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
222pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
223pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
224pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
225pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
226pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
227pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500228
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600229pngtest.o: png.h pngconf.h pnglibconf.h