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 | |
| 13 | # These flag assume you have libpng and libjpeg installed. If not, |
| 14 | # just comment out both lines. |
| 15 | EXTRA_FLAGS= -DWEBP_HAVE_PNG -DWEBP_HAVE_JPEG |
| 16 | EXTRA_LIBS= -lpng -ljpeg |
| 17 | |
| 18 | # Uncomment for build for 32bit platform |
| 19 | # Alternatively, you can just use the command |
| 20 | # 'make -f makefile.unix EXTRA_FLAGS=-m32' to that effect. |
| 21 | # EXTRA_FLAGS= -m32 |
| 22 | |
| 23 | #### Nothing should normally be changed below this line #### |
| 24 | |
| 25 | CC = gcc -Isrc/ -Iexamples/ -Wall |
| 26 | CFLAGS = -O3 -DNDEBUG $(EXTRA_FLAGS) |
Pascal Massimino | d5bd54c | 2011-02-20 11:57:49 -0800 | [diff] [blame^] | 27 | LDFLAGS = src/libwebp.a $(EXTRA_LIBS) -lm |
Pascal Massimino | f7a9549 | 2011-02-20 11:11:55 -0800 | [diff] [blame] | 28 | |
| 29 | OBJS = src/enc/webpenc.o src/enc/bit_writer.o src/enc/syntax.o \ |
| 30 | src/enc/dsp.o src/enc/tree.o src/enc/config.o src/enc/frame.o \ |
| 31 | src/enc/quant.o src/enc/iterator.o src/enc/analysis.o \ |
| 32 | src/enc/cost.o src/enc/picture.o src/enc/filter.o \ |
| 33 | src/dec/bits.o src/dec/dsp.o src/dec/frame.o src/dec/webp.o \ |
| 34 | src/dec/quant.o src/dec/tree.o src/dec/vp8.o src/dec/yuv.o |
| 35 | HDRS = src/webp/encode.h src/enc/vp8enci.h src/enc/bit_writer.h \ |
| 36 | src/enc/cost.h src/dec/bits.h src/dec/vp8i.h src/dec/yuv.h |
| 37 | OUTPUT = examples/cwebp examples/dwebp src/libwebp.a |
| 38 | |
| 39 | all:ex |
| 40 | |
| 41 | .c.o: $(HDRS) |
| 42 | $(CC) $(CFLAGS) -c $< -o $@ |
| 43 | |
| 44 | libwebp.a: $(OBJS) $(HDRS) |
| 45 | ar r src/libwebp.a $(OBJS) |
| 46 | |
| 47 | ex: examples/cwebp.o examples/dwebp.o libwebp.a |
| 48 | $(CC) -o examples/cwebp examples/cwebp.o $(LDFLAGS) |
| 49 | $(CC) -o examples/dwebp examples/dwebp.o $(LDFLAGS) |
| 50 | |
| 51 | clean: |
| 52 | rm -f ${OUTPUT} *~ \ |
| 53 | src/enc/*.o src/enc/*~ \ |
| 54 | src/dec/*.o src/dec/*~ \ |
| 55 | examples/*.o examples/*~ |