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