gnu make - In Makefile, how to cleanup lockfile files? -
in gnu make 3.81, need remove lockfile in event of error in part of toolchain. there special target allow me this? need write wrapper script?
in example below, need unlock_id happen if rule file.out fails.
thanks! -jeff
all: lock_id file.out unlock_id file.out: file.in file-maker < file.in > $@ lock_id: lockfile file.lock unlock_id: rm -rf file.lock
i lock/unlock in same target file-maker
:
file.out: file.in lockfile $@.lock file-maker < $< > $@; \ status=$$?; \ rm -f $@.lock; \ exit $$status
this executes file-maker
, unlock steps in same shell, saving status of file-maker
make
fail if file-maker
fails.
Comments
Post a Comment