blob: e2878233c2e83b9478fa8b51c45a47af3eb4c321 [file] [log] [blame]
# makefile for libpng using MSYS/gcc (shared, static library)
# Copyright (C) 2019-2022 Cosmin Truta
# Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler
#
# Portions taken from makefile.linux and makefile.gcc:
# Copyright (C) 2000 Cosmin Truta
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
# Glenn Randers-Pehrson
# Copyright (C) 1996, 1997 Andreas Dilger
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name:
LIBNAME=libpng16
PNGMAJ=16
# Shared library names:
LIBSO=$(LIBNAME).dll
LIBSOMAJ=$(LIBNAME).dll.$(PNGMAJ)
# Where the zlib library and include files are located.
#ZLIBLIB=../zlib
#ZLIBINC=../zlib
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
# Compiler, linker, lib and other tools
CC = gcc
LD = $(CC)
AR_RC = ar rcs
RANLIB = ranlib
CP = cp
RM_F = rm -rf
MKDIR_P=mkdir -p
LN_SF=ln -sf
CPPFLAGS = # -DPNG_DEBUG=5
CFLAGS = -O2 -Wall -Wextra -Wundef # -g
LDFLAGS = # -g
LIBS = -lz -lm
# File extensions
EXEEXT=.exe
# Pre-built configuration
# See scripts/pnglibconf.mak for more options
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
# File lists
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
# Targets
all: static shared
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
static: libpng.a pngtest$(EXEEXT)
shared: $(LIBSOMAJ)
$(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSO)
$(LIBSO): $(LIBSOMAJ)
$(LN_SF) $(LIBSOMAJ) $(LIBSO)
$(LIBSOMAJ):
$(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ)
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)
$(RANLIB) $@
install:
@echo "The $@ target is no longer supported by this makefile."
@false
install-static:
@echo "The $@ target is no longer supported by this makefile."
@false
install-shared:
@echo "The $@ target is no longer supported by this makefile."
@false
test: pngtest$(EXEEXT)
./pngtest$(EXEEXT)
pngtest$(EXEEXT): pngtest.o libpng.a
$(LD) $(LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS)
clean:
$(RM_F) $(OBJS) libpng.a
$(RM_F) $(LIBSO) $(LIBSOMAJ) pnglibconf.h
$(RM_F) pngtest*.o pngtest$(EXEEXT) pngout.png
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h