mirror of
https://github.com/glennrp/libpng.git
synced 2026-10-24 08:39:18 +03:00
Considering that pnglibconf is a whole mini-system for configuring and building libpng, it should be placed in its own dedicated subdirectory. Any future additions, including tests and documentation, should go into this subdirectory. One exception: pnglibconf.h.prebuilt is moved to the top-level source directory, where pnglibconf.h would be. This follows the organization pattern typically used with the "*.in" files, for example. All references to the pnglibconf artifacts, found in machine-readable code and in human-readable comments, are updated accordingly.
93 lines
3.5 KiB
Plaintext
93 lines
3.5 KiB
Plaintext
# makefile for libpng using emscripten
|
|
# Copyright (C) 2000, 2014, 2019-2025 Cosmin Truta
|
|
# Copyright (C) 2021 Kirk Roerig
|
|
# Copyright (C) 2008, 2014 Glenn Randers-Pehrson
|
|
# 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
|
|
|
|
# Location of the zlib library and include files
|
|
ZLIBINC = ../zlib
|
|
ZLIBLIB = ../zlib
|
|
|
|
# Compiler, linker, lib and other tools
|
|
CC = emcc
|
|
LD = $(CC)
|
|
AR = emar
|
|
RANLIB = emranlib
|
|
CP = cp
|
|
RM_F = rm -f
|
|
|
|
STDC = -pedantic-errors # -std=c99
|
|
WARN = -Wall -Wextra -Wundef
|
|
WARNMORE = -Wcast-align -Wconversion -Wshadow -Wpointer-arith -Wwrite-strings \
|
|
-Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes
|
|
LOCAL_CPPFLAGS =
|
|
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
|
|
ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS)
|
|
LOCAL_CFLAGS = $(STDC) $(WARN) $(WARNMORE)
|
|
CFLAGS = -O2
|
|
ALL_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS)
|
|
ARFLAGS = rc
|
|
LDFLAGS = -L$(ZLIBLIB)
|
|
PNGTEST_LDFLAGS = --preload-file=pngtest.png
|
|
LIBS = -lz -lm
|
|
|
|
# Pre-built configuration
|
|
# See scripts/pnglibconf/pnglibconf.mak for more options
|
|
PNGLIBCONF_H_PREBUILT = 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 pngsimd.o \
|
|
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
|
|
|
|
# Targets
|
|
all: libpng.a pngtest
|
|
|
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
|
|
|
.c.o:
|
|
$(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $*.c
|
|
|
|
libpng.a: $(OBJS)
|
|
$(AR) $(ARFLAGS) $@ $(OBJS)
|
|
$(RANLIB) $@
|
|
|
|
test: pngtest
|
|
node ./pngtest
|
|
|
|
pngtest: pngtest.o libpng.a
|
|
$(LD) $(LDFLAGS) $(PNGTEST_LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS)
|
|
|
|
clean:
|
|
$(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h
|
|
$(RM_F) pngtest.data pngtest.wasm
|
|
|
|
# TODO:
|
|
# Use the compiler to generate dependency files (e.g. "$(CC) -MD") and
|
|
# include those files here, for the benefit of the Make implementations
|
|
# that support the GNU Make syntax extensions.
|
|
|
|
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngsimd.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtarget.h
|
|
|
|
pngtest.o: png.h pngconf.h pnglibconf.h
|