1 | # makefile for libpng
|
---|
2 | # Copyright (C) 2020-2024 Cosmin Truta
|
---|
3 | # Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson
|
---|
4 | # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
---|
5 | #
|
---|
6 | # This code is released under the libpng license.
|
---|
7 | # For conditions of distribution and use, see the disclaimer
|
---|
8 | # and license in png.h
|
---|
9 |
|
---|
10 | # Where the zlib library and include files are located
|
---|
11 | #ZLIBLIB=/usr/local/lib
|
---|
12 | #ZLIBINC=/usr/local/include
|
---|
13 | ZLIBLIB=../zlib
|
---|
14 | ZLIBINC=../zlib
|
---|
15 |
|
---|
16 | CC = cc
|
---|
17 | CPP = $(CC) -E
|
---|
18 | LD = $(CC)
|
---|
19 | AR = ar
|
---|
20 | RANLIB = ranlib
|
---|
21 | MV_F = mv -f
|
---|
22 | RM_F = rm -f
|
---|
23 | AWK = awk
|
---|
24 |
|
---|
25 | NOHWOPT = -DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
|
---|
26 | -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
|
---|
27 | DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build
|
---|
28 | DFA_EXTRA = # extra files that can be used to control configuration
|
---|
29 | CPPFLAGS = -I$(ZLIBINC) $(NOHWOPT) # -DPNG_DEBUG=5
|
---|
30 | CFLAGS = -O # -g
|
---|
31 | ARFLAGS = rc
|
---|
32 | LDFLAGS = -L$(ZLIBLIB) # -g
|
---|
33 | LIBS = -lz -lm
|
---|
34 |
|
---|
35 | # Pre-built configuration
|
---|
36 | # See scripts/pnglibconf.mak for more options
|
---|
37 | PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
---|
38 |
|
---|
39 | OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
|
---|
40 | pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
|
---|
41 | pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
|
---|
42 |
|
---|
43 | .c.o:
|
---|
44 | $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
---|
45 |
|
---|
46 | all: libpng.a pngtest
|
---|
47 |
|
---|
48 | # The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
|
---|
49 | # copy this if the following doesn't work.
|
---|
50 | pnglibconf.h: pnglibconf.dfn
|
---|
51 | $(RM_F) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp
|
---|
52 | echo '#include "pnglibconf.dfn"' >pnglibconf.c
|
---|
53 | @echo "## If '$(CC) -E' fails, try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
|
---|
54 | $(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out
|
---|
55 | $(AWK) -f scripts/dfn.awk out=pnglibconf.tmp pnglibconf.out >&2
|
---|
56 | $(MV_F) pnglibconf.tmp $@
|
---|
57 |
|
---|
58 | pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
|
---|
59 | $(RM_F) $@ pnglibconf.pre pnglibconf.tmp
|
---|
60 | @echo "## Calling $(AWK) from scripts/pnglibconf.mak" >&2
|
---|
61 | @echo "## If 'awk' fails, try a better awk (e.g. AWK='nawk')" >&2
|
---|
62 | $(AWK) -f scripts/options.awk out=pnglibconf.pre\
|
---|
63 | version=search pngconf.h scripts/pnglibconf.dfa\
|
---|
64 | pngusr.dfa $(DFA_XTRA) >&2
|
---|
65 | $(AWK) -f scripts/options.awk out=pnglibconf.tmp pnglibconf.pre >&2
|
---|
66 | $(MV_F) pnglibconf.tmp $@
|
---|
67 |
|
---|
68 | libpng.a: $(OBJS)
|
---|
69 | $(AR) $(ARFLAGS) $@ $(OBJS)
|
---|
70 | $(RANLIB) $@
|
---|
71 |
|
---|
72 | pngtest: pngtest.o libpng.a
|
---|
73 | $(LD) $(LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS)
|
---|
74 |
|
---|
75 | test: pngtest
|
---|
76 | ./pngtest
|
---|
77 |
|
---|
78 | install:
|
---|
79 | @echo "The $@ target is no longer supported by this makefile."
|
---|
80 | @false
|
---|
81 |
|
---|
82 | clean:
|
---|
83 | $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h
|
---|
84 | $(RM_F) pnglibconf.c pnglibconf.dfn pnglibconf.out pnglibconf.pre
|
---|
85 |
|
---|
86 | # DO NOT DELETE THIS LINE -- make depend depends on it.
|
---|
87 |
|
---|
88 | png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
89 | pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
90 | pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
91 | pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
92 | pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
93 | pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
94 | pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
95 | pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
96 | pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
97 | pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
98 | pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
99 | pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
100 | pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
101 | pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
102 | pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
103 |
|
---|
104 | pngtest.o: png.h pngconf.h pnglibconf.h
|
---|