• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# makefile for libpng using clang + 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
11ZLIBINC = ../zlib
12ZLIBLIB = ../zlib
13
14# Compiler, linker, lib and other tools
15CC = clang
16LD = $(CC)
17AR_RC = ar rcs
18RANLIB = ranlib
19CP = cp
20RM_F = rm -f
21
22WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \
23	-Wmissing-declarations -Wtraditional -Wcast-align \
24	-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
25CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
26CFLAGS = -W -Wall -O0 -g -fsanitize=address
27LDFLAGS = -L$(ZLIBLIB) -g -fsanitize=address
28LIBS = -lz -lm
29
30# File extensions
31EXEEXT =
32
33# Pre-built configuration
34# See scripts/pnglibconf.mak for more options
35PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
36
37# Variables
38OBJS =  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
43all: static
44
45pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
46	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
47
48.c.o:
49	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
50
51static: libpng.a pngtest$(EXEEXT)
52
53shared:
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
58libpng.a: $(OBJS)
59	$(AR_RC) $@ $(OBJS)
60	$(RANLIB) $@
61
62test: pngtest$(EXEEXT)
63	./pngtest$(EXEEXT)
64
65pngtest$(EXEEXT): pngtest.o libpng.a
66	$(LD) $(LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS)
67
68clean:
69	$(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h
70
71png.o:      png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
72pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
73pngget.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
74pngmem.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
75pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
76pngread.o:  png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
77pngrio.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
78pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
79pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
80pngset.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
81pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
82pngwio.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
83pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
84pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
85pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
86
87pngtest.o:  png.h pngconf.h pnglibconf.h
88