1# makefile for libpng
2# Copyright (C) 2002, 2014 Glenn Randers-Pehrson
3# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
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#
9# Modified for LC56/ATARI assumes libz.lib is in same dir and uses default
10# rules for library management
11#
12CPPFLAGS = -I..\zlib
13CFLAGS = -O
14LBR = png.lib
15LDFLAGS = -L. -L..\zlib -lpng -lz -lm
16
17# where make install puts libpng.a and png.h
18prefix=/usr/local
19INCPATH=$(prefix)/include
20LIBPATH=$(prefix)/lib
21
22# override DESTDIR= on the make install command line to easily support
23# installing into a temporary location.  Example:
24#
25#    make install DESTDIR=/tmp/build/libpng
26#
27# If you're going to install into a temporary location
28# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
29# you execute make install.
30DESTDIR=
31
32# Pre-built configuration
33# See scripts/pnglibconf.mak for more options
34PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
35
36OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
37	$(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\
38	$(LBR)(pngread.o) $(LBR)(pngerror.o) $(LBR)(pngwrite.o)\
39	$(LBR)(pngrtran.o) $(LBR)(pngwtran.o)\
40	$(LBR)(pngmem.o) $(LBR)(pngrio.o) $(LBR)(pngwio.o) $(LBR)(pngpread.o)
41
42all: $(LBR) pngtest.ttp
43
44.c.o:
45	$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
46
47$(LBR): $(OBJS)
48
49$(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
50
51pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
52	cp $(PNGLIBCONF_H_PREBUILT) $@
53
54pngtest.ttp: pngtest.o $(LBR)
55	$(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o
56
57install: libpng.a
58	-@mkdir $(DESTDIR)$(INCPATH)
59	-@mkdir $(DESTDIR)$(INCPATH)/libpng
60	-@mkdir $(DESTDIR)$(LIBPATH)
61	-@rm -f $(DESTDIR)$(INCPATH)/png.h
62	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
63	-@rm -f $(DESTDIR)$(INCPATH)/pnglibconf.h
64	cp png.h $(DESTDIR)$(INCPATH)/libpng
65	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
66	cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
67	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
68	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
69	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
70	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
71	ln -f -s $(LIBNAME)/* .)
72