makefile.unix: rule maintenance

- use built-in variables where appropriate
- fix some target dependencies

Change-Id: I33584d0e7d9c5341841da89b6aa8f02e1c7c6aea
This commit is contained in:
James Zern 2011-08-25 20:25:11 -04:00
parent d477de7759
commit 87d58ce9cd

View File

@ -49,9 +49,11 @@ EXTRA_FLAGS += -Wdeclaration-after-statement
#### Nothing should normally be changed below this line ####
AR = ar
ARFLAGS = r
CC = gcc -Isrc/ -Iexamples/ -Wall
CFLAGS = -O3 -DNDEBUG $(EXTRA_FLAGS)
LDFLAGS = src/libwebp.a $(EXTRA_LIBS) -lm
LDFLAGS = $(EXTRA_LIBS) -lm
OBJS = src/enc/webpenc.o src/enc/bit_writer.o src/enc/syntax.o \
src/enc/dsp.o src/enc/dsp_sse2.o src/enc/alpha.o \
@ -69,31 +71,37 @@ OUTPUT = examples/cwebp examples/dwebp src/libwebp.a
all:ex
.c.o: $(HDRS)
%.o: %.c $(HDRS)
$(CC) $(CFLAGS) -c $< -o $@
libwebp.a: $(OBJS) $(HDRS)
ar r src/libwebp.a $(OBJS)
src/libwebp.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $^
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)
ex: examples/cwebp examples/dwebp
examples/cwebp: examples/cwebp.o src/libwebp.a
examples/dwebp: examples/dwebp.o src/libwebp.a
examples/cwebp examples/dwebp:
$(CC) -o $@ $^ $(LDFLAGS)
clean:
rm -f ${OUTPUT} *~ \
$(RM) ${OUTPUT} *~ \
src/enc/*.o src/enc/*~ \
src/dec/*.o src/dec/*~ \
examples/*.o examples/*~
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/*
$(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/*
.PHONY: all clean ex superclean
.SUFFIXES: