| 1 | # makefile for libpng on DEC Alpha Unix
|
|---|
| 2 | # Copyright (C) 2000-2002, 2006 Glenn Randers-Pehrson
|
|---|
| 3 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
|---|
| 4 | # For conditions of distribution and use, see copyright notice in png.h
|
|---|
| 5 |
|
|---|
| 6 | # Library name:
|
|---|
| 7 | PNGMAJ = 0
|
|---|
| 8 | PNGMIN = 1.2.29
|
|---|
| 9 | PNGVER = $(PNGMAJ).$(PNGMIN)
|
|---|
| 10 | LIBNAME = libpng12
|
|---|
| 11 |
|
|---|
| 12 | # Shared library names:
|
|---|
| 13 | LIBSO=$(LIBNAME).so
|
|---|
| 14 | LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
|
|---|
| 15 | LIBSOVER=$(LIBNAME).so.$(PNGVER)
|
|---|
| 16 | OLDSO=libpng.so
|
|---|
| 17 | OLDSOMAJ=libpng.so.3
|
|---|
| 18 | OLDSOVER=libpng.so.3.$(PNGMIN)
|
|---|
| 19 |
|
|---|
| 20 | # Utilities:
|
|---|
| 21 | AR_RC=ar rc
|
|---|
| 22 | CC=cc
|
|---|
| 23 | MKDIR_P=mkdir
|
|---|
| 24 | LN_SF=ln -f -s
|
|---|
| 25 | RANLIB=ranlib
|
|---|
| 26 | RM_F=/bin/rm -f
|
|---|
| 27 |
|
|---|
| 28 | # where make install puts libpng.a and png.h
|
|---|
| 29 | prefix=/usr/local
|
|---|
| 30 | exec_prefix=$(prefix)
|
|---|
| 31 | INCPATH=$(prefix)/include
|
|---|
| 32 | LIBPATH=$(exec_prefix)/lib
|
|---|
| 33 | MANPATH=$(prefix)/man
|
|---|
| 34 | BINPATH=$(exec_prefix)/bin
|
|---|
| 35 |
|
|---|
| 36 | # override DESTDIR= on the make install command line to easily support
|
|---|
| 37 | # installing into a temporary location. Example:
|
|---|
| 38 | #
|
|---|
| 39 | # make install DESTDIR=/tmp/build/libpng
|
|---|
| 40 | #
|
|---|
| 41 | # If you're going to install into a temporary location
|
|---|
| 42 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
|
|---|
| 43 | # you execute make install.
|
|---|
| 44 | DESTDIR=
|
|---|
| 45 |
|
|---|
| 46 | DB=$(DESTDIR)$(BINPATH)
|
|---|
| 47 | DI=$(DESTDIR)$(INCPATH)
|
|---|
| 48 | DL=$(DESTDIR)$(LIBPATH)
|
|---|
| 49 | DM=$(DESTDIR)$(MANPATH)
|
|---|
| 50 |
|
|---|
| 51 | # Where the zlib library and include files are located
|
|---|
| 52 | #ZLIBLIB=/usr/local/lib
|
|---|
| 53 | #ZLIBINC=/usr/local/include
|
|---|
| 54 | ZLIBLIB=../zlib
|
|---|
| 55 | ZLIBINC=../zlib
|
|---|
| 56 |
|
|---|
| 57 | CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
|---|
| 58 | LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
|
|---|
| 59 |
|
|---|
| 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 | all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
|
|---|
| 65 |
|
|---|
| 66 | libpng.a: $(OBJS)
|
|---|
| 67 | $(AR_RC) $@ $(OBJS)
|
|---|
| 68 | $(RANLIB) $@
|
|---|
| 69 |
|
|---|
| 70 | libpng.pc:
|
|---|
| 71 | cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
|
|---|
| 72 | -e s!@exec_prefix@!$(exec_prefix)! \
|
|---|
| 73 | -e s!@libdir@!$(LIBPATH)! \
|
|---|
| 74 | -e s!@includedir@!$(INCPATH)! \
|
|---|
| 75 | -e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
|
|---|
| 76 |
|
|---|
| 77 | libpng-config:
|
|---|
| 78 | ( cat scripts/libpng-config-head.in; \
|
|---|
| 79 | echo prefix=\"$(prefix)\"; \
|
|---|
| 80 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
|---|
| 81 | echo ccopts=\"-std\"; \
|
|---|
| 82 | echo L_opts=\"-L$(LIBPATH)\"; \
|
|---|
| 83 | echo libs=\"-lpng12 -lz -lm\"; \
|
|---|
| 84 | cat scripts/libpng-config-body.in ) > libpng-config
|
|---|
| 85 | chmod +x libpng-config
|
|---|
| 86 |
|
|---|
| 87 | $(LIBSO): $(LIBSOMAJ)
|
|---|
| 88 | $(LN_SF) $(LIBSOMAJ) $(LIBSO)
|
|---|
| 89 |
|
|---|
| 90 | $(LIBSOMAJ): $(LIBSOVER)
|
|---|
| 91 | $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
|
|---|
| 92 |
|
|---|
| 93 | $(LIBSOVER): $(OBJS)
|
|---|
| 94 | $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
|
|---|
| 95 | -soname $(LIBSOMAJ)
|
|---|
| 96 |
|
|---|
| 97 | $(OLDSOVER): $(OBJS)
|
|---|
| 98 | $(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) \
|
|---|
| 99 | -soname $(OLDSOMAJ)
|
|---|
| 100 |
|
|---|
| 101 | pngtest: pngtest.o libpng.a
|
|---|
| 102 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
|---|
| 103 |
|
|---|
| 104 | test: pngtest
|
|---|
| 105 | ./pngtest
|
|---|
| 106 |
|
|---|
| 107 | install-headers: png.h pngconf.h
|
|---|
| 108 | -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
|
|---|
| 109 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
|
|---|
| 110 | cp png.h pngconf.h $(DI)/$(LIBNAME)
|
|---|
| 111 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
|
|---|
| 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)/* .)
|
|---|
| 115 |
|
|---|
| 116 | install-static: install-headers libpng.a
|
|---|
| 117 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(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)
|
|---|
| 122 |
|
|---|
| 123 | install-shared: install-headers $(LIBSOVER) libpng.pc \
|
|---|
| 124 | $(OLDSOVER)
|
|---|
| 125 | -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
|---|
| 126 | -@/bin/rm -f $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
|
|---|
| 127 | -@/bin/rm -f $(DL)/$(LIBSOMAJ)
|
|---|
| 128 | -@/bin/rm -f $(DL)/$(OLDSO)
|
|---|
| 129 | -@/bin/rm -f $(DL)/$(OLDSOMAJ)
|
|---|
| 130 | -@/bin/rm -f $(DL)/$(OLDSOVER)*
|
|---|
| 131 | cp $(LIBSOVER) $(DL)
|
|---|
| 132 | cp $(OLDSOVER) $(DL)
|
|---|
| 133 | chmod 755 $(DL)/$(LIBSOVER)
|
|---|
| 134 | chmod 755 $(DL)/$(OLDSOVER)
|
|---|
| 135 | (cd $(DL); \
|
|---|
| 136 | $(LN_SF) $(OLDSOVER) $(OLDSOMAJ); \
|
|---|
| 137 | $(LN_SF) $(OLDSOMAJ) $(OLDSO); \
|
|---|
| 138 | $(LN_SF)(LIBSOVER) $(LIBSOMAJ); \
|
|---|
| 139 | $(LN_SF)(LIBSOMAJ) $(LIBSO))
|
|---|
| 140 | -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
|
|---|
| 141 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
|
|---|
| 142 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
|
|---|
| 143 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
|
|---|
| 144 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
|
|---|
| 145 | (cd $(DL)/pkgconfig; $(LN_SF)(LIBNAME).pc libpng.pc)
|
|---|
| 146 |
|
|---|
| 147 | install-man: libpng.3 libpngpf.3 png.5
|
|---|
| 148 | -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
|
|---|
| 149 | -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
|
|---|
| 150 | -@/bin/rm -f $(DM)/man3/libpng.3
|
|---|
| 151 | -@/bin/rm -f $(DM)/man3/libpngpf.3
|
|---|
| 152 | cp libpng.3 $(DM)/man3
|
|---|
| 153 | cp libpngpf.3 $(DM)/man3
|
|---|
| 154 | -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
|
|---|
| 155 | -@/bin/rm -f $(DM)/man5/png.5
|
|---|
| 156 | cp png.5 $(DM)/man5
|
|---|
| 157 |
|
|---|
| 158 | install-config: libpng-config
|
|---|
| 159 | -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
|
|---|
| 160 | -@/bin/rm -f $(DB)/libpng-config
|
|---|
| 161 | -@/bin/rm -f $(DB)/$(LIBNAME)-config
|
|---|
| 162 | cp libpng-config $(DB)/$(LIBNAME)-config
|
|---|
| 163 | chmod 755 $(DB)/$(LIBNAME)-config
|
|---|
| 164 | (cd $(DB); $(LN_SF)(LIBNAME)-config libpng-config)
|
|---|
| 165 |
|
|---|
| 166 | install: install-static install-shared install-man install-config
|
|---|
| 167 |
|
|---|
| 168 | # If you installed in $(DESTDIR), test-installed won't work until you
|
|---|
| 169 | # move the library to its final location. Use test-dd to test it
|
|---|
| 170 | # before then.
|
|---|
| 171 |
|
|---|
| 172 | test-dd:
|
|---|
| 173 | echo
|
|---|
| 174 | echo Testing installed dynamic shared library in $(DL).
|
|---|
| 175 | $(CC) -w1 -I$(DI) -I$(ZLIBINC) \
|
|---|
| 176 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
|---|
| 177 | -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL) \
|
|---|
| 178 | -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
|---|
| 179 | ./pngtestd pngtest.png
|
|---|
| 180 |
|
|---|
| 181 | test-installed:
|
|---|
| 182 | echo
|
|---|
| 183 | echo Testing installed dynamic shared library.
|
|---|
| 184 | $(CC) -w1 -I$(ZLIBINC) \
|
|---|
| 185 | `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
|---|
| 186 | -L$(ZLIBLIB) -R$(ZLIBLIB) \
|
|---|
| 187 | -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
|---|
| 188 | ./pngtesti pngtest.png
|
|---|
| 189 |
|
|---|
| 190 | clean:
|
|---|
| 191 | /bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
|
|---|
| 192 | libpng-config $(LIBSO) $(LIBSOMAJ)* \
|
|---|
| 193 | $(OLDSOVER) \
|
|---|
| 194 | libpng.pc
|
|---|
| 195 |
|
|---|
| 196 | # DO NOT DELETE THIS LINE -- make depend depends on it.
|
|---|
| 197 |
|
|---|
| 198 | png.o: png.h pngconf.h
|
|---|
| 199 | pngerror.o: png.h pngconf.h
|
|---|
| 200 | pngrio.o: png.h pngconf.h
|
|---|
| 201 | pngwio.o: png.h pngconf.h
|
|---|
| 202 | pngmem.o: png.h pngconf.h
|
|---|
| 203 | pngset.o: png.h pngconf.h
|
|---|
| 204 | pngget.o: png.h pngconf.h
|
|---|
| 205 | pngread.o: png.h pngconf.h
|
|---|
| 206 | pngrtran.o: png.h pngconf.h
|
|---|
| 207 | pngrutil.o: png.h pngconf.h
|
|---|
| 208 | pngtest.o: png.h pngconf.h
|
|---|
| 209 | pngtrans.o: png.h pngconf.h
|
|---|
| 210 | pngwrite.o: png.h pngconf.h
|
|---|
| 211 | pngwtran.o: png.h pngconf.h
|
|---|
| 212 | pngwutil.o: png.h pngconf.h
|
|---|
| 213 | pngpread.o: png.h pngconf.h
|
|---|
| 214 |
|
|---|