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 #### #### Nothing should normally be changed below this line ####
AR = ar
ARFLAGS = r
CC = gcc -Isrc/ -Iexamples/ -Wall CC = gcc -Isrc/ -Iexamples/ -Wall
CFLAGS = -O3 -DNDEBUG $(EXTRA_FLAGS) 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 \ 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 \ 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 all:ex
.c.o: $(HDRS) %.o: %.c $(HDRS)
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
libwebp.a: $(OBJS) $(HDRS) src/libwebp.a: $(OBJS)
ar r src/libwebp.a $(OBJS) $(AR) $(ARFLAGS) $@ $^
ex: examples/cwebp.o examples/dwebp.o libwebp.a ex: examples/cwebp examples/dwebp
$(CC) -o examples/cwebp examples/cwebp.o $(LDFLAGS)
$(CC) -o examples/dwebp examples/dwebp.o $(LDFLAGS) examples/cwebp: examples/cwebp.o src/libwebp.a
examples/dwebp: examples/dwebp.o src/libwebp.a
examples/cwebp examples/dwebp:
$(CC) -o $@ $^ $(LDFLAGS)
clean: clean:
rm -f ${OUTPUT} *~ \ $(RM) ${OUTPUT} *~ \
src/enc/*.o src/enc/*~ \ src/enc/*.o src/enc/*~ \
src/dec/*.o src/dec/*~ \ src/dec/*.o src/dec/*~ \
examples/*.o examples/*~ examples/*.o examples/*~
superclean: clean superclean: clean
rm -rf .git *.log *.cache *~ $(RM) -r .git *.log *.cache *~
rm -rf .deps */.deps */*/.deps $(RM) -r .deps */.deps */*/.deps
rm -rf .libs */.libs */*/.libs $(RM) -r .libs */.libs */*/.libs
rm -f */*.lo */*/*.lo $(RM) */*.lo */*/*.lo
rm -f */*.la */*/*.la $(RM) */*.la */*/*.la
rm -f Makefile */Makefile */*/Makefile $(RM) Makefile */Makefile */*/Makefile
rm -f Makefile.in */Makefile.in */*/Makefile.in $(RM) Makefile.in */Makefile.in */*/Makefile.in
rm -f config.log autom4te.cache libtool config.h stamp-h1 $(RM) config.log autom4te.cache libtool config.h stamp-h1
rm -f aclocal.m4 compile config.guess config.h.in config.sub config.status $(RM) 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) configure depcomp install-sh ltmain.sh missing src/libwebp.pc
rm -f m4/* $(RM) m4/*
.PHONY: all clean ex superclean
.SUFFIXES: