blob: 93b2d2c1800fcf34f4afd55f796e520e4623ab9d [file] [log] [blame]
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -06001# makefile for libpng on HP-UX using GCC
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -06002# Copyright (C) 2002, 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
6# For conditions of distribution and use, see copyright notice in png.h
7
8CC=gcc
9
10# where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h
11prefix=/usr/local
12
13# Where the zlib library and include files are located
14ZLIBLIB=/opt/zlib/lib
15ZLIBINC=/opt/zlib/include
16
17ALIGN=
18# for i386:
19#ALIGN=-malign-loops=2 -malign-functions=2
20
21WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
22 -Wmissing-declarations -Wtraditional -Wcast-align \
23 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
24
25# for pgcc version 2.95.1, -O3 is buggy; don't use it.
26
27CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
28 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050029#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
30LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060031
32RANLIB=ranlib
33#RANLIB=echo
34
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -060035PNGMAJ = 0
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050036PNGMIN = 1.2.4beta1
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060037PNGVER = $(PNGMAJ).$(PNGMIN)
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060038LIBNAME = libpng12
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060039
40INCPATH=$(prefix)/include
41LIBPATH=$(prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050042MANPATH=$(prefix)/man
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -050043BINPATH=$(prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050044
45# override DESTDIR= on the make install command line to easily support
46# installing into a temporary location. Example:
47#
48# make install DESTDIR=/tmp/build/libpng
49#
50# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050051# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050052# you execute make install.
53DESTDIR=
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060054
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050055DB=$(DESTDIR)$(BINPATH)
56DI=$(DESTDIR)$(INCPATH)
57DL=$(DESTDIR)$(LIBPATH)
58DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050059
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060060OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
61 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
62 pngwtran.o pngmem.o pngerror.o pngpread.o
63
64OBJSDLL = $(OBJS:.o=.pic.o)
65
66.SUFFIXES: .c .o .pic.o
67
68.c.pic.o:
69 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
70
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050071all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060072
73libpng.a: $(OBJS)
74 ar rc $@ $(OBJS)
75 $(RANLIB) $@
76
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050077libpng.pc:
78 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
79
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050080libpng-config:
81 ( cat scripts/libpng-config-head.in; \
82 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson22f28962002-05-13 18:17:09 -050083 echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050084 echo cflags=\"\"; \
85 echo ldflags=\"\"; \
86 echo libs=\"-lpng12 -lz -lm\"; \
87 cat scripts/libpng-config-body.in ) > libpng-config
88 chmod +x libpng-config
89
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060090$(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
91 ln -f -s $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060092
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060093$(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
94 ln -f -s $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060095
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -060096$(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -060097 $(LD) -b -L$(ZLIBLIB) +s +b $(ZLIBLIB) \
98 +h libpng.sl.$(PNGMAJ) -o libpng.sl.$(PNGVER) $(OBJSDLL) -lz
99
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600100pngtest: pngtest.o $(LIBNAME).sl
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600101 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
102
103test: pngtest
104 ./pngtest
105
Glenn Randers-Pehrsonc6de22d2002-02-23 18:55:25 -0600106
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600107install-headers: png.h pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500108 -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
109 -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
110 cp png.h pngconf.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500111 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500112 -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
113 -@/bin/rm -f $(DI)/libpng
114 (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600115
116install-static: install-headers libpng.a
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500117 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
118 cp libpng.a $(DL)/$(LIBNAME).a
119 chmod 644 $(DL)/$(LIBNAME).a
120 -@/bin/rm -f $(DL)/libpng.a
121 (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600122
Glenn Randers-Pehrson25d82242002-05-01 11:51:26 -0500123install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500124 -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500125 -@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)* $(DL)/$(LIBNAME).sl
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500126 -@/bin/rm -f $(DL)/libpng.so
127 -@/bin/rm -f $(DL)/libpng.so.3
128 -@/bin/rm -f $(DL)/libpng.so.3.*
129 cp $(LIBNAME).sl.$(PNGVER) $(DL)
130 chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
131 (cd $(DL); \
Glenn Randers-Pehrson73d57cb2002-03-25 18:49:08 -0600132 ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
133 ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3; \
134 ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3.$(PNGMIN); \
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600135 ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
136 ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500137 -@if [ ! -d $(DL)/pkgconfig ]; then mkdir \
138 $(DL)/pkgconfig; fi
139 -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
140 -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
141 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
142 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
143 (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600144
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500145install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500146 -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
147 -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
148 -@/bin/rm -f $(DM)/man3/libpng.3
149 -@/bin/rm -f $(DM)/man3/libpngpf.3
150 cp libpng.3 $(DM)/man3
151 cp libpngpf.3 $(DM)/man3
152 -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
153 -@/bin/rm -f $(DM)/man5/png.5
154 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500155
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500156install-config: libpng-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500157 -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
158 -@/bin/rm -f $(DB)/libpng-config
159 -@/bin/rm -f $(DB)/$(LIBNAME)-config
160 cp libpng-config $(DB)/$(LIBNAME)-config
161 chmod 755 $(DB)/$(LIBNAME)-config
162 (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500163
164install: install-static install-shared install-man install-config
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600165
166clean:
Glenn Randers-Pehrson9c0f0942002-02-21 23:14:23 -0600167 /bin/rm -f *.o libpng.a $(SHAREDLIB).sl $(SHAREDLIB).sl.$(PNGMAJ)* \
168 pngtest pngout.png
Glenn Randers-Pehrson19095602001-03-14 07:08:39 -0600169
170DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
171writelock:
172 chmod a-w *.[ch35] $(DOCS) scripts/*
173
174# DO NOT DELETE THIS LINE -- make depend depends on it.
175
176png.o png.pic.o: png.h pngconf.h
177pngerror.o pngerror.pic.o: png.h pngconf.h
178pngrio.o pngrio.pic.o: png.h pngconf.h
179pngwio.o pngwio.pic.o: png.h pngconf.h
180pngmem.o pngmem.pic.o: png.h pngconf.h
181pngset.o pngset.pic.o: png.h pngconf.h
182pngget.o pngget.pic.o: png.h pngconf.h
183pngread.o pngread.pic.o: png.h pngconf.h
184pngrtran.o pngrtran.pic.o: png.h pngconf.h
185pngrutil.o pngrutil.pic.o: png.h pngconf.h
186pngtrans.o pngtrans.pic.o: png.h pngconf.h
187pngwrite.o pngwrite.pic.o: png.h pngconf.h
188pngwtran.o pngwtran.pic.o: png.h pngconf.h
189pngwutil.o pngwutil.pic.o: png.h pngconf.h
190pngpread.o pngpread.pic.o: png.h pngconf.h
191
192pngtest.o: png.h pngconf.h