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-2011 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 CDEBUG = -g -DPNG_DEBUG=5
51 #CFLAGS = -W -Wall $(CDEBUG)
52 CFLAGS = -W -Wall $(CRELEASE) $(ARCH)
54 LDFLAGS = $(LDRELEASE)
62 INCPATH=$(prefix)/include
63 LIBPATH=$(exec_prefix)/lib
65 BINPATH=$(exec_prefix)/bin
67 # override DESTDIR= on the make install command line to easily support
68 # installing into a temporary location. Example:
70 # make install DESTDIR=/tmp/build/libpng
72 # If you're going to install into a temporary location
73 # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
74 # you execute make install.
78 DB=$(DESTDIR)$(BINPATH)
79 DI=$(DESTDIR)$(INCPATH)
80 DL=$(DESTDIR)$(LIBPATH)
81 DM=$(DESTDIR)$(MANPATH)
84 OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
85 pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
86 pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
91 # see scripts/pnglibconf.mak for more options
92 pnglibconf.h: scripts/pnglibconf.h.prebuilt
93 cp scripts/pnglibconf.h.prebuilt $@
96 $(CC) -c $(CFLAGS) -I$(ZLIBINC) $<
98 static: libpng$(A) pngtest$(EXE)
101 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSO)
103 $(LIBSO): $(LIBSOMAJ)
104 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
107 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ)
113 install-headers: png.h pngconf.h pnglibconf.h
114 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
115 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
116 cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
117 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
118 -@$(RM_F) $(DI)/libpng
119 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
121 install-static: install-headers libpng.a
122 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
123 cp libpng.a $(DL)/$(LIBNAME).a
124 -@$(RM_F) $(DL)/libpng.a
125 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
128 cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
129 -e s!@exec_prefix@!$(exec_prefix)! \
130 -e s!@libdir@!$(LIBPATH)! \
131 -e s!@includedir@!$(INCPATH)! \
132 -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
135 ( cat scripts/libpng-config-head.in; \
136 echo prefix=\"$(prefix)\"; \
137 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
138 echo L_opts=\"-L$(LIBPATH)\"; \
139 echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
140 echo libs=\"-lpng16 -lz -lm\"; \
141 cat scripts/libpng-config-body.in ) > libpng-config
143 install-shared: install-headers $(LIBSOMAJ) libpng.pc
144 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
145 -@$(RM_F) $(DL)/$(LIBSO)
146 -@$(RM_F) $(DL)/$(OLDSO)
147 cp $(LIBSO) $(DL)/$(LIBSOREL)
149 $(LN_SF) $(LIBSOREL) $(LIBSO); \
150 $(LN_SF) $(LIBSO) $(OLDSO))
152 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
153 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
154 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
155 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
156 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
158 install-man: libpng.3 libpngpf.3 png.5
159 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
160 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
161 -@$(RM_F) $(DM)/man3/libpng.3
162 -@$(RM_F) $(DM)/man3/libpngpf.3
163 cp libpng.3 $(DM)/man3
164 cp libpngpf.3 $(DM)/man3
165 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
166 -@$(RM_F) $(DM)/man5/png.5
169 install-config: libpng-config
170 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
171 -@$(RM_F) $(DB)/libpng-config
172 -@$(RM_F) $(DB)/$(LIBNAME)-config
173 cp libpng-config $(DB)/$(LIBNAME)-config
174 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
176 install: install-static install-shared install-man install-config
181 pngtest$(EXE): pngtest$(O) libpng$(A)
182 $(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest$(O) libpng$(A) $(LIBS)
185 $(RM_F) *$(O) libpng$(A) pngtest$(EXE) pngout.png pnglibconf.h $(LIBSO) \
186 $(LIBSOMAJ) libpng-config
188 png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
189 pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
190 pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
191 pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
192 pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
193 pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
194 pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
195 pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
196 pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
197 pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
198 pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
199 pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
200 pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
201 pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
202 pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
204 pngtest$(O): png.h pngconf.h pnglibconf.h