Better revision handling.
authorChristoph Mallon <christoph.mallon@gmx.de>
Wed, 5 Dec 2007 14:42:22 +0000 (14:42 +0000)
committerChristoph Mallon <christoph.mallon@gmx.de>
Wed, 5 Dec 2007 14:42:22 +0000 (14:42 +0000)
[r18606]

Makefile

index d1490f1..7e4a442 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,7 @@ SPLINTS = $(addsuffix .splint, $(SOURCES))
 
 Q = @
 
-.PHONY : all clean dirs
+.PHONY : all clean dirs revision
 
 all: $(GOAL)
 
@@ -54,7 +54,7 @@ ifeq ($(findstring $(MAKECMDGOALS), clean depend),)
 -include .depend
 endif
 
-.depend: $(SOURCES)
+.depend: $(SOURCES) revision
        @echo "===> DEPEND"
        @rm -f $@ && touch $@ && makedepend -p "$@ build/" -Y -f $@ -- $(CPPFLAGS) -- $(SOURCES) 2> /dev/null && rm $@.bak
 
@@ -79,10 +79,14 @@ build/%.o: %.c
 #      $(Q)$(GCCO1) $(CPPFLAGS) $(CFLAGS) -O1 -c $< -o $@
        $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
 
-revision.h:
+revision:
        @echo "#define cparser_REVISION \"`svnversion -n .`\"" > .revision.h
-       $(Q)[ -n "`diff -Nq .revision.h revision.h`" ] && echo "===> Updating revision.h" && cp .revision.h revision.h
-       $(Q)rm .revision.h
+       $(Q)if diff -Nq .revision.h revision.h > /dev/null; then \
+             rm .revision.h;                                    \
+           else                                                 \
+             echo "===> UPDATING revision.h";                   \
+             mv .revision.h revision.h;                         \
+           fi
 
 clean:
        @echo '===> CLEAN'