2011-02-20 20:11:55 +01:00
|
|
|
# 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
|
2011-09-22 12:55:23 +02:00
|
|
|
# libraries 'src/libwebp.a' and 'src/mux/libwebpmux.a'.
|
2011-02-20 20:11:55 +01:00
|
|
|
#
|
|
|
|
# To build the library and examples, use:
|
|
|
|
# make -f makefile.unix
|
|
|
|
# from this top directory.
|
|
|
|
|
|
|
|
#### Customizable part ####
|
|
|
|
|
2011-03-17 22:45:23 +01:00
|
|
|
# These flag assume you have libpng and libjpeg installed. If not, either
|
|
|
|
# follow below install instructions or just comment out the next lines.
|
2011-02-20 20:11:55 +01:00
|
|
|
EXTRA_FLAGS= -DWEBP_HAVE_PNG -DWEBP_HAVE_JPEG
|
EXPERIMENTAL: add support for alpha channel
This is a (minor) bitstream change: if the 'color_space' bit is set to '1'
(which is normally an undefined/invalid behaviour), we add extra data at the
end of partition #0 (so-called 'extensions')
Namely, we add the size of the extension data as 3 bytes (little-endian),
followed by a set of bits telling which extensions we're incorporating.
The data then _preceeds_ this trailing tags.
This is all experimental, and you'll need to have
'#define WEBP_EXPERIMENTAL_FEATURES' in webp/types.h to enable this code
(at your own risk! :))
Still, this hack produces almost-valid WebP file for decoders that don't
check this color_space bit. In particular, previous 'dwebp' (and for instance
Chrome) will recognize this files and decode them, but without the alpha
of course. Other decoder will just see random extra stuff at the end of
partition #0.
To experiment with the alpha-channel, you need to compile on Unix platform
and use PNGs for input/output.
If 'alpha.png' is a source with alpha channel, then you can try (on Unix):
cwebp alpha.png -o alpha.webp
dwebp alpha.webp -o test.png
cwebp now has a '-noalpha' flag to ignore any alpha information from the
source, if present.
More hacking and experimenting welcome!
Change-Id: I3c7b1fd8411c9e7a9f77690e898479ad85c52f3e
2011-04-26 01:58:04 +02:00
|
|
|
EXTRA_LIBS= -lpng -ljpeg -lz
|
2011-06-24 22:47:59 +02:00
|
|
|
ifeq ($(strip $(shell uname)), Darwin)
|
2011-03-17 22:45:23 +01:00
|
|
|
EXTRA_FLAGS += -I/opt/local/include
|
|
|
|
EXTRA_LIBS += -L/opt/local/lib
|
|
|
|
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"
|
|
|
|
|
|
|
|
# To install libraries on Linux:
|
|
|
|
# 1. Run "sudo apt-get install libjpeg62-dev"
|
|
|
|
# 2. Run "sudo apt-get install libpng12-dev"
|
2011-02-20 20:11:55 +01:00
|
|
|
|
|
|
|
# Uncomment for build for 32bit platform
|
|
|
|
# Alternatively, you can just use the command
|
|
|
|
# 'make -f makefile.unix EXTRA_FLAGS=-m32' to that effect.
|
2011-03-25 23:04:11 +01:00
|
|
|
# EXTRA_FLAGS += -m32
|
|
|
|
|
2011-05-03 02:19:00 +02:00
|
|
|
# Extra flags to enable experimental features and code
|
2011-05-09 21:10:28 +02:00
|
|
|
# EXTRA_FLAGS += -DWEBP_EXPERIMENTAL_FEATURES
|
2011-05-03 02:19:00 +02:00
|
|
|
|
2011-07-22 22:09:10 +02:00
|
|
|
# Extra flags to enable multi-threading
|
|
|
|
EXTRA_FLAGS += -DWEBP_USE_THREAD
|
|
|
|
EXTRA_LIBS += -lpthread
|
|
|
|
|
2011-03-25 23:04:11 +01:00
|
|
|
# Extra flags to emulate C89 strictness with the full ANSI
|
|
|
|
EXTRA_FLAGS += -Wextra -Wold-style-definition
|
|
|
|
EXTRA_FLAGS += -Wmissing-prototypes
|
|
|
|
EXTRA_FLAGS += -Wmissing-declarations
|
|
|
|
EXTRA_FLAGS += -Wdeclaration-after-statement
|
2011-07-23 03:52:17 +02:00
|
|
|
# EXTRA_FLAGS += -Wvla
|
2011-02-20 20:11:55 +01:00
|
|
|
|
|
|
|
#### Nothing should normally be changed below this line ####
|
|
|
|
|
2011-08-26 02:25:11 +02:00
|
|
|
AR = ar
|
|
|
|
ARFLAGS = r
|
2012-01-25 02:54:49 +01:00
|
|
|
CC = gcc
|
|
|
|
CPPFLAGS = -Isrc/ -Iexamples/ -Wall
|
2011-02-20 20:11:55 +01:00
|
|
|
CFLAGS = -O3 -DNDEBUG $(EXTRA_FLAGS)
|
2011-08-26 03:33:28 +02:00
|
|
|
INSTALL = install
|
2011-11-30 13:16:45 +01:00
|
|
|
GROFF = /usr/bin/groff
|
|
|
|
COL = /usr/bin/col
|
2011-08-26 02:25:11 +02:00
|
|
|
LDFLAGS = $(EXTRA_LIBS) -lm
|
2011-02-20 20:11:55 +01:00
|
|
|
|
2012-04-12 21:00:43 +02:00
|
|
|
DEC_OBJS = \
|
|
|
|
src/dec/alpha.o \
|
|
|
|
src/dec/buffer.o \
|
|
|
|
src/dec/frame.o \
|
|
|
|
src/dec/idec.o \
|
|
|
|
src/dec/io.o \
|
|
|
|
src/dec/layer.o \
|
|
|
|
src/dec/quant.o \
|
|
|
|
src/dec/tree.o \
|
|
|
|
src/dec/vp8.o \
|
|
|
|
src/dec/vp8l.o \
|
|
|
|
src/dec/webp.o \
|
|
|
|
|
|
|
|
DSP_OBJS = \
|
|
|
|
src/dsp/cpu.o \
|
|
|
|
src/dsp/dec.o \
|
|
|
|
src/dsp/dec_neon.o \
|
|
|
|
src/dsp/dec_sse2.o \
|
|
|
|
src/dsp/enc.o \
|
|
|
|
src/dsp/enc_sse2.o \
|
|
|
|
src/dsp/lossless.o \
|
|
|
|
src/dsp/upsampling.o \
|
|
|
|
src/dsp/upsampling_sse2.o \
|
|
|
|
src/dsp/yuv.o \
|
|
|
|
|
|
|
|
ENC_OBJS = \
|
|
|
|
src/enc/alpha.o \
|
|
|
|
src/enc/analysis.o \
|
|
|
|
src/enc/config.o \
|
|
|
|
src/enc/cost.o \
|
|
|
|
src/enc/filter.o \
|
|
|
|
src/enc/frame.o \
|
|
|
|
src/enc/iterator.o \
|
|
|
|
src/enc/layer.o \
|
|
|
|
src/enc/picture.o \
|
|
|
|
src/enc/quant.o \
|
|
|
|
src/enc/syntax.o \
|
|
|
|
src/enc/tree.o \
|
|
|
|
src/enc/webpenc.o \
|
|
|
|
|
|
|
|
MUX_OBJS = \
|
|
|
|
src/mux/muxedit.o \
|
|
|
|
src/mux/muxinternal.o \
|
|
|
|
src/mux/muxread.o \
|
|
|
|
|
|
|
|
UTILS_OBJS = \
|
|
|
|
src/utils/alpha.o \
|
|
|
|
src/utils/bit_reader.o \
|
|
|
|
src/utils/bit_writer.o \
|
|
|
|
src/utils/color_cache.o \
|
|
|
|
src/utils/filters.o \
|
|
|
|
src/utils/huffman.o \
|
|
|
|
src/utils/quant_levels.o \
|
|
|
|
src/utils/rescaler.o \
|
|
|
|
src/utils/tcoder.o \
|
|
|
|
src/utils/thread.o \
|
|
|
|
|
|
|
|
LIBWEBP_OBJS = $(DEC_OBJS) $(DSP_OBJS) $(ENC_OBJS) $(UTILS_OBJS)
|
|
|
|
LIBWEBPMUX_OBJS = $(MUX_OBJS)
|
|
|
|
|
|
|
|
HDRS = \
|
|
|
|
src/dec/vp8i.h \
|
|
|
|
src/dec/vp8li.h \
|
|
|
|
src/dsp/dsp.h \
|
|
|
|
src/dsp/lossless.h \
|
|
|
|
src/dsp/yuv.h \
|
|
|
|
src/enc/cost.h \
|
|
|
|
src/enc/vp8enci.h \
|
|
|
|
src/utils/alpha.h \
|
|
|
|
src/utils/bit_reader.h \
|
|
|
|
src/utils/bit_writer.h \
|
|
|
|
src/utils/color_cache.h \
|
|
|
|
src/utils/filters.h \
|
|
|
|
src/utils/huffman.h \
|
|
|
|
src/utils/tcoder.h \
|
|
|
|
src/utils/thread.h \
|
|
|
|
src/webp/encode.h \
|
|
|
|
src/webp/mux.h \
|
2011-09-07 11:26:35 +02:00
|
|
|
|
2011-11-30 13:16:45 +01:00
|
|
|
OUT_LIBS = src/libwebp.a src/mux/libwebpmux.a
|
|
|
|
OUT_EXAMPLES = examples/cwebp examples/dwebp examples/webpmux
|
|
|
|
|
|
|
|
OUTPUT = $(OUT_LIBS) $(OUT_EXAMPLES)
|
2011-02-20 20:11:55 +01:00
|
|
|
|
2012-01-25 02:54:49 +01:00
|
|
|
all: ex
|
2011-02-20 20:11:55 +01:00
|
|
|
|
2011-08-26 02:25:11 +02:00
|
|
|
%.o: %.c $(HDRS)
|
2012-01-25 02:54:49 +01:00
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
|
2011-02-20 20:11:55 +01:00
|
|
|
|
2012-04-12 21:00:43 +02:00
|
|
|
src/libwebp.a: $(LIBWEBP_OBJS)
|
2011-08-26 02:25:11 +02:00
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
2011-02-20 20:11:55 +01:00
|
|
|
|
2012-04-12 21:00:43 +02:00
|
|
|
src/mux/libwebpmux.a: $(LIBWEBPMUX_OBJS)
|
2011-09-22 12:55:23 +02:00
|
|
|
$(AR) $(ARFLAGS) $@ $^
|
|
|
|
|
2011-11-30 13:16:45 +01:00
|
|
|
ex: $(OUT_EXAMPLES)
|
2011-08-26 02:25:11 +02:00
|
|
|
|
|
|
|
examples/cwebp: examples/cwebp.o src/libwebp.a
|
|
|
|
examples/dwebp: examples/dwebp.o src/libwebp.a
|
2011-09-30 07:37:01 +02:00
|
|
|
examples/webpmux: examples/webpmux.o src/mux/libwebpmux.a src/libwebp.a
|
2011-11-30 13:16:45 +01:00
|
|
|
|
|
|
|
$(OUT_EXAMPLES):
|
2011-08-26 02:25:11 +02:00
|
|
|
$(CC) -o $@ $^ $(LDFLAGS)
|
2011-02-20 20:11:55 +01:00
|
|
|
|
2011-08-26 03:33:28 +02:00
|
|
|
dist: DESTDIR := dist
|
|
|
|
dist: all
|
2011-08-30 22:44:03 +02:00
|
|
|
$(INSTALL) -m755 -d $(DESTDIR)/include/webp \
|
2012-01-06 07:38:05 +01:00
|
|
|
$(DESTDIR)/doc $(DESTDIR)/lib
|
2011-11-30 13:16:45 +01:00
|
|
|
$(INSTALL) -m755 -s $(OUT_EXAMPLES) $(DESTDIR)
|
2011-08-26 03:33:28 +02:00
|
|
|
$(INSTALL) -m644 src/webp/*.h $(DESTDIR)/include/webp
|
|
|
|
$(INSTALL) -m644 src/libwebp.a $(DESTDIR)/lib
|
2011-08-30 22:44:03 +02:00
|
|
|
umask 022; \
|
|
|
|
for m in man/[cd]webp.1; do \
|
|
|
|
basenam=$$(basename $$m .1); \
|
2011-11-30 13:16:45 +01:00
|
|
|
$(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; \
|
2011-08-30 22:44:03 +02:00
|
|
|
done
|
2011-08-26 03:33:28 +02:00
|
|
|
|
2011-02-20 20:11:55 +01:00
|
|
|
clean:
|
2012-01-25 02:54:49 +01:00
|
|
|
$(RM) $(OUTPUT) *~ \
|
|
|
|
examples/*.o examples/*~ \
|
2011-02-20 20:11:55 +01:00
|
|
|
src/dec/*.o src/dec/*~ \
|
2011-09-02 23:30:08 +02:00
|
|
|
src/dsp/*.o src/dsp/*~ \
|
2012-01-25 02:54:49 +01:00
|
|
|
src/enc/*.o src/enc/*~ \
|
2011-09-22 12:55:23 +02:00
|
|
|
src/mux/*.o src/mux/*~ \
|
2012-01-25 02:54:49 +01:00
|
|
|
src/utils/*.o src/utils/*~ \
|
2012-01-06 07:38:05 +01:00
|
|
|
src/webp/*~ man/*~ doc/*~ swig/*~ \
|
2011-03-29 19:46:36 +02:00
|
|
|
|
|
|
|
superclean: clean
|
2011-08-26 02:25:11 +02:00
|
|
|
$(RM) -r .git *.log *.cache *~
|
|
|
|
$(RM) -r .deps */.deps */*/.deps
|
|
|
|
$(RM) -r .libs */.libs */*/.libs
|
|
|
|
$(RM) */*.lo */*/*.lo
|
|
|
|
$(RM) */*.la */*/*.la
|
|
|
|
$(RM) Makefile */Makefile */*/Makefile
|
|
|
|
$(RM) Makefile.in */Makefile.in */*/Makefile.in
|
|
|
|
$(RM) config.log autom4te.cache libtool config.h stamp-h1
|
|
|
|
$(RM) aclocal.m4 compile config.guess config.h.in config.sub config.status
|
|
|
|
$(RM) configure depcomp install-sh ltmain.sh missing src/libwebp.pc
|
|
|
|
$(RM) m4/*
|
|
|
|
|
2011-08-26 03:33:28 +02:00
|
|
|
.PHONY: all clean dist ex superclean
|
2011-08-26 02:25:11 +02:00
|
|
|
.SUFFIXES:
|