Hi, please consider the following Makefile:
/mnt/xxx: xxx | /mnt/mounted cp $< $@ /mnt/mounted: mount -t cifs -o password=siemens //localhost/share /mnt touch $@ It seems to work fine at the first glance: # make mount -t cifs //localhost/share /mnt touch /mnt/mounted cp xxx /mnt/xxx # make make: `/mnt/xxx' is up to date. But things go wrong when unmounting the share: # umount /mnt # make mount -t cifs //localhost/share /mnt touch /mnt/mounted cp xxx /mnt/xxx The file xxx is copied again although the target is more up to date than the prerequisite. The reason for this is obvious: When Make builds its database to determine what to do, it sees that /mnt/xxx is missing, so it thinks it must be rebuild. It doesn't help that it will be there right after the mount. Thus, I need to reparse the Makefile whenever mounting was needed. The following Makefile seems to solve the problem: PID=$(shell echo $$PPID) .PRECIOUS: /mnt/mounted /mnt/xxx: xxx | /mnt/mounted cp $< $@ /mnt/mounted: mount -t cifs -o password=siemens //localhost/share /mnt touch $@ @$(MAKE) --no-print-dir $(MAKECMDGOALS) @kill -QUIT $(PID); true While that version always seems to do what I want, it looks a bit clumpsy to me. So my question: Is this the right way to go when reparsing of the current Makefile is required? May there be any undesired side effects? Thanks for amy suggestions, Chris _______________________________________________ Help-make mailing list Help-make@gnu.org https://lists.gnu.org/mailman/listinfo/help-make