1 # makefile for libpng using gcc (generic, static library)
2 # Copyright (C) 2002, 2006-2009, 2014 Glenn Randers-Pehrson
3 # Copyright (C) 2000 Cosmin Truta
4 # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
5 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
7 # This code is released under the libpng license.
8 # For conditions of distribution and use, see the disclaimer
11 # Location of the zlib library and include files
15 # Compiler, linker, lib and other tools
28 INCPATH=$(prefix)/include
31 # override DESTDIR= on the make install command line to easily support
32 # installing into a temporary location. Example:
34 # make install DESTDIR=/tmp/build/libpng
36 # If you're going to install into a temporary location
37 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
38 # you execute make install.
41 DI=$(DESTDIR)$(INCPATH)
42 DL=$(DESTDIR)$(LIBPATH)
45 CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
46 CFLAGS = -W -Wall -O2 # $(WARNMORE) -g
47 LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm
50 OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
51 pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
52 pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
56 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
58 all: $(LIBNAME).a pngtest$(E)
60 include scripts/pnglibconf.mak
62 DFNFLAGS = $(DEFS) $(CPPFLAGS)
71 pngtest$(E): pngtest.o $(LIBNAME).a
72 $(LD) -o $@ pngtest.o $(LDFLAGS)
75 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
76 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
77 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
78 -@$(RM_F) $(DI)/$(LIBNAME)/png.h
79 -@$(RM_F) $(DI)/$(LIBNAME)/pngconf.h
80 -@$(RM_F) $(DI)/$(LIBNAME)/pnglibconf.h
82 -@$(RM_F) $(DI)/pngconf.h
83 -@$(RM_F) $(DI)/pnglibconf.h
84 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
85 chmod 644 $(DI)/$(LIBNAME)/png.h \
86 $(DI)/$(LIBNAME)/pngconf.h \
87 $(DI)/$(LIBNAME)/pnglibconf.h
88 -@$(RM_F) -r $(DI)/libpng
89 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
90 -@$(RM_F) $(DL)/$(LIBNAME).a
91 -@$(RM_F) $(DL)/libpng.a
92 cp $(LIBNAME).a $(DL)/$(LIBNAME).a
93 chmod 644 $(DL)/$(LIBNAME).a
94 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
95 (cd $(DI); $(LN_SF) libpng/* .;)
98 $(RM_F) *.o $(LIBNAME).a pngtest pngout.png pnglibconf.h
100 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
101 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
102 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
103 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
104 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
106 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
107 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
108 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
109 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
110 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
111 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
112 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
113 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
114 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
116 pngtest.o: png.h pngconf.h pnglibconf.h