mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 22:28:22 +01:00
acd7b5af0f
It can be used to test if given pair of animated images (GIF and/or WebP) are identical in terms of pixel match and other animation properties. Change-Id: I84adea145e9d062be6ad06a0d4fcdc9658cf52d4
402 lines
12 KiB
Plaintext
402 lines
12 KiB
Plaintext
# This makefile is a simpler alternative to the autoconf-based build
|
|
# system, for simple local building of the libraries and tools.
|
|
# It will not install the libraries system-wide, but just create the 'cwebp'
|
|
# and 'dwebp' tools in the examples/ directory, along with the static
|
|
# libraries 'src/libwebp.a', 'src/libwebpdecoder.a', 'src/mux/libwebpmux.a',
|
|
# 'src/demux/libwebpdemux.a' and 'src/libwebpextras.a'.
|
|
#
|
|
# To build the library and examples, use:
|
|
# make -f makefile.unix
|
|
# from this top directory.
|
|
|
|
#### Customizable part ####
|
|
|
|
# These flags assume you have libpng, libjpeg, libtiff and libgif installed. If
|
|
# not, either follow the install instructions below or just comment out the next
|
|
# four lines.
|
|
EXTRA_FLAGS= -DWEBP_HAVE_PNG -DWEBP_HAVE_JPEG -DWEBP_HAVE_TIFF
|
|
DWEBP_LIBS= -lpng -lz
|
|
CWEBP_LIBS= $(DWEBP_LIBS) -ljpeg -ltiff
|
|
GIF_LIBS = -lgif
|
|
|
|
ifeq ($(strip $(shell uname)), Darwin)
|
|
# Work around a problem linking tables marked as common symbols,
|
|
# cf., src/enc/yuv.[hc]
|
|
# Failure observed with: gcc 4.2.1 and 4.0.1.
|
|
EXTRA_FLAGS += -fno-common
|
|
EXTRA_FLAGS += -DHAVE_GLUT_GLUT_H
|
|
EXTRA_FLAGS += -I/opt/local/include
|
|
EXTRA_LIBS += -L/opt/local/lib
|
|
GL_LIBS = -framework GLUT -framework OpenGL
|
|
else
|
|
GL_LIBS = -lglut -lGL
|
|
endif
|
|
|
|
|
|
# To install libraries on Mac OS X:
|
|
# 1. Install MacPorts (http://www.macports.org/install.php)
|
|
# 2. Run "sudo port install jpeg"
|
|
# 3. Run "sudo port install libpng"
|
|
# 4. Run "sudo port install tiff"
|
|
# 5. Run "sudo port install giflib"
|
|
|
|
# To install libraries on Linux:
|
|
# 1. Run "sudo apt-get install libjpeg62-dev"
|
|
# 2. Run "sudo apt-get install libpng12-dev"
|
|
# 3. Run "sudo apt-get install libtiff4-dev"
|
|
# 4. Run "sudo apt-get install libgif-dev"
|
|
|
|
# Uncomment for build for 32bit platform
|
|
# Alternatively, you can just use the command
|
|
# 'make -f makefile.unix EXTRA_FLAGS=-m32' to that effect.
|
|
# EXTRA_FLAGS += -m32
|
|
|
|
# Extra flags to enable experimental features and code
|
|
# EXTRA_FLAGS += -DWEBP_EXPERIMENTAL_FEATURES
|
|
|
|
# Extra flags to enable byte swap for 16 bit colorspaces.
|
|
# EXTRA_FLAGS += -DWEBP_SWAP_16BIT_CSP
|
|
|
|
# Extra flags to enable multi-threading
|
|
EXTRA_FLAGS += -DWEBP_USE_THREAD
|
|
EXTRA_LIBS += -lpthread
|
|
|
|
# Extra flags to emulate C89 strictness with the full ANSI
|
|
EXTRA_C89_FLAGS = -Wextra -Wold-style-definition
|
|
EXTRA_C89_FLAGS += -Wmissing-prototypes
|
|
EXTRA_C89_FLAGS += -Wmissing-declarations
|
|
EXTRA_C89_FLAGS += -Wdeclaration-after-statement
|
|
EXTRA_C89_FLAGS += -Wshadow
|
|
EXTRA_C89_FLAGS += -Wformat-security -Wformat-nonliteral
|
|
# EXTRA_C89_FLAGS += -Wvla
|
|
|
|
EXTRA_CXX_FLAGS = -Wextra
|
|
EXTRA_CXX_FLAGS += -Wmissing-declarations
|
|
EXTRA_CXX_FLAGS += -Wshadow
|
|
EXTRA_CXX_FLAGS += -Wformat-security -Wformat-nonliteral
|
|
# EXTRA_CXX_FLAGS += -Wvla
|
|
|
|
# SSE4.1-specific flags:
|
|
ifeq ($(HAVE_SSE41), 1)
|
|
EXTRA_FLAGS += -DWEBP_HAVE_SSE41
|
|
src/dsp/%_sse41.o: EXTRA_FLAGS += -msse4.1
|
|
endif
|
|
|
|
# AVX2-specific flags:
|
|
ifeq ($(HAVE_AVX2), 1)
|
|
EXTRA_FLAGS += -DWEBP_HAVE_AVX2
|
|
src/dsp/%_avx2.o: EXTRA_FLAGS += -mavx2
|
|
endif
|
|
|
|
# NEON-specific flags:
|
|
# EXTRA_FLAGS += -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a8
|
|
# -> seems to make the overall lib slower: -fno-split-wide-types
|
|
|
|
#### Nothing should normally be changed below this line ####
|
|
|
|
AR = ar
|
|
ARFLAGS = r
|
|
CPPFLAGS = -Isrc/ -Wall
|
|
COMMONFLAGS = -O3 -DNDEBUG $(EXTRA_FLAGS)
|
|
CC = gcc
|
|
CFLAGS = $(COMMONFLAGS) $(EXTRA_C89_FLAGS)
|
|
CXX = g++
|
|
CXXFLAGS = $(COMMONFLAGS) $(EXTRA_CXX_FLAGS)
|
|
INSTALL = install
|
|
GROFF = /usr/bin/groff
|
|
COL = /usr/bin/col
|
|
LDFLAGS = $(EXTRA_LIBS) $(EXTRA_FLAGS) -lm
|
|
|
|
ANIM_UTIL_OBJS = \
|
|
examples/anim_util.o \
|
|
|
|
DEC_OBJS = \
|
|
src/dec/alpha.o \
|
|
src/dec/buffer.o \
|
|
src/dec/frame.o \
|
|
src/dec/idec.o \
|
|
src/dec/io.o \
|
|
src/dec/quant.o \
|
|
src/dec/tree.o \
|
|
src/dec/vp8.o \
|
|
src/dec/vp8l.o \
|
|
src/dec/webp.o \
|
|
|
|
DEMUX_OBJS = \
|
|
src/demux/demux.o \
|
|
|
|
DSP_DEC_OBJS = \
|
|
src/dsp/alpha_processing.o \
|
|
src/dsp/alpha_processing_mips_dsp_r2.o \
|
|
src/dsp/alpha_processing_sse2.o \
|
|
src/dsp/cpu.o \
|
|
src/dsp/dec.o \
|
|
src/dsp/dec_clip_tables.o \
|
|
src/dsp/dec_mips32.o \
|
|
src/dsp/dec_mips_dsp_r2.o \
|
|
src/dsp/dec_neon.o \
|
|
src/dsp/dec_sse2.o \
|
|
src/dsp/dec_sse41.o \
|
|
src/dsp/filters.o \
|
|
src/dsp/filters_mips_dsp_r2.o \
|
|
src/dsp/filters_sse2.o \
|
|
src/dsp/lossless.o \
|
|
src/dsp/lossless_mips_dsp_r2.o \
|
|
src/dsp/lossless_neon.o \
|
|
src/dsp/lossless_sse2.o \
|
|
src/dsp/rescaler.o \
|
|
src/dsp/rescaler_mips32.o \
|
|
src/dsp/rescaler_mips_dsp_r2.o \
|
|
src/dsp/upsampling.o \
|
|
src/dsp/upsampling_mips_dsp_r2.o \
|
|
src/dsp/upsampling_neon.o \
|
|
src/dsp/upsampling_sse2.o \
|
|
src/dsp/yuv.o \
|
|
src/dsp/yuv_mips32.o \
|
|
src/dsp/yuv_mips_dsp_r2.o \
|
|
src/dsp/yuv_sse2.o \
|
|
|
|
DSP_ENC_OBJS = \
|
|
src/dsp/argb.o \
|
|
src/dsp/argb_mips_dsp_r2.o \
|
|
src/dsp/argb_sse2.o \
|
|
src/dsp/cost.o \
|
|
src/dsp/cost_mips32.o \
|
|
src/dsp/cost_mips_dsp_r2.o \
|
|
src/dsp/cost_sse2.o \
|
|
src/dsp/enc.o \
|
|
src/dsp/enc_avx2.o \
|
|
src/dsp/enc_mips32.o \
|
|
src/dsp/enc_mips_dsp_r2.o \
|
|
src/dsp/enc_neon.o \
|
|
src/dsp/enc_sse2.o \
|
|
src/dsp/enc_sse41.o \
|
|
src/dsp/lossless_enc.o \
|
|
src/dsp/lossless_enc_mips32.o \
|
|
src/dsp/lossless_enc_mips_dsp_r2.o \
|
|
src/dsp/lossless_enc_neon.o \
|
|
src/dsp/lossless_enc_sse2.o \
|
|
|
|
ENC_OBJS = \
|
|
src/enc/alpha.o \
|
|
src/enc/analysis.o \
|
|
src/enc/backward_references.o \
|
|
src/enc/config.o \
|
|
src/enc/cost.o \
|
|
src/enc/filter.o \
|
|
src/enc/frame.o \
|
|
src/enc/histogram.o \
|
|
src/enc/iterator.o \
|
|
src/enc/near_lossless.o \
|
|
src/enc/picture.o \
|
|
src/enc/picture_csp.o \
|
|
src/enc/picture_psnr.o \
|
|
src/enc/picture_rescale.o \
|
|
src/enc/picture_tools.o \
|
|
src/enc/quant.o \
|
|
src/enc/syntax.o \
|
|
src/enc/token.o \
|
|
src/enc/tree.o \
|
|
src/enc/vp8l.o \
|
|
src/enc/webpenc.o \
|
|
|
|
EX_FORMAT_DEC_OBJS = \
|
|
examples/jpegdec.o \
|
|
examples/metadata.o \
|
|
examples/pngdec.o \
|
|
examples/tiffdec.o \
|
|
examples/webpdec.o \
|
|
|
|
EX_UTIL_OBJS = \
|
|
examples/example_util.o \
|
|
|
|
GIFDEC_OBJS = \
|
|
examples/gifdec.o \
|
|
|
|
MUX_OBJS = \
|
|
src/mux/anim_encode.o \
|
|
src/mux/muxedit.o \
|
|
src/mux/muxinternal.o \
|
|
src/mux/muxread.o \
|
|
|
|
UTILS_DEC_OBJS = \
|
|
src/utils/bit_reader.o \
|
|
src/utils/color_cache.o \
|
|
src/utils/filters.o \
|
|
src/utils/huffman.o \
|
|
src/utils/quant_levels_dec.o \
|
|
src/utils/random.o \
|
|
src/utils/rescaler.o \
|
|
src/utils/thread.o \
|
|
src/utils/utils.o \
|
|
|
|
UTILS_ENC_OBJS = \
|
|
src/utils/bit_writer.o \
|
|
src/utils/huffman_encode.o \
|
|
src/utils/quant_levels.o \
|
|
|
|
EXTRA_OBJS = \
|
|
src/extras/extras.o \
|
|
|
|
LIBWEBPDECODER_OBJS = $(DEC_OBJS) $(DSP_DEC_OBJS) $(UTILS_DEC_OBJS)
|
|
LIBWEBP_OBJS = $(LIBWEBPDECODER_OBJS) $(ENC_OBJS) $(DSP_ENC_OBJS) \
|
|
$(UTILS_ENC_OBJS)
|
|
LIBWEBPMUX_OBJS = $(MUX_OBJS)
|
|
LIBWEBPDEMUX_OBJS = $(DEMUX_OBJS)
|
|
LIBWEBPEXTRA_OBJS = $(EXTRA_OBJS)
|
|
|
|
HDRS_INSTALLED = \
|
|
src/webp/decode.h \
|
|
src/webp/demux.h \
|
|
src/webp/encode.h \
|
|
src/webp/mux.h \
|
|
src/webp/mux_types.h \
|
|
src/webp/types.h \
|
|
|
|
HDRS = \
|
|
src/dec/alphai.h \
|
|
src/dec/common.h \
|
|
src/dec/decode_vp8.h \
|
|
src/dec/vp8i.h \
|
|
src/dec/vp8li.h \
|
|
src/dec/webpi.h \
|
|
src/dsp/dsp.h \
|
|
src/dsp/lossless.h \
|
|
src/dsp/mips_macro.h \
|
|
src/dsp/neon.h \
|
|
src/dsp/yuv.h \
|
|
src/dsp/yuv_tables_sse2.h \
|
|
src/enc/backward_references.h \
|
|
src/enc/cost.h \
|
|
src/enc/histogram.h \
|
|
src/enc/vp8enci.h \
|
|
src/enc/vp8li.h \
|
|
src/mux/muxi.h \
|
|
src/utils/bit_reader.h \
|
|
src/utils/bit_reader_inl.h \
|
|
src/utils/bit_writer.h \
|
|
src/utils/color_cache.h \
|
|
src/utils/endian_inl.h \
|
|
src/utils/filters.h \
|
|
src/utils/huffman.h \
|
|
src/utils/huffman_encode.h \
|
|
src/utils/quant_levels.h \
|
|
src/utils/quant_levels_dec.h \
|
|
src/utils/random.h \
|
|
src/utils/rescaler.h \
|
|
src/utils/thread.h \
|
|
src/utils/utils.h \
|
|
src/webp/format_constants.h \
|
|
$(HDRS_INSTALLED) \
|
|
|
|
OUT_LIBS = examples/libexample_util.a src/libwebpdecoder.a src/libwebp.a
|
|
EXTRA_LIB = src/libwebpextras.a
|
|
OUT_EXAMPLES = examples/cwebp examples/dwebp
|
|
EXTRA_EXAMPLES = examples/gif2webp examples/vwebp examples/webpmux
|
|
EXTRA_CXX_EXAMPLES = examples/anim_diff
|
|
|
|
OUTPUT = $(OUT_LIBS) $(OUT_EXAMPLES)
|
|
ifeq ($(MAKECMDGOALS),clean)
|
|
OUTPUT += $(EXTRA_EXAMPLES) $(EXTRA_CXX_EXAMPLES)
|
|
OUTPUT += src/demux/libwebpdemux.a src/mux/libwebpmux.a $(EXTRA_LIB)
|
|
OUTPUT += examples/libgifdec.a examples/libanim_util.a
|
|
endif
|
|
|
|
ex: $(OUT_EXAMPLES)
|
|
all: ex $(EXTRA_EXAMPLES) $(EXTRA_CXX_EXAMPLES)
|
|
extras: $(EXTRA_LIB)
|
|
|
|
$(EX_FORMAT_DEC_OBJS): %.o: %.h
|
|
|
|
# special dependencies:
|
|
# tree.c/vp8.c/bit_reader.c <-> bit_reader_inl.h, endian_inl.h
|
|
# bit_writer.c <-> endian_inl.h
|
|
src/dec/tree.o: src/utils/bit_reader_inl.h src/utils/endian_inl.h
|
|
src/dec/vp8.o: src/utils/bit_reader_inl.h src/utils/endian_inl.h
|
|
src/utils/bit_reader.o: src/utils/bit_reader_inl.h src/utils/endian_inl.h
|
|
src/utils/bit_writer.o: src/utils/endian_inl.h
|
|
|
|
%.o: %.c $(HDRS)
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
|
|
|
%.o: %.cc $(HDRS)
|
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
|
|
|
|
examples/libanim_util.a: $(ANIM_UTIL_OBJS)
|
|
examples/libexample_util.a: $(EX_UTIL_OBJS)
|
|
examples/libgifdec.a: $(GIFDEC_OBJS)
|
|
src/libwebpdecoder.a: $(LIBWEBPDECODER_OBJS)
|
|
src/libwebp.a: $(LIBWEBP_OBJS)
|
|
src/mux/libwebpmux.a: $(LIBWEBPMUX_OBJS)
|
|
src/demux/libwebpdemux.a: $(LIBWEBPDEMUX_OBJS)
|
|
src/libwebpextras.a: $(LIBWEBPEXTRA_OBJS)
|
|
|
|
%.a:
|
|
$(AR) $(ARFLAGS) $@ $^
|
|
|
|
examples/anim_diff: examples/anim_diff.o $(ANIM_UTIL_OBJS) $(GIFDEC_OBJS)
|
|
examples/cwebp: examples/cwebp.o $(EX_FORMAT_DEC_OBJS)
|
|
examples/dwebp: examples/dwebp.o
|
|
examples/gif2webp: examples/gif2webp.o $(GIFDEC_OBJS)
|
|
examples/vwebp: examples/vwebp.o
|
|
examples/webpmux: examples/webpmux.o
|
|
|
|
examples/anim_diff: examples/libanim_util.a examples/libgifdec.a
|
|
examples/anim_diff: src/demux/libwebpdemux.a src/libwebp.a
|
|
examples/anim_diff: EXTRA_LIBS += $(GIF_LIBS)
|
|
examples/anim_diff: EXTRA_FLAGS += -DWEBP_HAVE_GIF
|
|
examples/cwebp: examples/libexample_util.a src/libwebp.a
|
|
examples/cwebp: EXTRA_LIBS += $(CWEBP_LIBS)
|
|
examples/dwebp: examples/libexample_util.a src/libwebpdecoder.a
|
|
examples/dwebp: EXTRA_LIBS += $(DWEBP_LIBS)
|
|
examples/gif2webp: examples/libexample_util.a examples/libgifdec.a
|
|
examples/gif2webp: src/mux/libwebpmux.a src/libwebp.a
|
|
examples/gif2webp: EXTRA_LIBS += $(GIF_LIBS)
|
|
examples/gif2webp: EXTRA_FLAGS += -DWEBP_HAVE_GIF
|
|
examples/vwebp: examples/libexample_util.a src/demux/libwebpdemux.a
|
|
examples/vwebp: src/libwebp.a
|
|
examples/vwebp: EXTRA_LIBS += $(GL_LIBS)
|
|
examples/vwebp: EXTRA_FLAGS += -DWEBP_HAVE_GL
|
|
examples/webpmux: examples/libexample_util.a src/mux/libwebpmux.a
|
|
examples/webpmux: src/libwebpdecoder.a
|
|
|
|
$(OUT_EXAMPLES) $(EXTRA_EXAMPLES):
|
|
$(CC) -o $@ $^ $(LDFLAGS)
|
|
|
|
$(EXTRA_CXX_EXAMPLES):
|
|
$(CXX) -o $@ $^ $(LDFLAGS)
|
|
|
|
dist: DESTDIR := dist
|
|
dist: OUT_EXAMPLES += $(EXTRA_EXAMPLES)
|
|
dist: all
|
|
$(INSTALL) -m755 -d $(DESTDIR)/include/webp \
|
|
$(DESTDIR)/bin $(DESTDIR)/doc $(DESTDIR)/lib
|
|
$(INSTALL) -m755 -s $(OUT_EXAMPLES) $(DESTDIR)/bin
|
|
$(INSTALL) -m644 $(HDRS_INSTALLED) $(DESTDIR)/include/webp
|
|
$(INSTALL) -m644 src/libwebp.a $(DESTDIR)/lib
|
|
$(INSTALL) -m644 src/demux/libwebpdemux.a $(DESTDIR)/lib
|
|
$(INSTALL) -m644 src/mux/libwebpmux.a $(DESTDIR)/lib
|
|
umask 022; \
|
|
for m in man/[cdv]webp.1 man/gif2webp.1 man/webpmux.1; do \
|
|
basenam=$$(basename $$m .1); \
|
|
$(GROFF) -t -e -man -T utf8 $$m \
|
|
| $(COL) -bx >$(DESTDIR)/doc/$${basenam}.txt; \
|
|
$(GROFF) -t -e -man -T html $$m \
|
|
| $(COL) -bx >$(DESTDIR)/doc/$${basenam}.html; \
|
|
done
|
|
|
|
clean:
|
|
$(RM) $(OUTPUT) *~ \
|
|
examples/*.o examples/*~ \
|
|
src/dec/*.o src/dec/*~ \
|
|
src/demux/*.o src/demux/*~ \
|
|
src/dsp/*.o src/dsp/*~ \
|
|
src/enc/*.o src/enc/*~ \
|
|
src/extras/*.o src/extras/*~ \
|
|
src/mux/*.o src/mux/*~ \
|
|
src/utils/*.o src/utils/*~ \
|
|
src/webp/*~ man/*~ doc/*~ swig/*~ \
|
|
|
|
.PHONY: all clean dist ex
|
|
.SUFFIXES:
|