blob: a2a549b219307459fd64d2bc524366272da6ad49 [file] [log] [blame]
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -06001# makefile for libpng
Glenn Randers-Pehrson5af03072014-01-20 12:36:30 -06002# Copyright (C) 2007-2009, 2014 Glenn Randers-Pehrson
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -06003# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
Glenn Randers-Pehrson3e61d792009-06-24 09:31:28 -05004#
Glenn Randers-Pehrsonbfbf8652009-06-26 21:46:52 -05005# This code is released under the libpng license.
Glenn Randers-Pehrsonc332bbc2009-06-25 13:43:50 -05006# For conditions of distribution and use, see the disclaimer
Glenn Randers-Pehrson037023b2009-06-24 10:27:36 -05007# and license in png.h
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -06008
9PREFIX?= /usr/local
10LIBDIR= ${PREFIX}/lib
11MANDIR= ${PREFIX}/man/cat
12
Glenn Randers-Pehrson7455cbf2011-11-24 14:40:36 -060013SHLIB_MAJOR= 16
Glenn Randers-Pehrson0ece6312014-07-21 17:01:01 -050014SHLIB_MINOR= 1.6.13beta03
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060015
16LIB= png
Glenn Randers-Pehrson glennrp@comcast.net7ecf7bd2009-05-02 15:36:08 -050017SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060018 pngread.c pngrio.c pngrtran.c pngrutil.c pngset.c pngtrans.c \
19 pngwio.c pngwrite.c pngwtran.c pngwutil.c
20
Glenn Randers-Pehrson0b3634b2011-12-17 09:57:00 -060021HDRS= png.h pngconf.h pnglibconf.h
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060022
Glenn Randers-Pehrson316152f2009-12-04 08:42:32 -060023CFLAGS+= -W -Wall
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -050024CPPFLAGS+= -I${.CURDIR}
25
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060026NOPROFILE= Yes
27
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050028CLEANFILES+= pngtest.o pngtest pnglibconf.h
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060029
30MAN= libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060031DOCS= ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
32 libpng-manual.txt
33
Cosmin Truta9ab7b4c2014-03-22 13:13:11 -050034# Pre-built configuration
35# See scripts/pnglibconf.mak for more options
36PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt
37
Glenn Randers-Pehrson42503282014-01-12 10:44:01 -060038.c.o:
39 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060040
Cosmin Truta9ab7b4c2014-03-22 13:13:11 -050041pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
Cosmin Truta82200da2014-03-22 09:29:59 -050042 cp $< $@
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050043
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060044pngtest.o: pngtest.c
45 ${CC} ${CPPFLAGS} ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET}
46
47pngtest: pngtest.o
48 ${CC} ${LDFLAGS} ${.ALLSRC} -o ${.TARGET} -L${.OBJDIR} -lpng -lz -lm
49
50test: pngtest
51 cd ${.OBJDIR} && env \
52 LD_LIBRARY_PATH="${.OBJDIR}" ${.OBJDIR}/pngtest
53
54beforeinstall:
Glenn Randers-Pehrsonfcbd7872002-04-07 16:35:38 -050055 if [ ! -d ${DESTDIR}${PREFIX}/include/libpng ]; then \
Glenn Randers-Pehrson316152f2009-12-04 08:42:32 -060056 ${INSTALL} -d -o root -g wheel ${DESTDIR}${PREFIX}/include; \
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060057 fi
58 if [ ! -d ${DESTDIR}${LIBDIR} ]; then \
59 ${INSTALL} -d -o root -g wheel ${DESTDIR}${LIBDIR}; \
60 fi
61 if [ ! -d ${DESTDIR}${LIBDIR}/debug ]; then \
62 ${INSTALL} -d -o root -g wheel ${DESTDIR}${LIBDIR}/debug; \
63 fi
64 if [ ! -d ${DESTDIR}${MANDIR}3 ]; then \
65 ${INSTALL} -d -o root -g wheel ${DESTDIR}${MANDIR}3; \
66 fi
67 if [ ! -d ${DESTDIR}${MANDIR}5 ]; then \
68 ${INSTALL} -d -o root -g wheel ${DESTDIR}${MANDIR}5; \
69 fi
70 if [ ! -d ${DESTDIR}${PREFIX}/share/doc/png ]; then \
71 ${INSTALL} -d -o root -g wheel ${DESTDIR}${PREFIX}/share/doc/png; \
72 fi
73
74afterinstall:
75 @rm -f ${DESTDIR}${LIBDIR}/libpng_pic.a
76 @rm -f ${DESTDIR}${LIBDIR}/debug/libpng.a
Glenn Randers-Pehrsonfcbd7872002-04-07 16:35:38 -050077 @rm -f ${DESTDIR}${PREFIX}/include/png.h
78 @rm -f ${DESTDIR}${PREFIX}/include/pngconf.h
Glenn Randers-Pehrson72531442010-04-17 08:17:51 -050079 @rm -f ${DESTDIR}${PREFIX}/include/pnglibconf.h
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060080 @rmdir ${DESTDIR}${LIBDIR}/debug 2>/dev/null || true
81 ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
Glenn Randers-Pehrson316152f2009-12-04 08:42:32 -060082 -m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060083 ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050084 -m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include
85 ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -060086 -m ${NONBINMODE} ${DOCS} ${DESTDIR}${PREFIX}/share/doc/png
87
88.include <bsd.lib.mk>