• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# makefile for libpng
2# Copyright (C) 2002, 2006, 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
24# Where the zlib library and include files are located
25#ZLIBLIB=/usr/local/lib
26#ZLIBINC=/usr/local/include
27ZLIBLIB=../zlib
28ZLIBINC=../zlib
29
30
31WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow -Wconversion \
32	-Wmissing-declarations -Wtraditional -Wcast-align \
33	-Wstrict-prototypes -Wmissing-prototypes
34
35CC=gcc
36AR_RC=ar rc
37MKDIR_P=mkdir -p
38LN_SF=ln -f -s
39RANLIB=ranlib
40RM_F=/bin/rm -f
41
42CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
43CFLAGS=-O # $(WARNMORE)
44LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
45
46OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
47	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
48	pngwtran.o pngmem.o pngerror.o pngpread.o
49
50.c.o:
51	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
52
53all: libpng.a pngtest
54
55# see scripts/pnglibconf.mak for more options
56pnglibconf.h: scripts/pnglibconf.h.prebuilt
57	cp scripts/pnglibconf.h.prebuilt $@
58
59libpng.a: $(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
70	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)
71	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
72	-@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
73	-@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
74	-@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
75	-@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h
76	cp png.h $(DESTDIR)$(INCPATH)/libpng
77	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
78	cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
79	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
80	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
81	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
82	(cd $(DESTDIR)$(INCPATH); $(LN_SF) libpng/* .)
83	cp libpng.a $(DESTDIR)$(LIBPATH)
84	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
85
86clean:
87	$(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h
88
89DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
90writelock:
91	chmod a-w *.[ch35] $(DOCS) scripts/*
92
93# DO NOT DELETE THIS LINE -- make depend depends on it.
94
95png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
96pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
97pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
98pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
99pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
100pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
101pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
102pngread.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
109pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
110
111pngtest.o: png.h pngconf.h pnglibconf.h
112