OSDN Git Service

(split) LDP: Ensure xargs in Makefile is called only if targets exist
authorAkihiro MOTOKI <amotoki@gmail.com>
Mon, 25 Mar 2013 11:14:14 +0000 (20:14 +0900)
committerAkihiro MOTOKI <amotoki@gmail.com>
Mon, 25 Mar 2013 11:14:14 +0000 (20:14 +0900)
Previously xargs is always called, so xargs failed when the passed
list if empty.

Makefile

index 3b3a65b..5b02223 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,10 +26,14 @@ release:    jm-setup
        rm -f $(PERKAMON_DIR)/build/ja
        ln -s ../../draft $(PERKAMON_DIR)/build/ja
        # Do not remove unreleased pages
-       git status release | grep 'deleted:' | awk '{print $3;}' | xargs -n1 git checkout
+       set -e; if git status release | grep deleted; then \
+         git status release | grep 'deleted:' | awk '{print $3;}' | xargs -n1 git checkout; \
+       fi
 
 release-tl:
-       git status release | grep modified | awk '{print $3;}' | cut -d / -f 3 | xargs -n1 -IXXXXX ../../admin/JM-tl-modify.pl -U translation_list XXXXX RO
+       set -e; if git status release | grep modified; then \
+         git status release | grep modified | awk '{print $3;}' | cut -d / -f 3 | xargs -n1 -IXXXXX ../../admin/JM-tl-modify.pl -U translation_list XXXXX RO; \
+       fi
 
 format:
        set -e; for d in po4a/*; do \