1# makefile for libpng
2# Copyright (C) 1998-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# where make install puts libpng.a and png.h
10prefix=/usr/local
11INCPATH=$(prefix)/include
12LIBPATH=$(prefix)/lib
13
14# override DESTDIR= on the make install command line to easily support
15# installing into a temporary location.  Example:
16#
17#    make install DESTDIR=/tmp/build/libpng
18#
19# If you're going to install into a temporary location
20# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
21# you execute make install.
22DESTDIR=
23
24CC=cc
25CPPFLAGS=-I../zlib -DSYSV -Dmips
26CFLAGS=-O -systype sysv -w
27#CFLAGS=-O
28LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
29
30#RANLIB=ranlib
31RANLIB=echo
32
33CP=cp
34
35# Pre-built configuration
36# See scripts/pnglibconf.mak for more options
37PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
38
39OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
40	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
41	pngwtran.o pngmem.o pngerror.o pngpread.o
42
43.c.o:
44	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
45
46all: libpng.a pngtest
47
48pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
49	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
50
51libpng.a: $(OBJS)
52	ar rc $@  $(OBJS)
53	$(RANLIB) $@
54
55pngtest: pngtest.o libpng.a
56	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
57
58test: pngtest
59	./pngtest
60
61install: libpng.a
62	-@mkdir $(DESTDIR)$(INCPATH)
63	-@mkdir $(DESTDIR)$(INCPATH)/libpng
64	-@mkdir $(DESTDIR)$(LIBPATH)
65	-@rm -f $(DESTDIR)$(INCPATH)/png.h
66	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
67	-@rm -f $(DESTDIR)$(INCPATH)/pnglibconf.h
68	cp png.h $(DESTDIR)$(INCPATH)/libpng
69	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
70	cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
71	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
72	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
73	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
74	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
75	cp libpng.a $(DESTDIR)$(LIBPATH)
76	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
77
78clean:
79	rm -f *.o libpng.a pngtest pngout.png pnglibconf.h
80
81DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO
82writelock:
83	chmod a-w *.[ch35] $(DOCS) scripts/*
84
85# DO NOT DELETE THIS LINE -- make depend depends on it.
86
87png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
88pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
89pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
90pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
91pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
92pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
93pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
94pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
95pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
96pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
97pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
98pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
99pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
100pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
101pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
102
103pngtest.o: png.h pngconf.h pnglibconf.h
104