1# makefile for libpng using MSYS/gcc (shared, static library) 2# Copyright (C) 2000, 2019-2024 Cosmin Truta 3# Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler 4# 5# Portions taken from makefile.linux and makefile.gcc: 6# Copyright (C) 2000 Cosmin Truta 7# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and 8# Glenn Randers-Pehrson 9# Copyright (C) 1996, 1997 Andreas Dilger 10# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. 11# 12# This code is released under the libpng license. 13# For conditions of distribution and use, see the disclaimer 14# and license in png.h 15 16# Library name: 17LIBNAME=libpng16 18PNGMAJ=16 19 20# Shared library names: 21LIBSO=$(LIBNAME).dll 22LIBSOMAJ=$(LIBNAME).dll.$(PNGMAJ) 23 24# Where the zlib library and include files are located. 25#ZLIBLIB=../zlib 26#ZLIBINC=../zlib 27ZLIBLIB=/usr/local/lib 28ZLIBINC=/usr/local/include 29 30# Compiler, linker, lib and other tools 31CC = gcc 32LD = $(CC) 33AR = ar 34RANLIB = ranlib 35CP = cp 36RM_F = rm -rf 37LN_SF = ln -sf 38 39CPPFLAGS = # -DPNG_DEBUG=5 40CFLAGS = -O2 -Wall -Wextra -Wundef # -g 41ARFLAGS = rc 42LDFLAGS = # -g 43LIBS = -lz -lm 44 45# File extensions 46EXEEXT = .exe 47 48# Pre-built configuration 49# See scripts/pnglibconf.mak for more options 50PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt 51 52# File lists 53OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ 54 pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \ 55 pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o 56 57# Targets 58all: static shared 59 60pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) 61 $(CP) $(PNGLIBCONF_H_PREBUILT) $@ 62 63.c.o: 64 $(CC) -c $(CPPFLAGS) $(CFLAGS) $< 65 66static: libpng.a pngtest$(EXEEXT) 67 68shared: $(LIBSOMAJ) 69 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSO) 70 71$(LIBSO): $(LIBSOMAJ) 72 $(LN_SF) $(LIBSOMAJ) $(LIBSO) 73 74$(LIBSOMAJ): 75 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ) 76 77libpng.a: $(OBJS) 78 $(AR) $(ARFLAGS) $@ $(OBJS) 79 $(RANLIB) $@ 80 81install: 82 @echo "The $@ target is no longer supported by this makefile." 83 @false 84 85install-static: 86 @echo "The $@ target is no longer supported by this makefile." 87 @false 88 89install-shared: 90 @echo "The $@ target is no longer supported by this makefile." 91 @false 92 93test: pngtest$(EXEEXT) 94 ./pngtest$(EXEEXT) 95 96pngtest$(EXEEXT): pngtest.o libpng.a 97 $(LD) $(LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS) 98 99clean: 100 $(RM_F) $(OBJS) libpng.a 101 $(RM_F) $(LIBSO) $(LIBSOMAJ) pnglibconf.h 102 $(RM_F) pngtest*.o pngtest$(EXEEXT) pngout.png 103 104png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 105pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 106pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 107pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 108pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 109pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 110pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 111pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 112pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 113pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 114pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 115pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 116pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 117pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 118pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 119 120pngtest.o: png.h pngconf.h pnglibconf.h 121