Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove generated makefile circular dependency #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

turboencabulator
Copy link
Contributor

src/Makefile is generated from src/Makefile.nw, mainly to unroll some loops. Two potential problems:

  1. 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 have notangle installed, I must edit the generated src/Makefile instead. Editing here is repetitive and increases the chances that I'll miss something.
  2. If src/Makefile was generated, it's left in a read-only state by chmod -w. If I'm following the installation instructions and just want to edit some variables directly (instead of scripting it), I first have to chmod +w it.

My solution is to put the loops directly into src/Makefile so we no longer need to generate it.

Instead of generating src/Makefile with all loops expanded, just put the
loops directly into the rules.  We already have similar loops in other
Makefiles.  After doing this, src/Makefile.nw only differs from
src/Makefile by having a couple extra comments, so copy them over and
delete src/Makefile.nw.

We used to set src/Makefile as read-only since it was generated, but
that is no longer necessary.  Now there is one less step if you want to
edit the variables at the top.
src/Makefile: Remove the $(LIBNAME) alias, we're replacing |LIBDIR| with
$(LIB) elsewhere.  Also remove the $(TEXNAME) alias.

src/lib/Makefile: Skip the |LIBDIR| replacement on toascii, it has
nothing needing replaced.

Files in src/shell: Prepare them for |LIBDIR| replacement if necessary.

Add a missing directory separator in notangle.1 following |TEXINPUTS|.
@turboencabulator
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant