1 # makefile for libpng using MSYS/gcc (shared, static library)
2 # Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler
4 # Portions taken from makefile.linux:
5 # Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
6 # Glenn Randers-Pehrson
7 # Copyright (C) 2000 Cosmin Truta
8 # Copyright (C) 1996, 1997 Andreas Dilger
9 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
11 # This code is released under the libpng license.
12 # For conditions of distribution and use, see the disclaimer
13 # and license in png.h
14 # # # # # # # # # # # # # # # # #
23 # Shared library names:
25 LIBSOMAJ=$(LIBNAME).dll.$(PNGMAJ)
26 LIBSOREL=$(PNGMAJ).$(RELEASE)
29 # Where the zlib library and include files are located.
32 ZLIBLIB=/usr/local/lib
33 ZLIBINC=/usr/local/include
35 # Compiler, linker, lib and other tools
44 #ARCH = -march=pentium3
47 CPPFLAGS = # -DPNG_DEBUG=5
48 CFLAGS = -W -Wall -O2 $(ARCH) # -g
55 INCPATH=$(prefix)/include
56 LIBPATH=$(exec_prefix)/lib
58 BINPATH=$(exec_prefix)/bin
60 # override DESTDIR= on the make install command line to easily support
61 # installing into a temporary location. Example:
63 # make install DESTDIR=/tmp/build/libpng
65 # If you're going to install into a temporary location
66 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
67 # you execute make install.
71 DB=$(DESTDIR)$(BINPATH)
72 DI=$(DESTDIR)$(INCPATH)
73 DL=$(DESTDIR)$(LIBPATH)
74 DM=$(DESTDIR)$(MANPATH)
77 OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
78 pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
79 pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
84 # see scripts/pnglibconf.mak for more options
85 pnglibconf.h: scripts/pnglibconf.h.prebuilt
86 cp scripts/pnglibconf.h.prebuilt $@
89 $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
91 static: libpng.a pngtest$(EXEEXT)
94 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSO)
97 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
100 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ)
106 install-headers: png.h pngconf.h pnglibconf.h
107 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
108 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
109 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
110 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
111 -@$(RM_F) $(DI)/libpng
112 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
114 install-static: install-headers libpng.a
115 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
116 cp libpng.a $(DL)/$(LIBNAME).a
117 -@$(RM_F) $(DL)/libpng.a
118 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
121 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
122 -e s!@exec_prefix@!$(exec_prefix)! \
123 -e s!@libdir@!$(LIBPATH)! \
124 -e s!@includedir@!$(INCPATH)! \
125 -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
128 ( cat scripts/libpng-config-head.in; \
129 echo prefix=\"$(prefix)\"; \
130 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
131 echo L_opts=\"-L$(LIBPATH)\"; \
132 echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
133 echo libs=\"-lpng16 -lz -lm\"; \
134 cat scripts/libpng-config-body.in ) > libpng-config
136 install-shared: install-headers $(LIBSOMAJ) libpng.pc
137 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
138 -@$(RM_F) $(DL)/$(LIBSO)
139 -@$(RM_F) $(DL)/$(OLDSO)
140 cp $(LIBSO) $(DL)/$(LIBSOREL)
142 $(LN_SF) $(LIBSOREL) $(LIBSO); \
143 $(LN_SF) $(LIBSO) $(OLDSO))
145 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
146 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
147 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
148 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
149 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
151 install-man: libpng.3 libpngpf.3 png.5
152 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
153 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
154 -@$(RM_F) $(DM)/man3/libpng.3
155 -@$(RM_F) $(DM)/man3/libpngpf.3
156 cp libpng.3 $(DM)/man3
157 cp libpngpf.3 $(DM)/man3
158 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
159 -@$(RM_F) $(DM)/man5/png.5
162 install-config: libpng-config
163 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
164 -@$(RM_F) $(DB)/libpng-config
165 -@$(RM_F) $(DB)/$(LIBNAME)-config
166 cp libpng-config $(DB)/$(LIBNAME)-config
167 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
169 install: install-static install-shared install-man install-config
171 test: pngtest$(EXEEXT)
174 pngtest$(EXEEXT): pngtest.o libpng.a
175 $(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest.o libpng.a $(LIBS)
178 $(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h $(LIBSO) \
179 $(LIBSOMAJ) libpng-config
181 png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
182 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
183 pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
184 pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
185 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
186 pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
187 pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
188 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
189 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
190 pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
191 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
192 pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
193 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
194 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
195 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
197 pngtest.o: png.h pngconf.h pnglibconf.h