blob: 09be2e6879215ec861daa08ce46d8378b842aa7e [file] [log] [blame]
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -05001# makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -05002# Copyright (C) 2002, 2006-2008 Glenn Randers-Pehrson
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -06003# Copyright (C) 2001, Laurent faillie
4# Copyright (C) 1998, 1999 Greg Roelofs
5# Copyright (C) 1996, 1997 Andreas Dilger
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -05006#
Glenn Randers-Pehrsonbfbf8652009-06-26 21:46:52 -05007# This code is released under the libpng license.
Glenn Randers-Pehrsonc332bbc2009-06-25 13:43:50 -05008# For conditions of distribution and use, see the disclaimer
Glenn Randers-Pehrson037023b2009-06-24 10:27:36 -05009# and license in png.h
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060010
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060011# Library name:
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050012LIBNAME = libpng14
Glenn Randers-Pehrson56f63962008-10-06 10:16:17 -050013PNGMAJ = 14
Glenn Randers-Pehrson311c8472009-11-20 09:45:08 -060014PNGMIN = 1.4.0beta103
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060015PNGVER = $(PNGMAJ).$(PNGMIN)
16
17# Shared library names:
18LIBSO=$(LIBNAME).sl
19LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
20LIBSOVER=$(LIBNAME).sl.$(PNGVER)
21OLDSO=libpng.sl
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050022OLDSOMAJ=libpng.sl.14
23OLDSOVER=libpng.sl.14.$(PNGMIN)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060024
25# Utilities:
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060026CC=gcc
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -050027LD=ld
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060028AR_RC=ar rc
Glenn Randers-Pehrson170b70c2006-03-10 10:19:04 -060029MKDIR_P=mkdir -p
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060030LN_SF=ln -sf
31RANLIB=ranlib
32RM_F=/bin/rm -f
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060033
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060034# where "make install" puts libpng.a, $(OLDSO)*, png.h and pngconf.h
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060035prefix=/usr/local
Glenn Randers-Pehrsonad310542006-04-18 05:31:20 -050036exec_prefix=$(prefix)
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060037
38# Where the zlib library and include files are located
39ZLIBLIB=/opt/zlib/lib
40ZLIBINC=/opt/zlib/include
41
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -050042# Note that if you plan to build a libpng shared library, zlib must also
43# be a shared library, which zlib's configure does not do. After running
44# zlib's configure, edit the appropriate lines of makefile to read:
45# CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
46# LDSHARED=ld -b
47# SHAREDLIB=libz.sl
48
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060049ALIGN=
50# for i386:
51#ALIGN=-malign-loops=2 -malign-functions=2
52
53WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
54 -Wmissing-declarations -Wtraditional -Wcast-align \
55 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
56
57# for pgcc version 2.95.1, -O3 is buggy; don't use it.
58
Glenn Randers-Pehrson58c4f6b2009-11-07 10:50:29 -060059CFLAGS=-DPNG_CONFIGURE_LIBPNG -I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060060 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050061#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng14 -lz -lm
62LDFLAGS=-L. -L$(ZLIBLIB) -lpng14 -lz -lm
Glenn Randers-Pehrson5b5dcf82004-07-17 22:45:44 -050063
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060064INCPATH=$(prefix)/include
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060065LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050066MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060067BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050068
69# override DESTDIR= on the make install command line to easily support
70# installing into a temporary location. Example:
71#
72# make install DESTDIR=/tmp/build/libpng
73#
74# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050075# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050076# you execute make install.
77DESTDIR=
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060078
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050079DB=$(DESTDIR)$(BINPATH)
80DI=$(DESTDIR)$(INCPATH)
81DL=$(DESTDIR)$(LIBPATH)
82DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050083
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060084OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
85 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
86 pngwtran.o pngmem.o pngerror.o pngpread.o
87
88OBJSDLL = $(OBJS:.o=.pic.o)
89
90.SUFFIXES: .c .o .pic.o
91
92.c.pic.o:
93 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
94
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050095all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060096
97libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060098 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060099 $(RANLIB) $@
100
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500101libpng.pc:
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500102 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
103 -e s!@exec_prefix@!$(exec_prefix)! \
104 -e s!@libdir@!$(LIBPATH)! \
105 -e s!@includedir@!$(INCPATH)! \
106 -e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500107
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500108libpng-config:
109 ( cat scripts/libpng-config-head.in; \
110 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -0500111 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -0500112 echo libs=\"-lpng14 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500113 cat scripts/libpng-config-body.in ) > libpng-config
114 chmod +x libpng-config
115
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600116$(LIBSO): $(LIBSOMAJ)
117 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600118
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600119$(LIBSOMAJ): $(LIBSOVER)
120 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600121
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600122$(LIBSOVER): $(OBJSDLL)
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -0500123 $(LD) -b +s \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600124 +h $(LIBSOMAJ) -o $(LIBSOVER) $(OBJSDLL)
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600125
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500126$(OLDSOVER): $(OBJSDLL)
127 $(LD) -b +s \
128 +h $(OLDSOMAJ) -o $(OLDSOVER) $(OBJSDLL)
129
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600130pngtest: pngtest.o $(LIBSO)
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600131 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
132
133test: pngtest
134 ./pngtest
135
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600136
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500137install-headers: png.h pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600138 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
139 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500140 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500141 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500142 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600143 -@$(RM_F) $(DI)/libpng
144 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600145
146install-static: install-headers libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600147 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500148 cp libpng.a $(DL)/$(LIBNAME).a
149 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600150 -@$(RM_F) $(DL)/libpng.a
151 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600152
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500153install-shared: install-headers $(LIBSOVER) libpng.pc \
154 $(OLDSOVER)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600155 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600156 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
157 -@$(RM_F) $(DL)/$(LIBSOMAJ)
158 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500159 -@$(RM_F) $(DL)/$(OLDSOMAJ)
160 -@$(RM_F) $(DL)/$(OLDSOVER)*
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600161 cp $(LIBSOVER) $(DL)
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500162 cp $(OLDSOVER) $(DL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600163 chmod 755 $(DL)/$(LIBSOVER)
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500164 chmod 755 $(DL)/$(OLDSOVER)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500165 (cd $(DL); \
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500166 $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
167 $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600168 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500169 $(LN_SF) $(LIBSOMAJ) $(LIBSO))
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600170 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
171 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
172 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500173 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
174 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600175 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600176
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500177install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600178 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
179 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
180 -@$(RM_F) $(DM)/man3/libpng.3
181 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500182 cp libpng.3 $(DM)/man3
183 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600184 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
185 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500186 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500187
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500188install-config: libpng-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600189 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
190 -@$(RM_F) $(DB)/libpng-config
191 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500192 cp libpng-config $(DB)/$(LIBNAME)-config
193 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600194 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500195
196install: install-static install-shared install-man install-config
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600197
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500198# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500199# move the library to its final location. Use test-dd to test it
200# before then.
201
202test-dd:
203 echo
204 echo Testing installed dynamic shared library in $(DL).
205 $(CC) -I$(DI) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600206 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -0500207 -L$(DL) -L$(ZLIBLIB) -Wl,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600208 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500209 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500210
211test-installed:
212 echo
213 echo Testing installed dynamic shared library.
214 $(CC) -I$(ZLIBINC) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600215 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500216 -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600217 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500218 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500219
220clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600221 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600222 libpng-config $(LIBSO) $(LIBSOMAJ)* \
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500223 $(OLDSOVER) \
224 libpng.pc
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600225
226DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
227writelock:
228 chmod a-w *.[ch35] $(DOCS) scripts/*
229
230# DO NOT DELETE THIS LINE -- make depend depends on it.
231
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -0500232png.o png.pic.o: png.h pngconf.h pngpriv.h
233pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h
234pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h
235pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h
236pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h
237pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h
238pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h
239pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h
240pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h
241pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h
242pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h
243pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h
244pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h
245pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h
246pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600247
Glenn Randers-Pehrson013d1d62009-11-08 13:28:18 -0600248pngtest.o: png.h pngconf.h