Pascal Massimino | f7a9549 | 2011-02-20 11:11:55 -0800 | [diff] [blame] | 1 | # 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 Massimino | 6463e6a | 2011-03-17 14:45:23 -0700 | [diff] [blame] | 13 | # 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 Massimino | f7a9549 | 2011-02-20 11:11:55 -0800 | [diff] [blame] | 15 | EXTRA_FLAGS= -DWEBP_HAVE_PNG -DWEBP_HAVE_JPEG |
Pascal Massimino | 2ab4b72 | 2011-04-25 16:58:04 -0700 | [diff] [blame] | 16 | EXTRA_LIBS= -lpng -ljpeg -lz |
Pascal Massimino | 6463e6a | 2011-03-17 14:45:23 -0700 | [diff] [blame] | 17 | ifeq ("$(HOSTTYPE)", "intel-mac") |
| 18 | EXTRA_FLAGS += -I/opt/local/include |
| 19 | EXTRA_LIBS += -L/opt/local/lib |
| 20 | endif |
| 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 Massimino | f7a9549 | 2011-02-20 11:11:55 -0800 | [diff] [blame] | 30 | |
| 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 Massimino | f8db5d5 | 2011-03-25 15:04:11 -0700 | [diff] [blame] | 34 | # EXTRA_FLAGS += -m32 |
| 35 | |
| 36 | # Extra flags to emulate C89 strictness with the full ANSI |
| 37 | EXTRA_FLAGS += -Wextra -Wold-style-definition |
| 38 | EXTRA_FLAGS += -Wmissing-prototypes |
| 39 | EXTRA_FLAGS += -Wmissing-declarations |
| 40 | EXTRA_FLAGS += -Wdeclaration-after-statement |
Pascal Massimino | f7a9549 | 2011-02-20 11:11:55 -0800 | [diff] [blame] | 41 | |
| 42 | #### Nothing should normally be changed below this line #### |
| 43 | |
| 44 | CC = gcc -Isrc/ -Iexamples/ -Wall |
| 45 | CFLAGS = -O3 -DNDEBUG $(EXTRA_FLAGS) |
Pascal Massimino | d5bd54c | 2011-02-20 11:57:49 -0800 | [diff] [blame] | 46 | LDFLAGS = src/libwebp.a $(EXTRA_LIBS) -lm |
Pascal Massimino | f7a9549 | 2011-02-20 11:11:55 -0800 | [diff] [blame] | 47 | |
| 48 | OBJS = src/enc/webpenc.o src/enc/bit_writer.o src/enc/syntax.o \ |
Pascal Massimino | 2ab4b72 | 2011-04-25 16:58:04 -0700 | [diff] [blame] | 49 | src/enc/dsp.o src/enc/dsp_sse2.o src/enc/alpha.o \ |
Pascal Massimino | cfbf88a | 2011-04-22 12:14:45 -0700 | [diff] [blame] | 50 | src/enc/tree.o src/enc/config.o src/enc/frame.o \ |
Pascal Massimino | f7a9549 | 2011-02-20 11:11:55 -0800 | [diff] [blame] | 51 | src/enc/quant.o src/enc/iterator.o src/enc/analysis.o \ |
| 52 | src/enc/cost.o src/enc/picture.o src/enc/filter.o \ |
| 53 | src/dec/bits.o src/dec/dsp.o src/dec/frame.o src/dec/webp.o \ |
Pascal Massimino | 8bf76fe | 2011-03-23 18:03:53 -0700 | [diff] [blame] | 54 | src/dec/quant.o src/dec/tree.o src/dec/vp8.o src/dec/yuv.o \ |
Pascal Massimino | 2ab4b72 | 2011-04-25 16:58:04 -0700 | [diff] [blame] | 55 | src/dec/idec.o src/dec/alpha.o |
Pascal Massimino | f7a9549 | 2011-02-20 11:11:55 -0800 | [diff] [blame] | 56 | HDRS = src/webp/encode.h src/enc/vp8enci.h src/enc/bit_writer.h \ |
| 57 | src/enc/cost.h src/dec/bits.h src/dec/vp8i.h src/dec/yuv.h |
| 58 | OUTPUT = examples/cwebp examples/dwebp src/libwebp.a |
| 59 | |
| 60 | all:ex |
| 61 | |
| 62 | .c.o: $(HDRS) |
| 63 | $(CC) $(CFLAGS) -c $< -o $@ |
| 64 | |
| 65 | libwebp.a: $(OBJS) $(HDRS) |
| 66 | ar r src/libwebp.a $(OBJS) |
| 67 | |
| 68 | ex: examples/cwebp.o examples/dwebp.o libwebp.a |
| 69 | $(CC) -o examples/cwebp examples/cwebp.o $(LDFLAGS) |
| 70 | $(CC) -o examples/dwebp examples/dwebp.o $(LDFLAGS) |
| 71 | |
| 72 | clean: |
| 73 | rm -f ${OUTPUT} *~ \ |
| 74 | src/enc/*.o src/enc/*~ \ |
| 75 | src/dec/*.o src/dec/*~ \ |
| 76 | examples/*.o examples/*~ |
Pascal Massimino | 261abb8 | 2011-03-29 10:46:36 -0700 | [diff] [blame] | 77 | |
| 78 | superclean: clean |
| 79 | rm -rf .git *.log *.cache *~ |
| 80 | rm -rf .deps */.deps */*/.deps |
| 81 | rm -rf .libs */.libs */*/.libs |
| 82 | rm -f */*.lo */*/*.lo |
| 83 | rm -f */*.la */*/*.la |
| 84 | rm -f Makefile */Makefile */*/Makefile |
| 85 | rm -f Makefile.in */Makefile.in */*/Makefile.in |
| 86 | rm -f config.log autom4te.cache libtool config.h stamp-h1 |
| 87 | rm -f aclocal.m4 compile config.guess config.h.in config.sub config.status |
| 88 | rm -f configure depcomp install-sh ltmain.sh missing src/libwebp.pc |
| 89 | rm -f m4/* |