On Mon, Jul 23, 2012 at 11:59 AM, icegood <icegood1...@gmail.com> wrote: > from newer version of gnu make (3.81 under kubuntu 12.04) > > .PHONEY: all > all: > if [ \( "$$(ls *.lock 2>/dev/null)" == "" \) ]; then \
The '==' operator is a bash extension that is supported by many but not all shells. Perhaps the shell seen by make on your kubuntu system is one that doesn't support it? The portable (30+ years!) equality operator is "=". (The '==' operator was an extension that improved usability but added no new functionality and instead reduced portability; thanks, bash maintainers, for screwing everyone by making that tradeoff!) > touch $@.lock; \ This "check for lock file, if it doesn't exist then create it" operation is *not* 100% safe! If two makes are run at almost the same time, they may both see the file doesn't exist and then both touch the lock file and continue, so the lock file is not actually guaranteeing that only one copy is running. You should see if there's a real atomic lock file program on your system that you can use for this. For example, I see a "flock" program on a Redhat system that could be used, those the usage is a bit different. > if [ \( ! -e $@ \) -o \( ../$(tag_fn) -nt $@ \) ]; then \ > echo $@ done; \ > else \ > touch $@; \ > fi; \ Isn't this the same as making $(tag_fn) a dependency of 'all' and having 'all' *not* be PHONY? > rm -f $@.lock; \ > else \ > sleep 1; \ > fi; If the lock cannot be obtained, you just sleep a second and then return success? Why not at least "exit 1" there so that the caller can tell that the make failed in a consistent fashion? Philip Guenther _______________________________________________ Bug-make mailing list Bug-make@gnu.org https://lists.gnu.org/mailman/listinfo/bug-make