# makefile for libpng on Darwin / Mac OS X
-# Copyright (C) 2002 Glenn Randers-Pehrson
+# Copyright (C) 2002,2004 Glenn Randers-Pehrson
# Copyright (C) 2001 Christoph Pfisterer
# derived from makefile.linux:
# Copyright (C) 1998, 1999 Greg Roelofs
RANLIB=ranlib
PNGMAJ = 0
-PNGMIN = 1.2.4
+PNGMIN = 1.2.7
PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng12
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
- echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
- echo cflags=\"\"; \
- echo ldflags=\"-L$(LIBPATH)\"; \
+ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
+ echo L_opts=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng12 -lz\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
$(LIBNAME).$(PNGVER).dylib: $(OBJSDLL)
$(CC) -dynamiclib \
- -install_name $(DL)/$(LIBNAME).$(PNGMAJ).dylib \
- -current_version $(PNGMIN) -compatibility_version $(PNGMIN) \
+ -install_name $(LIBPATH)/$(LIBNAME).$(PNGMAJ).dylib \
+ -current_version $(PNGVER) -compatibility_version $(PNGVER) \
-o $(LIBNAME).$(PNGVER).dylib \
$(OBJSDLL) -L$(ZLIBLIB) -lz
+libpng.3.$(PNGMIN).dylib: $(OBJSDLL)
+ $(CC) -dynamiclib \
+ -install_name $(LIBPATH)/libpng.3.dylib \
+ -current_version 3 -compatibility_version 3 \
+ -o libpng.3.$(PNGMIN).dylib \
+ $(OBJSDLL) -L$(ZLIBLIB) -lz
+
pngtest: pngtest.o $(LIBNAME).dylib
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
cp libpng.a $(DL)/$(LIBNAME).a
chmod 644 $(DL)/$(LIBNAME).a
+ $(RANLIB) $(DL)/$(LIBNAME).a
-@/bin/rm -f $(DL)/libpng.a
(cd $(DL); ln -sf $(LIBNAME).a libpng.a)
-install-shared: install-headers $(LIBNAME).dylib libpng.pc
+install-shared: install-headers $(LIBNAME).dylib libpng.pc \
+ libpng.3.$(PNGMIN).dylib
-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
+ -@/bin/rm -f $(DL)/$(LIBNAME).$(PNGVER)*.dylib
-@/bin/rm -f $(DL)/$(LIBNAME).$(PNGMAJ)*.dylib
-@/bin/rm -f $(DL)/$(LIBNAME).dylib
-@/bin/rm -f $(DL)/libpng.dylib
-@/bin/rm -f $(DL)/libpng.3.dylib
- -@/bin/rm -f $(DL)/libpng.3.*.dylib
+ -@/bin/rm -f $(DL)/libpng.3.$(PNGMIN)*.dylib
cp $(LIBNAME).$(PNGVER).dylib $(DL)
+ cp libpng.3.$(PNGMIN).dylib $(DL)
chmod 755 $(DL)/$(LIBNAME).$(PNGVER).dylib
+ chmod 755 $(DL)/libpng.3.$(PNGMIN).dylib
(cd $(DL); \
- ln -sf $(LIBNAME).$(PNGVER).dylib libpng.dylib; \
- ln -sf $(LIBNAME).$(PNGVER).dylib libpng.3.dylib; \
- ln -sf $(LIBNAME).$(PNGVER).dylib libpng.3.$(PNGMIN).dylib; \
+ ln -sf libpng.3.$(PNGMIN).dylib libpng.3.dylib; \
+ ln -sf libpng.3.dylib libpng.dylib; \
ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib; \
ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib)
-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
-# move the library to its final location.
+# move the library to its final location. Use test-dd to test it
+# before then.
+
+test-dd:
+ echo
+ echo Testing installed dynamic shared library in $(DL).
+ $(CC) -I$(DI) -I$(ZLIBINC) \
+ `$(BINPATH)/libpng12-config --cflags` pngtest.c \
+ -L$(DL) -L$(ZLIBLIB) \
+ -o pngtestd `$(BINPATH)/libpng12-config --ldflags`
+ ./pngtestd pngtest.png
test-installed:
$(CC) $(CFLAGS) \
- `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
+ `$(BINPATH)/libpng12-config --cflags` pngtest.c \
-L$(ZLIBLIB) \
- -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs`
+ -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
./pngtesti pngtest.png
clean:
- rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
- $(LIBNAME).*dylib pngtesti
+ rm -f *.o libpng.a pngtest pngout.png libpng-config \
+ libpng.3.$(PNGMIN).dylib \
+ libpng.pc $(LIBNAME).*dylib pngtesti
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock: