blob: 5ca67fb3df86cfd1574dae23d5c2dd43806b0b28 [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-Pehrson5c60b232006-03-07 07:09:22 -06002# Copyright (C) 1999-2002, 2006 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-Pehrson87544ac1999-01-13 22:06:39 -06005# For conditions of distribution and use, see copyright notice in png.h
6
7# Where the zlib library and include files are located
8ZLIBLIB=/opt/zlib/lib
9ZLIBINC=/opt/zlib/include
10
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -050011# Note that if you plan to build a libpng shared library, zlib must also
12# be a shared library, which zlib's configure does not do. After running
13# zlib's configure, edit the appropriate lines of makefile to read:
14# CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
15# LDSHARED=ld -b
16# SHAREDLIB=libz.sl
17
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060018# Library name:
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050019LIBNAME = libpng14
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -050020PNGMAJ = 0
Glenn Randers-Pehrson1916f6a2008-08-14 13:44:49 -050021PNGMIN = 1.4.0beta30
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060022PNGVER = $(PNGMAJ).$(PNGMIN)
23
24# Shared library names:
25LIBSO=$(LIBNAME).sl
26LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
27LIBSOVER=$(LIBNAME).sl.$(PNGVER)
28OLDSO=libpng.sl
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060029
30# Utilities:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060031AR_RC=ar rc
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060032CC=cc
Glenn Randers-Pehrson170b70c2006-03-10 10:19:04 -060033MKDIR_P=mkdir -p
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060034LN_SF=ln -sf
35RANLIB=ranlib
36RM_F=/bin/rm -f
37
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050038# where make install puts libpng.a, libpng14.sl, and png.h
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050039prefix=/opt/libpng
Glenn Randers-Pehrsonad310542006-04-18 05:31:20 -050040exec_prefix=$(prefix)
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050041INCPATH=$(prefix)/include
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060042LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050043MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060044BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050045
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060046CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
47# Caution: be sure you have built zlib with the same CFLAGS.
48CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
49LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
50
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050051# override DESTDIR= on the make install command line to easily support
52# installing into a temporary location. Example:
53#
54# make install DESTDIR=/tmp/build/libpng
55#
56# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050057# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050058# you execute make install.
59DESTDIR=
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060060
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050061DB=$(DESTDIR)$(BINPATH)
62DI=$(DESTDIR)$(INCPATH)
63DL=$(DESTDIR)$(LIBPATH)
64DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050065
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060066OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050067 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
68 pngwtran.o pngmem.o pngerror.o pngpread.o
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060069
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -050070OBJSDLL = $(OBJS:.o=.pic.o)
71
72.SUFFIXES: .c .o .pic.o
73
74.c.pic.o:
75 $(CC) -c $(CFLAGS) +z -o $@ $*.c
76
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050077all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config pngdefs.h
78
79pngdefs.h:
80 echo "/* pngdefs.h was built by makefile.hpux */" > pngdefs.h
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060081
82libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060083 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050084 $(RANLIB) $@
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -060085
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050086libpng.pc:
87 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
88
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050089libpng-config:
90 ( cat scripts/libpng-config-head.in; \
91 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050092 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -050093 echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050094 echo L_opts=\"-L$(LIBPATH)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050095 echo libs=\"-lpng14 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050096 cat scripts/libpng-config-body.in ) > libpng-config
97 chmod +x libpng-config
98
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060099$(LIBSO): $(LIBSOMAJ)
100 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -0500101
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600102$(LIBSOMAJ): $(LIBSOVER)
103 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -0500104
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600105$(LIBSOVER): $(OBJSDLL)
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -0500106 $(LD) -b +s \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600107 +h $(LIBSOMAJ) -o $(LIBSOVER) $(OBJSDLL)
Glenn Randers-Pehrson32fc5ce2000-07-24 06:34:14 -0500108
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600109pngtest: pngtest.o libpng.a
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500110 $(CC) -o pngtest $(CCFLAGS) pngtest.o $(LDFLAGS)
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600111
112test: pngtest
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -0500113 ./pngtest
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600114
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500115install-headers: png.h pngconf.h pngdefs.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600116 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
117 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500118 cp png.h pngconf.h pngdefs.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500119 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500120 chmod 644 $(DI)/$(LIBNAME)/pngdefs.h
121 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pngdefs.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600122 -@$(RM_F) $(DI)/libpng
123 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600124
125install-static: install-headers libpng.a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600126 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500127 cp libpng.a $(DL)/$(LIBNAME).a
128 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600129 -@$(RM_F) $(DL)/libpng.a
130 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600131
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500132install-shared: install-headers $(LIBSOVER) libpng.pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600133 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600134 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
135 -@$(RM_F) $(DL)/$(LIBSOMAJ)
136 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600137 cp $(LIBSOVER) $(DL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600138 chmod 755 $(DL)/$(LIBSOVER)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500139 (cd $(DL); \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600140 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500141 $(LN_SF) $(LIBSOMAJ) $(LIBSO); \
142 $(LN_SF) $(OLDSO) $(LIBSO))
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600143 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
144 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
145 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500146 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
147 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600148 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600149
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500150install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600151 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
152 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
153 -@$(RM_F) $(DM)/man3/libpng.3
154 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500155 cp libpng.3 $(DM)/man3
156 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600157 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
158 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500159 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500160
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500161install-config: libpng-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600162 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
163 -@$(RM_F) $(DB)/libpng-config
164 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500165 cp libpng-config $(DB)/$(LIBNAME)-config
166 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600167 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500168
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500169install: install-static install-shared install-man install-config pngdefs.h
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600170
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500171# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500172# move the library to its final location. Use test-dd to test it
173# before then.
174
175test-dd:
176 echo
177 echo Testing installed dynamic shared library in $(DL).
178 $(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600179 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500180 -L$(DL) -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600181 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500182 ./pngtestd pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500183
184test-installed:
185 echo
186 echo Testing installed dynamic shared library.
187 $(CC) $(CCFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600188 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500189 -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600190 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500191 ./pngtesti pngtest.png
Glenn Randers-Pehrsond020e9d2002-06-28 09:34:00 -0500192
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600193clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600194 $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600195 libpng-config $(LIBSO) $(LIBSOMAJ)* \
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500196 libpng.pc pngdefs.h
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600197
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600198DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
199writelock:
200 chmod a-w *.[ch35] $(DOCS) scripts/*
201
Glenn Randers-Pehrson87544ac1999-01-13 22:06:39 -0600202# DO NOT DELETE THIS LINE -- make depend depends on it.
203
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500204png.o: png.h pngconf.h pngdefs.h pngpriv.h
205pngerror.o: png.h pngconf.h pngdefs.h pngpriv.h
206pngrio.o: png.h pngconf.h pngdefs.h pngpriv.h
207pngwio.o: png.h pngconf.h pngdefs.h pngpriv.h
208pngmem.o: png.h pngconf.h pngdefs.h pngpriv.h
209pngset.o: png.h pngconf.h pngdefs.h pngpriv.h
210pngget.o: png.h pngconf.h pngdefs.h pngpriv.h
211pngread.o: png.h pngconf.h pngdefs.h pngpriv.h
212pngrtran.o: png.h pngconf.h pngdefs.h pngpriv.h
213pngrutil.o: png.h pngconf.h pngdefs.h pngpriv.h
214pngtrans.o: png.h pngconf.h pngdefs.h pngpriv.h
215pngwrite.o: png.h pngconf.h pngdefs.h pngpriv.h
216pngwtran.o: png.h pngconf.h pngdefs.h pngpriv.h
217pngwutil.o: png.h pngconf.h pngdefs.h pngpriv.h
218pngpread.o: png.h pngconf.h pngdefs.h pngpriv.h
219pngtest.o: png.h pngconf.h pngdefs.h