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