blob: ce10bfc082d6caab31eeebb810d84d67d657d5ea [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-Pehrson5c5db5a2011-01-21 23:23:34 -06002# Copyright (C) 1999-2002, 2006, 2010-2011 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
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060069OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050070 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
71 pngwtran.o pngmem.o pngerror.o pngpread.o
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060072
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -050073OBJSDLL = $(OBJS:.o=.pic.o)
74
75.SUFFIXES: .c .o .pic.o
76
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060077.c.o:
78 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
79
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -050080.c.pic.o:
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060081 $(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -050082
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050083all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060084
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050085# see scripts/pnglibconf.mak for more options
Glenn Randers-Pehrson8c667862010-08-24 16:16:35 -050086pnglibconf.h: scripts/pnglibconf.h.prebuilt
87 cp scripts/pnglibconf.h.prebuilt $@
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050088
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060089libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060090 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050091 $(RANLIB) $@
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060092
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050093libpng.pc:
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050094 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
95 -e s!@exec_prefix@!$(exec_prefix)! \
96 -e s!@libdir@!$(LIBPATH)! \
97 -e s!@includedir@!$(INCPATH)! \
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -060098 -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050099
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500100libpng-config:
101 ( cat scripts/libpng-config-head.in; \
102 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500103 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -0500104 echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500105 echo L_opts=\"-L$(LIBPATH)\"; \
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -0600106 echo libs=\"-lpng16 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500107 cat scripts/libpng-config-body.in ) > libpng-config
108 chmod +x libpng-config
109
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600110$(LIBSO): $(LIBSOMAJ)
111 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -0500112
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600113$(LIBSOMAJ): $(OBJSDLL)
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -0500114 $(LD) -b +s \
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600115 +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500116
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600117pngtest: pngtest.o libpng.a
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500118 $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600119
120test: pngtest
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500121 ./pngtest
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600122
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600123install-headers: png.h pngconf.h pnglibconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600124 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
125 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600126 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
127 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
128 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600129 -@$(RM_F) $(DI)/libpng
130 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600131
132install-static: install-headers libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600133 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500134 cp libpng.a $(DL)/$(LIBNAME).a
135 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600136 -@$(RM_F) $(DL)/libpng.a
137 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600138
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600139install-shared: install-headers $(LIBSOMAJ) libpng.pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600140 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600141 -@$(RM_F) $(DL)/$(LIBSO)
142 -@$(RM_F) $(DL)/$(LIBSOREL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600143 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600144 cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
145 chmod 755 $(DL)/$(LIBSOREL)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500146 (cd $(DL); \
Glenn Randers-Pehrsone3f3c4e2010-02-07 18:08:50 -0600147 $(LN_SF) $(LIBSOREL) $(LIBSO); \
148 $(LN_SF) $(LIBSO) $(OLDSO))
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600149 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
150 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
151 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500152 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
153 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600154 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600155
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500156install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600157 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
158 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
159 -@$(RM_F) $(DM)/man3/libpng.3
160 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500161 cp libpng.3 $(DM)/man3
162 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600163 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
164 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500165 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500166
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500167install-config: libpng-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600168 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
169 -@$(RM_F) $(DB)/libpng-config
170 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500171 cp libpng-config $(DB)/$(LIBNAME)-config
172 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600173 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500174
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500175install: install-static install-shared install-man install-config
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600176
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500177# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500178# move the library to its final location. Use test-dd to test it
179# before then.
180
181test-dd:
182 echo
183 echo Testing installed dynamic shared library in $(DL).
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -0600184 $(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600185 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500186 -L$(DL) -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600187 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500188 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500189
190test-installed:
191 echo
192 echo Testing installed dynamic shared library.
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -0600193 $(CC) $(CPPFLAGS) $(CCFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600194 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500195 -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600196 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500197 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500198
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600199clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600200 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600201 libpng-config $(LIBSO) $(LIBSOMAJ)* \
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -0500202 libpng.pc pnglibconf.h
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600203
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600204DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
205writelock:
206 chmod a-w *.[ch35] $(DOCS) scripts/*
207
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600208# DO NOT DELETE THIS LINE -- make depend depends on it.
209
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -0600210png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
211pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
212pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
213pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
214pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
215pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
216pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
217pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
218pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
219pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
220pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
221pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
222pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
223pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
224pngpread.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 -0500225
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -0600226pngtest.o: png.h pngconf.h pnglibconf.h