noweb
noweb copied to clipboard
Remove generated makefile circular dependency
src/Makefile
is generated from src/Makefile.nw
, mainly to unroll some loops. Two potential problems:
- If I need to make any modifications (particularly for package building), the preferred place to do it is in
src/Makefile.nw
. However if I'm trying to bootstrap and don't already havenotangle
installed, I must edit the generatedsrc/Makefile
instead. Editing here is repetitive and increases the chances that I'll miss something. - If
src/Makefile
was generated, it's left in a read-only state bychmod -w
. If I'm following the installation instructions and just want to edit some variables directly (instead of scripting it), I first have tochmod +w
it.
My solution is to put the loops directly into src/Makefile
so we no longer need to generate it.
I ran into another problem that this change will fix. If I don't already have noweb installed and am trying to bootstrap, and Makefile.nw is newer than Makefile (for whatever reason), then it dies at the make boot
step:
chmod +w Makefile
notangle -R'script' Makefile.nw | sh > Makefile
/bin/sh: line 1: notangle: command not found
chmod -w Makefile
make: *** No rule to make target 'boot'. Stop.
Make is smart enough to update the Makefile before updating any other targets. In this case it's wiping the Makefile contents since notangle doesn't exist yet, and then it can't continue.
If you're not interested in merging this change, I think we need an additional installation step to touch Makefile
just before make boot
.