Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 1 | # makefile for libpng on HP-UX using GCC |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 2 | # Copyright (C) 2002, Glenn Randers-Pehrson |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 3 | # 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 | |
| 8 | CC=gcc |
| 9 | |
| 10 | # where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h |
| 11 | prefix=/usr/local |
| 12 | |
| 13 | # Where the zlib library and include files are located |
| 14 | ZLIBLIB=/opt/zlib/lib |
| 15 | ZLIBINC=/opt/zlib/include |
| 16 | |
| 17 | ALIGN= |
| 18 | # for i386: |
| 19 | #ALIGN=-malign-loops=2 -malign-functions=2 |
| 20 | |
| 21 | WARNMORE=-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 | |
| 27 | CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \ |
| 28 | $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 29 | #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm |
| 30 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 31 | |
| 32 | RANLIB=ranlib |
| 33 | #RANLIB=echo |
| 34 | |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 35 | PNGMAJ = 0 |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame^] | 36 | PNGMIN = 1.2.4beta1 |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 37 | PNGVER = $(PNGMAJ).$(PNGMIN) |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 38 | LIBNAME = libpng12 |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 39 | |
| 40 | INCPATH=$(prefix)/include |
| 41 | LIBPATH=$(prefix)/lib |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 42 | MANPATH=$(prefix)/man |
Glenn Randers-Pehrson | 704228f | 2002-05-02 20:49:40 -0500 | [diff] [blame] | 43 | BINPATH=$(prefix)/bin |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 44 | |
| 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-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame^] | 51 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 52 | # you execute make install. |
| 53 | DESTDIR= |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 54 | |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame^] | 55 | DB=$(DESTDIR)$(BINPATH) |
| 56 | DI=$(DESTDIR)$(INCPATH) |
| 57 | DL=$(DESTDIR)$(LIBPATH) |
| 58 | DM=$(DESTDIR)$(MANPATH) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 59 | |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 60 | OBJS = 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 | |
| 64 | OBJSDLL = $(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-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame^] | 71 | all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 72 | |
| 73 | libpng.a: $(OBJS) |
| 74 | ar rc $@ $(OBJS) |
| 75 | $(RANLIB) $@ |
| 76 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 77 | libpng.pc: |
| 78 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc |
| 79 | |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 80 | libpng-config: |
| 81 | ( cat scripts/libpng-config-head.in; \ |
| 82 | echo prefix=\"$(prefix)\"; \ |
Glenn Randers-Pehrson | 22f2896 | 2002-05-13 18:17:09 -0500 | [diff] [blame] | 83 | echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \ |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 84 | 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-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 90 | $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ) |
| 91 | ln -f -s $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 92 | |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 93 | $(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER) |
| 94 | ln -f -s $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ) |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 95 | |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 96 | $(LIBNAME).sl.$(PNGVER): $(OBJSDLL) |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 97 | $(LD) -b -L$(ZLIBLIB) +s +b $(ZLIBLIB) \ |
| 98 | +h libpng.sl.$(PNGMAJ) -o libpng.sl.$(PNGVER) $(OBJSDLL) -lz |
| 99 | |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 100 | pngtest: pngtest.o $(LIBNAME).sl |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 101 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
| 102 | |
| 103 | test: pngtest |
| 104 | ./pngtest |
| 105 | |
Glenn Randers-Pehrson | c6de22d | 2002-02-23 18:55:25 -0600 | [diff] [blame] | 106 | |
Glenn Randers-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 107 | install-headers: png.h pngconf.h |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 108 | -@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-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame^] | 111 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 112 | -@/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-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 115 | |
| 116 | install-static: install-headers libpng.a |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 117 | -@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-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 122 | |
Glenn Randers-Pehrson | 25d8224 | 2002-05-01 11:51:26 -0500 | [diff] [blame] | 123 | install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 124 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi |
Glenn Randers-Pehrson | 07748d1 | 2002-05-25 11:12:10 -0500 | [diff] [blame^] | 125 | -@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGMAJ)* $(DL)/$(LIBNAME).sl |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 126 | -@/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-Pehrson | 73d57cb | 2002-03-25 18:49:08 -0600 | [diff] [blame] | 132 | 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-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 135 | ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \ |
| 136 | ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl) |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 137 | -@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-Pehrson | c1bfe68 | 2002-03-06 22:08:00 -0600 | [diff] [blame] | 144 | |
Glenn Randers-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 145 | install-man: libpng.3 libpngpf.3 png.5 |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 146 | -@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-Pehrson | 03008a0 | 2002-04-27 10:11:25 -0500 | [diff] [blame] | 155 | |
Glenn Randers-Pehrson | 837a3d1 | 2002-05-10 20:19:58 -0500 | [diff] [blame] | 156 | install-config: libpng-config |
Glenn Randers-Pehrson | cfbed9b | 2002-05-21 18:06:08 -0500 | [diff] [blame] | 157 | -@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-Pehrson | 704228f | 2002-05-02 20:49:40 -0500 | [diff] [blame] | 163 | |
| 164 | install: install-static install-shared install-man install-config |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 165 | |
| 166 | clean: |
Glenn Randers-Pehrson | 9c0f094 | 2002-02-21 23:14:23 -0600 | [diff] [blame] | 167 | /bin/rm -f *.o libpng.a $(SHAREDLIB).sl $(SHAREDLIB).sl.$(PNGMAJ)* \ |
| 168 | pngtest pngout.png |
Glenn Randers-Pehrson | 1909560 | 2001-03-14 07:08:39 -0600 | [diff] [blame] | 169 | |
| 170 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
| 171 | writelock: |
| 172 | chmod a-w *.[ch35] $(DOCS) scripts/* |
| 173 | |
| 174 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 175 | |
| 176 | png.o png.pic.o: png.h pngconf.h |
| 177 | pngerror.o pngerror.pic.o: png.h pngconf.h |
| 178 | pngrio.o pngrio.pic.o: png.h pngconf.h |
| 179 | pngwio.o pngwio.pic.o: png.h pngconf.h |
| 180 | pngmem.o pngmem.pic.o: png.h pngconf.h |
| 181 | pngset.o pngset.pic.o: png.h pngconf.h |
| 182 | pngget.o pngget.pic.o: png.h pngconf.h |
| 183 | pngread.o pngread.pic.o: png.h pngconf.h |
| 184 | pngrtran.o pngrtran.pic.o: png.h pngconf.h |
| 185 | pngrutil.o pngrutil.pic.o: png.h pngconf.h |
| 186 | pngtrans.o pngtrans.pic.o: png.h pngconf.h |
| 187 | pngwrite.o pngwrite.pic.o: png.h pngconf.h |
| 188 | pngwtran.o pngwtran.pic.o: png.h pngconf.h |
| 189 | pngwutil.o pngwutil.pic.o: png.h pngconf.h |
| 190 | pngpread.o pngpread.pic.o: png.h pngconf.h |
| 191 | |
| 192 | pngtest.o: png.h pngconf.h |