• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# makefile for libpng
2# Copyright (C) 2002, 2006, 2009, 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# This makefile requires the file ansi2knr.c, which you can get
10# from the Ghostscript ftp site at ftp://ftp.cs.wisc.edu/ghost/
11# If you have libjpeg, you probably already have ansi2knr.c in the jpeg
12# source distribution.
13
14# where make install puts libpng.a and png.h
15prefix=/usr/local
16INCPATH=$(prefix)/include
17LIBPATH=$(prefix)/lib
18
19# override DESTDIR= on the make install command line to easily support
20# installing into a temporary location.  Example:
21#
22#    make install DESTDIR=/tmp/build/libpng
23#
24# If you're going to install into a temporary location
25# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
26# you execute make install.
27DESTDIR=
28
29CC = cc
30CPPFLAGS = -I../zlib
31CFLAGS = -O
32LDFLAGS = -L. -L../zlib/ -lpng -lz -lm
33# flags for ansi2knr
34ANSI2KNRFLAGS=
35
36RANLIB = ranlib
37#RANLIB = echo
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
43all: ansi2knr libpng.a pngtest
44
45# see scripts/pnglibconf.mak for more options
46pnglibconf.h: scripts/pnglibconf.h.prebuilt
47	cp scripts/pnglibconf.h.prebuilt $@
48
49# general rule to allow ansi2knr to work
50.c.o:
51	./ansi2knr $*.c T$*.c
52	$(CC) $(CPPFLAGS) $(CFLAGS) -c T$*.c
53	rm -f T$*.c $*.o
54	mv T$*.o $*.o
55
56ansi2knr: ansi2knr.c
57	$(CC) $(CPPFLAGS) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
58
59libpng.a: ansi2knr $(OBJS)
60	ar rc $@  $(OBJS)
61	$(RANLIB) $@
62
63pngtest: pngtest.o libpng.a
64	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
65
66test: pngtest
67	./pngtest
68
69install: libpng.a png.h pngconf.h pnglibconf.h
70	-@mkdir $(DESTDIR)$(INCPATH)
71	-@mkdir $(DESTDIR)$(INCPATH)/libpng
72	-@mkdir $(DESTDIR)$(LIBPATH)
73	-@rm -f $(DESTDIR)$(INCPATH)/png.h
74	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
75	cp png.h $(DESTDIR)$(INCPATH)/libpng
76	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
77	cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
78	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
79	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
80	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
81	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
82	cp libpng.a $(DESTDIR)$(LIBPATH)
83	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
84
85clean:
86	rm -f *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h
87
88DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
89writelock:
90	chmod a-w *.[ch35] $(DOCS) scripts/*
91
92# DO NOT DELETE THIS LINE -- make depend depends on it.
93
94png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
95pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
96pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
97pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
98pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
99pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
100pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
101pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
102pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
103pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
104pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
106pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
107pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
108pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
109
110pngtest.o: png.h pngconf.h pnglibconf.h
111