1# makefile for libpng using emscripten 2# Copyright (C) 2000, 2014, 2019-2024 Cosmin Truta 3# Copyright (C) 2021 Kirk Roerig 4# Copyright (C) 2008, 2014 Glenn Randers-Pehrson 5# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. 6# 7# This code is released under the libpng license. 8# For conditions of distribution and use, see the disclaimer 9# and license in png.h 10 11# Location of the zlib library and include files 12ZLIBINC = ../zlib 13ZLIBLIB = ../zlib 14 15# Compiler, linker, lib and other tools 16CC = emcc 17LD = $(CC) 18AR = emar 19RANLIB = emranlib 20CP = cp 21RM_F = rm -f 22 23CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5 24CFLAGS = -O2 -Wall -Wextra -Wundef 25ARFLAGS = rc 26LDFLAGS = -L$(ZLIBLIB) 27PNGTEST_LDFLAGS = --preload-file=pngtest.png 28LIBS = -lz -lm 29 30# Pre-built configuration 31# See scripts/pnglibconf.mak for more options 32PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt 33 34# File lists 35OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ 36 pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \ 37 pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o 38 39# Targets 40all: static 41 42pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) 43 $(CP) $(PNGLIBCONF_H_PREBUILT) $@ 44 45.c.o: 46 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< 47 48static: libpng.a pngtest 49 50shared: 51 @echo This makefile cannot create shared libraries. 52 @false 53 54libpng.a: $(OBJS) 55 $(AR) $(ARFLAGS) $@ $(OBJS) 56 $(RANLIB) $@ 57 58test: pngtest 59 node ./pngtest 60 61pngtest: pngtest.o libpng.a 62 $(LD) $(LDFLAGS) $(PNGTEST_LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS) 63 64clean: 65 $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h 66 $(RM_F) pngtest.data pngtest.wasm 67 68png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 69pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 70pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 71pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 72pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 73pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 74pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 75pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 76pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 77pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 78pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 79pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 80pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 81pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 82pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 83 84pngtest.o: png.h pngconf.h pnglibconf.h 85