1# makefile for libpng using gcc (generic, static library) 2# Copyright (C) 2000, 2014, 2019-2022 Cosmin Truta 3# Copyright (C) 2008, 2014 Glenn Randers-Pehrson 4# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. 5# 6# This code is released under the libpng license. 7# For conditions of distribution and use, see the disclaimer 8# and license in png.h 9 10# Location of the zlib library and include files 11ZLIBINC = ../zlib 12ZLIBLIB = ../zlib 13 14# Compiler, linker, lib and other tools 15CC = gcc 16LD = $(CC) 17AR_RC = ar rcs 18RANLIB = ranlib 19CP = cp 20RM_F = rm -f 21 22# Compiler and linker flags 23NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \ 24 -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0 25WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \ 26 -Wmissing-declarations -Wtraditional -Wcast-align \ 27 -Wstrict-prototypes -Wmissing-prototypes # -Wconversion 28DEFS = $(NOHWOPT) 29CPPFLAGS = -I$(ZLIBINC) $(DEFS) # -DPNG_DEBUG=5 30CFLAGS = -O2 -Wall -Wextra -Wundef # $(WARNMORE) -g 31LDFLAGS = -L$(ZLIBLIB) # -g 32LIBS = -lz -lm 33 34# File extensions 35EXEEXT = 36 37# Pre-built configuration 38# See scripts/pnglibconf.mak for more options 39PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt 40 41# File lists 42OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ 43 pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \ 44 pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o 45 46# Targets 47all: static 48 49pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) 50 $(CP) $(PNGLIBCONF_H_PREBUILT) $@ 51 52.c.o: 53 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< 54 55static: libpng.a pngtest$(EXEEXT) 56 57shared: 58 @echo This is a generic makefile that cannot create shared libraries. 59 @echo Please use a configuration that is specific to your platform. 60 @false 61 62libpng.a: $(OBJS) 63 $(AR_RC) $@ $(OBJS) 64 $(RANLIB) $@ 65 66test: pngtest$(EXEEXT) 67 ./pngtest$(EXEEXT) 68 69pngtest$(EXEEXT): pngtest.o libpng.a 70 $(LD) $(LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS) 71 72clean: 73 $(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h 74 75png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 76pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 77pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 78pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 79pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 80pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 81pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 82pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 83pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 84pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 85pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 86pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 87pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 88pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 89pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 90 91pngtest.o: png.h pngconf.h pnglibconf.h 92