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
|
|
|
|
# library 'src/libwebp.a'.
|
|
|
|
#
|
|
|
|
# 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-03-17 22:45:23 +01:00
|
|
|
ifeq ("$(HOSTTYPE)", "intel-mac")
|
|
|
|
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-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-02-20 20:11:55 +01:00
|
|
|
|
|
|
|
#### Nothing should normally be changed below this line ####
|
|
|
|
|
|
|
|
CC = gcc -Isrc/ -Iexamples/ -Wall
|
|
|
|
CFLAGS = -O3 -DNDEBUG $(EXTRA_FLAGS)
|
2011-02-20 20:57:49 +01:00
|
|
|
LDFLAGS = src/libwebp.a $(EXTRA_LIBS) -lm
|
2011-02-20 20:11:55 +01:00
|
|
|
|
|
|
|
OBJS = src/enc/webpenc.o src/enc/bit_writer.o src/enc/syntax.o \
|
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
|
|
|
src/enc/dsp.o src/enc/dsp_sse2.o src/enc/alpha.o \
|
2011-04-22 21:14:45 +02:00
|
|
|
src/enc/tree.o src/enc/config.o src/enc/frame.o \
|
2011-02-20 20:11:55 +01:00
|
|
|
src/enc/quant.o src/enc/iterator.o src/enc/analysis.o \
|
|
|
|
src/enc/cost.o src/enc/picture.o src/enc/filter.o \
|
2011-05-03 02:19:00 +02:00
|
|
|
src/enc/layer.o \
|
2011-02-20 20:11:55 +01:00
|
|
|
src/dec/bits.o src/dec/dsp.o src/dec/frame.o src/dec/webp.o \
|
2011-03-24 02:03:53 +01:00
|
|
|
src/dec/quant.o src/dec/tree.o src/dec/vp8.o src/dec/yuv.o \
|
2011-05-03 02:19:00 +02:00
|
|
|
src/dec/idec.o src/dec/alpha.o src/dec/layer.o
|
2011-02-20 20:11:55 +01:00
|
|
|
HDRS = src/webp/encode.h src/enc/vp8enci.h src/enc/bit_writer.h \
|
|
|
|
src/enc/cost.h src/dec/bits.h src/dec/vp8i.h src/dec/yuv.h
|
|
|
|
OUTPUT = examples/cwebp examples/dwebp src/libwebp.a
|
|
|
|
|
|
|
|
all:ex
|
|
|
|
|
|
|
|
.c.o: $(HDRS)
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
libwebp.a: $(OBJS) $(HDRS)
|
|
|
|
ar r src/libwebp.a $(OBJS)
|
|
|
|
|
|
|
|
ex: examples/cwebp.o examples/dwebp.o libwebp.a
|
|
|
|
$(CC) -o examples/cwebp examples/cwebp.o $(LDFLAGS)
|
|
|
|
$(CC) -o examples/dwebp examples/dwebp.o $(LDFLAGS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f ${OUTPUT} *~ \
|
|
|
|
src/enc/*.o src/enc/*~ \
|
|
|
|
src/dec/*.o src/dec/*~ \
|
|
|
|
examples/*.o examples/*~
|
2011-03-29 19:46:36 +02:00
|
|
|
|
|
|
|
superclean: clean
|
|
|
|
rm -rf .git *.log *.cache *~
|
|
|
|
rm -rf .deps */.deps */*/.deps
|
|
|
|
rm -rf .libs */.libs */*/.libs
|
|
|
|
rm -f */*.lo */*/*.lo
|
|
|
|
rm -f */*.la */*/*.la
|
|
|
|
rm -f Makefile */Makefile */*/Makefile
|
|
|
|
rm -f Makefile.in */Makefile.in */*/Makefile.in
|
|
|
|
rm -f config.log autom4te.cache libtool config.h stamp-h1
|
|
|
|
rm -f aclocal.m4 compile config.guess config.h.in config.sub config.status
|
|
|
|
rm -f configure depcomp install-sh ltmain.sh missing src/libwebp.pc
|
|
|
|
rm -f m4/*
|