BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
586 stars 165 forks source link

Get rid of bnfc's idiosyncratic "make" logic #219

Closed andreasabel closed 6 years ago

andreasabel commented 6 years ago

bnfc has its own logic of preserving unchanged files that makes it incompatible with make. GNU make expects a target to get the current time stamp if the action is run that creates it or refreshes it from its dependencies. Since bnfc is "clever" and does not recreate unchanged files, it will be called every time by make should there be any target older than the .cf file.

This contradicts the principle that make should be idempotent. More precisely, the second call to make in a row should report nothing to do for a properly written Makefile.

andreasabel commented 6 years ago

After the change, bnfc will recreate all its targets. If no change has occurred, the old .bak files will be preserved. In summary, the only change is that the targets will always get the current timestamp.

Maybe the motivation for the present behavior was that bnfc should have some make functionality itself. But since it does not go all the way to the end, like calling lexer and parser generators, it was only going halfway and would not integrate with make.