blob: 8699d784a9a1ca32661a0407d33118c77e3d32c0 [file] [log] [blame]
Pascal Massiminof7a95492011-02-20 11:11:55 -08001# This makefile is a simpler alternative to the autoconf-based build
2# system, for simple local building of the libraries and tools.
3# It will not install the libraries system-wide, but just create the 'cwebp'
4# and 'dwebp' tools in the examples/ directory, along with the static
5# library 'src/libwebp.a'.
6#
7# To build the library and examples, use:
8# make -f makefile.unix
9# from this top directory.
10
11#### Customizable part ####
12
Pascal Massimino6463e6a2011-03-17 14:45:23 -070013# These flag assume you have libpng and libjpeg installed. If not, either
14# follow below install instructions or just comment out the next lines.
Pascal Massiminof7a95492011-02-20 11:11:55 -080015EXTRA_FLAGS= -DWEBP_HAVE_PNG -DWEBP_HAVE_JPEG
Pascal Massimino2ab4b722011-04-25 16:58:04 -070016EXTRA_LIBS= -lpng -ljpeg -lz
James Zern14d57312011-06-24 16:47:59 -040017ifeq ($(strip $(shell uname)), Darwin)
Pascal Massimino6463e6a2011-03-17 14:45:23 -070018 EXTRA_FLAGS += -I/opt/local/include
19 EXTRA_LIBS += -L/opt/local/lib
20endif
21
22# To install libraries on Mac OS X:
23# 1. Install MacPorts (http://www.macports.org/install.php)
24# 2. Run "sudo port install jpeg"
25# 3. Run "sudo port install libpng"
26
27# To install libraries on Linux:
28# 1. Run "sudo apt-get install libjpeg62-dev"
29# 2. Run "sudo apt-get install libpng12-dev"
Pascal Massiminof7a95492011-02-20 11:11:55 -080030
31# Uncomment for build for 32bit platform
32# Alternatively, you can just use the command
33# 'make -f makefile.unix EXTRA_FLAGS=-m32' to that effect.
Pascal Massiminof8db5d52011-03-25 15:04:11 -070034# EXTRA_FLAGS += -m32
35
Pascal Massimino6d0e66c2011-05-02 17:19:00 -070036# Extra flags to enable experimental features and code
Pascal Massiminoeb666702011-05-09 12:10:28 -070037# EXTRA_FLAGS += -DWEBP_EXPERIMENTAL_FEATURES
Pascal Massimino6d0e66c2011-05-02 17:19:00 -070038
Pascal Massiminof8db5d52011-03-25 15:04:11 -070039# Extra flags to emulate C89 strictness with the full ANSI
40EXTRA_FLAGS += -Wextra -Wold-style-definition
41EXTRA_FLAGS += -Wmissing-prototypes
42EXTRA_FLAGS += -Wmissing-declarations
43EXTRA_FLAGS += -Wdeclaration-after-statement
James Zern993af3e2011-06-24 16:37:19 -040044# EXTRA_FLAGS += -Wvla
Pascal Massiminof7a95492011-02-20 11:11:55 -080045
46#### Nothing should normally be changed below this line ####
47
48CC = gcc -Isrc/ -Iexamples/ -Wall
49CFLAGS = -O3 -DNDEBUG $(EXTRA_FLAGS)
Pascal Massiminod5bd54c2011-02-20 11:57:49 -080050LDFLAGS = src/libwebp.a $(EXTRA_LIBS) -lm
Pascal Massiminof7a95492011-02-20 11:11:55 -080051
52OBJS = src/enc/webpenc.o src/enc/bit_writer.o src/enc/syntax.o \
Pascal Massimino2ab4b722011-04-25 16:58:04 -070053 src/enc/dsp.o src/enc/dsp_sse2.o src/enc/alpha.o \
Pascal Massiminocfbf88a2011-04-22 12:14:45 -070054 src/enc/tree.o src/enc/config.o src/enc/frame.o \
Pascal Massiminof7a95492011-02-20 11:11:55 -080055 src/enc/quant.o src/enc/iterator.o src/enc/analysis.o \
56 src/enc/cost.o src/enc/picture.o src/enc/filter.o \
Pascal Massimino6d0e66c2011-05-02 17:19:00 -070057 src/enc/layer.o \
Pascal Massiminoa11009d2011-06-10 15:10:18 -070058 src/dec/bits.o src/dec/dsp.o src/dec/dsp_sse2.o src/dec/frame.o \
59 src/dec/webp.o src/dec/quant.o src/dec/tree.o src/dec/vp8.o \
Pascal Massiminod2603102011-06-20 00:45:15 -070060 src/dec/yuv.o src/dec/idec.o src/dec/alpha.o src/dec/layer.o \
Pascal Massiminoe291fae2011-07-07 16:50:04 -070061 src/dec/io.o src/dec/io_sse2.o src/dec/buffer.o
Pascal Massiminof7a95492011-02-20 11:11:55 -080062HDRS = src/webp/encode.h src/enc/vp8enci.h src/enc/bit_writer.h \
63 src/enc/cost.h src/dec/bits.h src/dec/vp8i.h src/dec/yuv.h
64OUTPUT = examples/cwebp examples/dwebp src/libwebp.a
65
66all:ex
67
68.c.o: $(HDRS)
69 $(CC) $(CFLAGS) -c $< -o $@
70
71libwebp.a: $(OBJS) $(HDRS)
72 ar r src/libwebp.a $(OBJS)
73
74ex: examples/cwebp.o examples/dwebp.o libwebp.a
75 $(CC) -o examples/cwebp examples/cwebp.o $(LDFLAGS)
76 $(CC) -o examples/dwebp examples/dwebp.o $(LDFLAGS)
77
78clean:
79 rm -f ${OUTPUT} *~ \
80 src/enc/*.o src/enc/*~ \
81 src/dec/*.o src/dec/*~ \
82 examples/*.o examples/*~
Pascal Massimino261abb82011-03-29 10:46:36 -070083
84superclean: clean
85 rm -rf .git *.log *.cache *~
86 rm -rf .deps */.deps */*/.deps
87 rm -rf .libs */.libs */*/.libs
88 rm -f */*.lo */*/*.lo
89 rm -f */*.la */*/*.la
90 rm -f Makefile */Makefile */*/Makefile
91 rm -f Makefile.in */Makefile.in */*/Makefile.in
92 rm -f config.log autom4te.cache libtool config.h stamp-h1
93 rm -f aclocal.m4 compile config.guess config.h.in config.sub config.status
94 rm -f configure depcomp install-sh ltmain.sh missing src/libwebp.pc
95 rm -f m4/*