1 # makefile for libpng.a and libpng16.so on Linux ELF with gcc
2 # Copyright (C) 2020-2022 Cosmin Truta
3 # Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
4 # Glenn Randers-Pehrson
5 # Copyright (C) 1996, 1997 Andreas Dilger
7 # This code is released under the libpng license.
8 # For conditions of distribution and use, see the disclaimer
15 # Shared library names:
17 LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
28 # Where the zlib library and include files are located.
29 #ZLIBLIB=/usr/local/lib
30 #ZLIBINC=/usr/local/include
34 # Compiler and linker flags
35 NOHWOPT=-DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
36 -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
37 WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
38 -Wmissing-declarations -Wtraditional -Wcast-align \
39 -Wstrict-prototypes -Wmissing-prototypes # -Wconversion
41 CPPFLAGS=-I$(ZLIBINC) $(DEFS) # -DPNG_DEBUG=5
42 CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef # $(WARNMORE) -g
43 LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm # -g
44 LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm # -g
46 # Pre-built configuration
47 # See scripts/pnglibconf.mak for more options
48 PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
51 OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
52 pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
53 pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
55 OBJSDLL = $(OBJS:.o=.pic.o)
57 .SUFFIXES: .c .o .pic.o
60 $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
63 $(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c
65 all: libpng.a $(LIBSO) pngtest pngtest-static
67 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
68 $(CP) $(PNGLIBCONF_H_PREBUILT) $@
75 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
77 $(LIBSOMAJ): $(OBJSDLL)
78 $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
80 pngtest: pngtest.o $(LIBSO)
81 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
83 pngtest-static: pngtest.o libpng.a
84 $(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
86 test: pngtest pngtest-static
88 @echo " Running pngtest dynamically linked with $(LIBSO):"
92 @echo " Running pngtest statically linked with libpng.a:"
97 @echo "The $@ target is no longer supported by this makefile."
101 @echo "The $@ target is no longer supported by this makefile."
105 @echo "The $@ target is no longer supported by this makefile."
109 $(RM_F) $(OBJS) $(OBJSDLL) libpng.a
110 $(RM_F) $(LIBSO) $(LIBSOMAJ)* pnglibconf.h
111 $(RM_F) pngtest*.o pngtest pngtest-static pngout.png
113 # DO NOT DELETE THIS LINE -- make depend depends on it.
115 png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
116 pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
117 pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
118 pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
119 pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
120 pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
121 pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
122 pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
123 pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
124 pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
125 pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
126 pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
127 pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
128 pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
129 pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
131 pngtest.o: png.h pngconf.h pnglibconf.h