| 1 | # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
 | 
|---|
| 2 | # Copyright (C) 2002, Glenn Randers-Pehrson
 | 
|---|
| 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 | LD=ld
 | 
|---|
| 10 | 
 | 
|---|
| 11 | # where "make install" puts libpng.a, libpng.sl*, png.h and pngconf.h
 | 
|---|
| 12 | prefix=/usr/local
 | 
|---|
| 13 | 
 | 
|---|
| 14 | # Where the zlib library and include files are located
 | 
|---|
| 15 | ZLIBLIB=/opt/zlib/lib
 | 
|---|
| 16 | ZLIBINC=/opt/zlib/include
 | 
|---|
| 17 | 
 | 
|---|
| 18 | # Note that if you plan to build a libpng shared library, zlib must also
 | 
|---|
| 19 | # be a shared library, which zlib's configure does not do.  After running
 | 
|---|
| 20 | # zlib's configure, edit the appropriate lines of makefile to read:
 | 
|---|
| 21 | #   CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
 | 
|---|
| 22 | #   LDSHARED=ld -b
 | 
|---|
| 23 | #   SHAREDLIB=libz.sl
 | 
|---|
| 24 | 
 | 
|---|
| 25 | ALIGN=
 | 
|---|
| 26 | # for i386:
 | 
|---|
| 27 | #ALIGN=-malign-loops=2 -malign-functions=2
 | 
|---|
| 28 | 
 | 
|---|
| 29 | WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
 | 
|---|
| 30 |         -Wmissing-declarations -Wtraditional -Wcast-align \
 | 
|---|
| 31 |         -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
 | 
|---|
| 32 | 
 | 
|---|
| 33 | # for pgcc version 2.95.1, -O3 is buggy; don't use it.
 | 
|---|
| 34 | 
 | 
|---|
| 35 | CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops \
 | 
|---|
| 36 |         $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
 | 
|---|
| 37 | #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
 | 
|---|
| 38 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm
 | 
|---|
| 39 | 
 | 
|---|
| 40 | RANLIB=ranlib
 | 
|---|
| 41 | #RANLIB=echo
 | 
|---|
| 42 | 
 | 
|---|
| 43 | PNGMAJ = 0
 | 
|---|
| 44 | PNGMIN = 1.2.5
 | 
|---|
| 45 | PNGVER = $(PNGMAJ).$(PNGMIN)
 | 
|---|
| 46 | LIBNAME = libpng12
 | 
|---|
| 47 | 
 | 
|---|
| 48 | INCPATH=$(prefix)/include
 | 
|---|
| 49 | LIBPATH=$(prefix)/lib
 | 
|---|
| 50 | MANPATH=$(prefix)/man
 | 
|---|
| 51 | BINPATH=$(prefix)/bin
 | 
|---|
| 52 | 
 | 
|---|
| 53 | # override DESTDIR= on the make install command line to easily support
 | 
|---|
| 54 | # installing into a temporary location.  Example:
 | 
|---|
| 55 | #
 | 
|---|
| 56 | #    make install DESTDIR=/tmp/build/libpng
 | 
|---|
| 57 | #
 | 
|---|
| 58 | # If you're going to install into a temporary location
 | 
|---|
| 59 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
 | 
|---|
| 60 | # you execute make install.
 | 
|---|
| 61 | DESTDIR=
 | 
|---|
| 62 | 
 | 
|---|
| 63 | DB=$(DESTDIR)$(BINPATH)
 | 
|---|
| 64 | DI=$(DESTDIR)$(INCPATH)
 | 
|---|
| 65 | DL=$(DESTDIR)$(LIBPATH)
 | 
|---|
| 66 | DM=$(DESTDIR)$(MANPATH)
 | 
|---|
| 67 | 
 | 
|---|
| 68 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 | 
|---|
| 69 |         pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
 | 
|---|
| 70 |         pngwtran.o pngmem.o pngerror.o pngpread.o
 | 
|---|
| 71 | 
 | 
|---|
| 72 | OBJSDLL = $(OBJS:.o=.pic.o)
 | 
|---|
| 73 | 
 | 
|---|
| 74 | .SUFFIXES:      .c .o .pic.o
 | 
|---|
| 75 | 
 | 
|---|
| 76 | .c.pic.o:
 | 
|---|
| 77 |         $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
 | 
|---|
| 78 | 
 | 
|---|
| 79 | all: libpng.a $(LIBNAME).sl pngtest libpng.pc libpng-config
 | 
|---|
| 80 | 
 | 
|---|
| 81 | libpng.a: $(OBJS)
 | 
|---|
| 82 |         ar rc $@ $(OBJS)
 | 
|---|
| 83 |         $(RANLIB) $@
 | 
|---|
| 84 | 
 | 
|---|
| 85 | libpng.pc:
 | 
|---|
| 86 |         cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
 | 
|---|
| 87 | 
 | 
|---|
| 88 | libpng-config:
 | 
|---|
| 89 |         ( cat scripts/libpng-config-head.in; \
 | 
|---|
| 90 |         echo prefix=\"$(prefix)\"; \
 | 
|---|
| 91 |         echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
 | 
|---|
| 92 |         echo libs=\"-lpng12 -lz -lm\"; \
 | 
|---|
| 93 |         cat scripts/libpng-config-body.in ) > libpng-config
 | 
|---|
| 94 |         chmod +x libpng-config
 | 
|---|
| 95 | 
 | 
|---|
| 96 | $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
 | 
|---|
| 97 |         ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
 | 
|---|
| 98 | 
 | 
|---|
| 99 | $(LIBNAME).sl.$(PNGMAJ): $(LIBNAME).sl.$(PNGVER)
 | 
|---|
| 100 |         ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ)
 | 
|---|
| 101 | 
 | 
|---|
| 102 | $(LIBNAME).sl.$(PNGVER): $(OBJSDLL)
 | 
|---|
| 103 |         $(LD) -b +s \
 | 
|---|
| 104 |         +h $(LIBNAME).sl.$(PNGMAJ) -o $(LIBNAME).sl.$(PNGVER) $(OBJSDLL)
 | 
|---|
| 105 | 
 | 
|---|
| 106 | libpng.sl.3.$(PNGMIN): $(OBJSDLL)
 | 
|---|
| 107 |         $(LD) -b +s \
 | 
|---|
| 108 |         +h libpng.sl.3 -o libpng.sl.3.$(PNGMIN) $(OBJSDLL)
 | 
|---|
| 109 | 
 | 
|---|
| 110 | pngtest: pngtest.o $(LIBNAME).sl
 | 
|---|
| 111 |         $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
 | 
|---|
| 112 | 
 | 
|---|
| 113 | test: pngtest
 | 
|---|
| 114 |         ./pngtest
 | 
|---|
| 115 | 
 | 
|---|
| 116 | 
 | 
|---|
| 117 | install-headers: png.h pngconf.h
 | 
|---|
| 118 |         -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
 | 
|---|
| 119 |         -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
 | 
|---|
| 120 |         cp png.h pngconf.h $(DI)/$(LIBNAME)
 | 
|---|
| 121 |         chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
 | 
|---|
| 122 |         -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
 | 
|---|
| 123 |         -@/bin/rm -f $(DI)/libpng
 | 
|---|
| 124 |         (cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 | 
|---|
| 125 | 
 | 
|---|
| 126 | install-static: install-headers libpng.a
 | 
|---|
| 127 |         -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 | 
|---|
| 128 |         cp libpng.a $(DL)/$(LIBNAME).a
 | 
|---|
| 129 |         chmod 644 $(DL)/$(LIBNAME).a
 | 
|---|
| 130 |         -@/bin/rm -f $(DL)/libpng.a
 | 
|---|
| 131 |         (cd $(DL); ln -sf $(LIBNAME).a libpng.a)
 | 
|---|
| 132 | 
 | 
|---|
| 133 | install-shared: install-headers $(LIBNAME).sl.$(PNGVER) libpng.pc \
 | 
|---|
| 134 |         libpng.sl.3.$(PNGMIN)
 | 
|---|
| 135 |         -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 | 
|---|
| 136 |         -@/bin/rm -f $(DL)/$(LIBNAME).sl.$(PNGVER)* $(DL)/$(LIBNAME).sl
 | 
|---|
| 137 |         -@/bin/rm -f $(DL)/libpng.sl
 | 
|---|
| 138 |         -@/bin/rm -f $(DL)/libpng.sl.3
 | 
|---|
| 139 |         -@/bin/rm -f $(DL)/libpng.sl.3.$(PNGMIN)*
 | 
|---|
| 140 |         cp $(LIBNAME).sl.$(PNGVER) $(DL)
 | 
|---|
| 141 |         cp libpng.sl.3.$(PNGMIN) $(DL)
 | 
|---|
| 142 |         chmod 755 $(DL)/$(LIBNAME).sl.$(PNGVER)
 | 
|---|
| 143 |         chmod 755 $(DL)/libpng.sl.3.$(PNGMIN)
 | 
|---|
| 144 |         (cd $(DL); \
 | 
|---|
| 145 |         ln -sf libpng.sl.3.$(PNGMIN) libpng.sl.3; \
 | 
|---|
| 146 |         ln -sf libpng.sl.3 libpng.sl; \
 | 
|---|
| 147 |         ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
 | 
|---|
| 148 |         ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
 | 
|---|
| 149 |         -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
 | 
|---|
| 150 |         -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
 | 
|---|
| 151 |         -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
 | 
|---|
| 152 |         cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
 | 
|---|
| 153 |         chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
 | 
|---|
| 154 |         (cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
 | 
|---|
| 155 | 
 | 
|---|
| 156 | install-man: libpng.3 libpngpf.3 png.5
 | 
|---|
| 157 |         -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
 | 
|---|
| 158 |         -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
 | 
|---|
| 159 |         -@/bin/rm -f $(DM)/man3/libpng.3
 | 
|---|
| 160 |         -@/bin/rm -f $(DM)/man3/libpngpf.3
 | 
|---|
| 161 |         cp libpng.3 $(DM)/man3
 | 
|---|
| 162 |         cp libpngpf.3 $(DM)/man3
 | 
|---|
| 163 |         -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
 | 
|---|
| 164 |         -@/bin/rm -f $(DM)/man5/png.5
 | 
|---|
| 165 |         cp png.5 $(DM)/man5
 | 
|---|
| 166 | 
 | 
|---|
| 167 | install-config: libpng-config
 | 
|---|
| 168 |         -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
 | 
|---|
| 169 |         -@/bin/rm -f $(DB)/libpng-config
 | 
|---|
| 170 |         -@/bin/rm -f $(DB)/$(LIBNAME)-config
 | 
|---|
| 171 |         cp libpng-config $(DB)/$(LIBNAME)-config
 | 
|---|
| 172 |         chmod 755 $(DB)/$(LIBNAME)-config
 | 
|---|
| 173 |         (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
 | 
|---|
| 174 | 
 | 
|---|
| 175 | install: install-static install-shared install-man install-config
 | 
|---|
| 176 | 
 | 
|---|
| 177 | # If you installed in $(DESTDIR), test-installed won't work until you
 | 
|---|
| 178 | # move the library to its final location.
 | 
|---|
| 179 | 
 | 
|---|
| 180 | test-installed:
 | 
|---|
| 181 |         echo
 | 
|---|
| 182 |         echo Testing installed dynamic shared library.
 | 
|---|
| 183 |         $(CC) -I$(ZLIBINC) \
 | 
|---|
| 184 |            `$(BINPATH)/libpng12-config --cflags` pngtest.c \
 | 
|---|
| 185 |            -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
 | 
|---|
| 186 |            -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
 | 
|---|
| 187 |         ./pngtesti pngtest.png
 | 
|---|
| 188 | 
 | 
|---|
| 189 | clean:
 | 
|---|
| 190 |         /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
 | 
|---|
| 191 |         libpng-config $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \
 | 
|---|
| 192 |         libpng.sl.3.$(PNGMIN) \
 | 
|---|
| 193 |         libpng.pc
 | 
|---|
| 194 | 
 | 
|---|
| 195 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 | 
|---|
| 196 | writelock:
 | 
|---|
| 197 |         chmod a-w *.[ch35] $(DOCS) scripts/*
 | 
|---|
| 198 | 
 | 
|---|
| 199 | # DO NOT DELETE THIS LINE -- make depend depends on it.
 | 
|---|
| 200 | 
 | 
|---|
| 201 | png.o png.pic.o: png.h pngconf.h
 | 
|---|
| 202 | pngerror.o pngerror.pic.o: png.h pngconf.h
 | 
|---|
| 203 | pngrio.o pngrio.pic.o: png.h pngconf.h
 | 
|---|
| 204 | pngwio.o pngwio.pic.o: png.h pngconf.h
 | 
|---|
| 205 | pngmem.o pngmem.pic.o: png.h pngconf.h
 | 
|---|
| 206 | pngset.o pngset.pic.o: png.h pngconf.h
 | 
|---|
| 207 | pngget.o pngget.pic.o: png.h pngconf.h
 | 
|---|
| 208 | pngread.o pngread.pic.o: png.h pngconf.h
 | 
|---|
| 209 | pngrtran.o pngrtran.pic.o: png.h pngconf.h
 | 
|---|
| 210 | pngrutil.o pngrutil.pic.o: png.h pngconf.h
 | 
|---|
| 211 | pngtrans.o pngtrans.pic.o: png.h pngconf.h
 | 
|---|
| 212 | pngwrite.o pngwrite.pic.o: png.h pngconf.h
 | 
|---|
| 213 | pngwtran.o pngwtran.pic.o: png.h pngconf.h
 | 
|---|
| 214 | pngwutil.o pngwutil.pic.o: png.h pngconf.h
 | 
|---|
| 215 | pngpread.o pngpread.pic.o: png.h pngconf.h
 | 
|---|
| 216 | 
 | 
|---|
| 217 | pngtest.o: png.h pngconf.h
 | 
|---|