Glenn Randers-Pehrson | 4fb046a | 2002-04-15 09:25:51 -0500 | [diff] [blame^] | 1 | # makefile for libpng under FreeBSD |
| 2 | # Copyright (C) 2002 Glenn Randers-Pehrson and Andrey A. Chernov |
| 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 | # where make install puts libpng.a and png.h |
| 7 | prefix=/usr/local |
| 8 | |
| 9 | PNGMAJ= 5 |
| 10 | .if (${OBJFORMAT} == "elf") |
| 11 | PNGVER= $(PNGMAJ) |
| 12 | .else |
| 13 | PNGMIN= 0 |
| 14 | PNGVER= $(PNGMAJ).$(PNGMIN) |
| 15 | .endif |
| 16 | |
| 17 | CFLAGS+= -I. -DPNG_USE_PNGGCCRD |
| 18 | .if (${MACHINE_ARCH} != "i386") |
| 19 | CFLAGS+= -DPNG_NO_ASSEMBLER_CODE |
| 20 | .endif |
| 21 | LDFLAGS+=-L. -lpng -lz -lm -static |
| 22 | |
| 23 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ |
| 24 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ |
| 25 | pngwtran.o pngmem.o pngerror.o pngpread.o pnggccrd.o |
| 26 | |
| 27 | .SUFFIXES: .c .so .o |
| 28 | |
| 29 | .c.so: |
| 30 | ${CC} ${CFLAGS} -fPIC -DPIC -o $@ -c $< |
| 31 | |
| 32 | all: libpng.a libpng.so.${PNGVER} pngtest |
| 33 | |
| 34 | libpng.a: $(OBJS) |
| 35 | ar rc $@ $(OBJS) |
| 36 | $(RANLIB) $@ |
| 37 | |
| 38 | libpng.so.${PNGVER}: $(OBJS:S/o$/so/g) |
| 39 | .if (${OBJFORMAT} == "elf") |
| 40 | ${CC} -shared -Wl,-x,-soname,$@ -o $@ $(OBJS:S/o$/so/g) -lz -lm |
| 41 | .else |
| 42 | ${CC} -shared -Wl,-x -o $@ $(OBJS:S/o$/so/g) -lz -lm |
| 43 | .endif |
| 44 | |
| 45 | pngtest: pngtest.o libpng.a |
| 46 | $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS) |
| 47 | |
| 48 | test: pngtest |
| 49 | ./pngtest |
| 50 | |
| 51 | install: libpng.a libpng.so.${PNGVER} |
| 52 | -@mkdir $(prefix)/include/libpng |
| 53 | ${INSTALL} -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} \ |
| 54 | png.h pngconf.h $(prefix)/include/libpng |
| 55 | ln -sf libpng/png.h $(prefix)/include/png.h |
| 56 | ln -sf libpng/pngconf.h $(prefix)/include/pngconf.h |
| 57 | ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ |
| 58 | libpng.a libpng.so.${PNGVER} $(prefix)/lib |
| 59 | $(RANLIB) $(prefix)/lib/libpng.a |
| 60 | ln -sf libpng.so.${PNGVER} $(prefix)/lib/libpng.so |
| 61 | /sbin/ldconfig -R |
| 62 | ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ |
| 63 | libpng.3 libpngpf.3 $(prefix)/man/man3 |
| 64 | ${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \ |
| 65 | png.5 $(prefix)/man/man5 |
| 66 | |
| 67 | clean: |
| 68 | rm -f *.o libpng.a libpng.so libpng.so.${PNGVER} pngtest pngout.png |
| 69 | |
| 70 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO |
| 71 | writelock: |
| 72 | chmod a-w *.[ch35] $(DOCS) scripts/* |
| 73 | |
| 74 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 75 | |
| 76 | png.o: png.h pngconf.h |
| 77 | pngerror.o: png.h pngconf.h |
| 78 | pngrio.o: png.h pngconf.h |
| 79 | pngwio.o: png.h pngconf.h |
| 80 | pngmem.o: png.h pngconf.h |
| 81 | pngset.o: png.h pngconf.h |
| 82 | pngget.o: png.h pngconf.h |
| 83 | pngread.o: png.h pngconf.h |
| 84 | pngrtran.o: png.h pngconf.h |
| 85 | pngrutil.o: png.h pngconf.h |
| 86 | pngtest.o: png.h pngconf.h |
| 87 | pngtrans.o: png.h pngconf.h |
| 88 | pngwrite.o: png.h pngconf.h |
| 89 | pngwtran.o: png.h pngconf.h |
| 90 | pngwutil.o: png.h pngconf.h |
| 91 | pngpread.o: png.h pngconf.h |
| 92 | pnggccrd.o: png.h pngconf.h |
| 93 | |