1 | # makefile for libpng using gcc + address sanitizer (generic, static library)
|
---|
2 | # Copyright (C) 2008, 2014 Glenn Randers-Pehrson
|
---|
3 | # Copyright (C) 2000, 2014, 2019 Cosmin Truta
|
---|
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 | # Location of the zlib library and include files
|
---|
11 | ZLIBINC = ../zlib
|
---|
12 | ZLIBLIB = ../zlib
|
---|
13 |
|
---|
14 | # Compiler, linker, lib and other tools
|
---|
15 | CC = gcc
|
---|
16 | LD = $(CC)
|
---|
17 | AR_RC = ar rcs
|
---|
18 | RANLIB = ranlib
|
---|
19 | CP = cp
|
---|
20 | RM_F = rm -f
|
---|
21 |
|
---|
22 | WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \
|
---|
23 | -Wmissing-declarations -Wtraditional -Wcast-align \
|
---|
24 | -Wstrict-prototypes -Wmissing-prototypes # -Wconversion
|
---|
25 | CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
|
---|
26 | CFLAGS = -W -Wall -O0 -g -fsanitize=address
|
---|
27 | LDFLAGS = -L$(ZLIBLIB) -g -fsanitize=address
|
---|
28 | LIBS = -lz -lm
|
---|
29 |
|
---|
30 | # File extensions
|
---|
31 | EXEEXT =
|
---|
32 |
|
---|
33 | # Pre-built configuration
|
---|
34 | # See scripts/pnglibconf.mak for more options
|
---|
35 | PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
---|
36 |
|
---|
37 | # Variables
|
---|
38 | OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
|
---|
39 | pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
|
---|
40 | pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
|
---|
41 |
|
---|
42 | # Targets
|
---|
43 | all: static
|
---|
44 |
|
---|
45 | pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
---|
46 | $(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
---|
47 |
|
---|
48 | .c.o:
|
---|
49 | $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
---|
50 |
|
---|
51 | static: libpng.a pngtest$(EXEEXT)
|
---|
52 |
|
---|
53 | shared:
|
---|
54 | @echo This is a generic makefile that cannot create shared libraries.
|
---|
55 | @echo Please use a configuration that is specific to your platform.
|
---|
56 | @false
|
---|
57 |
|
---|
58 | libpng.a: $(OBJS)
|
---|
59 | $(AR_RC) $@ $(OBJS)
|
---|
60 | $(RANLIB) $@
|
---|
61 |
|
---|
62 | test: pngtest$(EXEEXT)
|
---|
63 | ./pngtest$(EXEEXT)
|
---|
64 |
|
---|
65 | pngtest$(EXEEXT): pngtest.o libpng.a
|
---|
66 | $(LD) $(LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS)
|
---|
67 |
|
---|
68 | clean:
|
---|
69 | $(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h
|
---|
70 |
|
---|
71 | png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
72 | pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
73 | pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
74 | pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
75 | pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
76 | pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
77 | pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
78 | pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
79 | pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
80 | pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
81 | pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
82 | pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
83 | pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
84 | pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
85 | pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
---|
86 |
|
---|
87 | pngtest.o: png.h pngconf.h pnglibconf.h
|
---|