1# makefile for libpng using emscripten 2# Copyright (C) 2000, 2014, 2019-2022 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_RC = emar rcs 19RANLIB = emranlib 20CP = cp 21RM_F = rm -f 22 23CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5 24CFLAGS = -O2 -Wall -Wextra -Wundef 25LDFLAGS = -L$(ZLIBLIB) 26PNGTEST_LDFLAGS = --preload-file=pngtest.png 27LIBS = -lz -lm 28 29# Pre-built configuration 30# See scripts/pnglibconf.mak for more options 31PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt 32 33# File lists 34OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \ 35 pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \ 36 pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o 37 38# Targets 39all: static 40 41pnglibconf.h: $(PNGLIBCONF_H_PREBUILT) 42 $(CP) $(PNGLIBCONF_H_PREBUILT) $@ 43 44.c.o: 45 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $< 46 47static: libpng.a pngtest 48 49shared: 50 @echo This makefile cannot create shared libraries. 51 @false 52 53libpng.a: $(OBJS) 54 $(AR_RC) $@ $(OBJS) 55 $(RANLIB) $@ 56 57test: pngtest 58 node ./pngtest 59 60pngtest: pngtest.o libpng.a 61 $(LD) $(LDFLAGS) $(PNGTEST_LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS) 62 63clean: 64 $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h 65 $(RM_F) pngtest.data pngtest.wasm 66 67png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 68pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 69pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 70pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 71pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 72pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 73pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 74pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 75pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 76pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 77pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 78pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 79pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 80pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 81pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h 82 83pngtest.o: png.h pngconf.h pnglibconf.h 84