1# makefile for libpng under FreeBSD
2# Copyright (C) 2014 Glenn Randers-Pehrson and Andrey A. Chernov
3# Copyright (C) 2002, 2007, 2009 Glenn Randers-Pehrson and Andrey A. Chernov
4#
5# This code is released under the libpng license.
6# For conditions of distribution and use, see the disclaimer
7# and license in png.h
8
9PREFIX?=        /usr/local
10SHLIB_VER?=     16
11
12LIB=		png
13SHLIB_MAJOR=	${SHLIB_VER}
14SHLIB_MINOR=	0
15NO_PROFILE=	YES
16NO_OBJ=		YES
17
18# where make install puts libpng.a and png.h
19DESTDIR=	${PREFIX}
20LIBDIR=		/lib
21INCS=		png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
22INCSDIR=	/include/libpng
23INCDIR=		${INCSDIR}		# for 4.x bsd.lib.mk
24MAN=		libpng.3 libpngpf.3 png.5
25MANDIR=		/man/man
26SYMLINKS=       libpng/png.h ${INCSDIR}/../png.h \
27		libpng/pngconf.h ${INCSDIR}/../pngconf.h \
28		libpng/pnglibconf.h ${INCSDIR}/../pnglibconf.h
29
30# where make install finds libz.a and zlib.h
31ZLIBLIB=	/usr/lib
32ZLIBINC=	/usr/include
33
34LDADD+=		-lm -lz
35#LDADD+=	-lm -lz -lssp_nonshared   # for OSVERSION < 800000 ?
36
37DPADD+=		${LIBM} ${LIBZ}
38
39CPPFLAGS+=	-I. -I${ZLIBINC}
40CFLAGS+=	-W -Wall
41
42# Pre-built configuration
43# See scripts/pnglibconf.mak for more options
44PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt
45
46SRCS=	png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
47	pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
48	pngwtran.c pngmem.c pngerror.c pngpread.c
49
50.c.o:
51	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
52
53pngtest: pngtest.o libpng.a
54	${CC} ${CFLAGS} -L. -static -o pngtest pngtest.o -L${ZLIBLIB} \
55	-lpng ${LDADD}
56
57CLEANFILES= pngtest pngtest.o pngout.png
58
59test: pngtest
60	./pngtest
61
62pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
63	cp $(PNGLIBCONF_H_PREBUILT) $@
64
65DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO
66writelock:
67	chmod a-w *.[ch35] $(DOCS) scripts/*
68
69.include <bsd.lib.mk>
70