Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Makefiles for noweb

35 views
Skip to first unread message

Allan Adler

unread,
Sep 27, 2006, 4:07:33 PM9/27/06
to

I've tried a few times to install noweb on occasions when I didn't have
more time than to install it more or less out of the box as an appliance.
On those occasions the make failed with error messages that I didn't have
time to think about. I tried again this morning and noticed that the error
message had to do with not being able to find some file in a nonexistent
directory www of my home directory. The file src/FAQ.html that is supposed
to be created by this part of Makefile.nw in src already exists, so creating
it is not the issue. I think it would be better if the production of a
functioning executable were not contingent on the existence or location
of a FAQ file. I've made and used Makefiles but I'm not particularly good
at it and if something goes wrong with a make, there is a significant
probability that I won't be able to fix it.
--
Ignorantly,
Allan Adler <a...@zurich.csail.mit.edu>
* Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions and
* comments do not reflect in any way on MIT. Also, I am nowhere near Boston.

Allan Adler

unread,
Oct 1, 2006, 11:53:16 PM10/1/06
to
Allan Adler <a...@nestle.csail.mit.edu> writes:

> I've tried a few times to install noweb on occasions when I didn't have
> more time than to install it more or less out of the box as an appliance.
> On those occasions the make failed with error messages that I didn't have
> time to think about. I tried again this morning and noticed that the error
> message had to do with not being able to find some file in a nonexistent
> directory www of my home directory. The file src/FAQ.html that is supposed
> to be created by this part of Makefile.nw in src already exists, so creating
> it is not the issue.

I tried again on a different machine, also running RH 7.1, and had different
experiences, also unsuccessful. Simply typing make in the directory
/home/allan/noweb-2.11b results in:
for i in src; do (cd $i; make source); done
make[1]: Entering directory `/home/allan/noweb-2.11b/src'
make[1]: *** No rule to make target `source'. Stop.
make[1]: Leaving directory `/home/allan/noweb-2.11b/src'
make: *** [source] Error 2

There is no hint in the README file in that directory that one should
do anything other than what I did. However, near the beginning of
noweb-2.11b/Makefile, it reads:

# Don't edit this file; you should be editing the Makefiles in the
# src and contrib directories.

OK, so I went into src and examined the Makefile. It was empty, but
there was a file Makefile.nw. The file INSTALL contains some instructions
for modifying the file Makefile but makes no mention of the file Makefile.nw.
I think Makefile.nw is not really a Makefile, since it starts with stuff that
I think make is not likely to understand, such as:
I got sick and tired of copying goo for multiple files.
This nonsense is the result. (Too bad mk isn't everywhere.)
<<script>>=
(cat Makefile.nw; echo ""; notangle -t8 -R'generate chunks' Makefile.nw | sh) | notangle -t8 -
<<*>>=

Simply copying Makefile.nw to Makefile and running make generates error
messages, such as:

[allan@localhost src]$ make -fMakefile.nw
Makefile.nw:1: *** missing separator. Stop.

Commenting it out reveals that there is another such error on line 90.
Apparently there are some scripts in Makefile.nw and I don't know what
program is supposed to run the scripts. Maybe the mention of goo at the
beginning of Makefile.nw signifies that it is goo I should be feeding it
to, but I have no goo. According to the locate command, I do have something
called goop...

goop - squishy transparent oil and bubble screenhack

Anyway, I edited Makefile.nw as best I could, according to the prescriptions
of src/INSTALL. I just need to know how to obtain the actual Makefile.

Well, I've used the yank buffer of emacs to extract from the copyright
notice of Makefile.nw to the uninstall stuff, i.e. through

uninstall-code: uninstall-shell
rm $(LIB)/nt $(LIB)/markup $(LIB)/mnt $(LIB)/finduses
cd $(LIBSRC); make ICONT=$(ICONT) ICONC=$(ICONC) LIB=$(LIB) BIN=$(BIN) uninstall
cd lib; make LIB=$(LIB) uninstall

OK, let's try the INSTALL file's recommendation:
[allan@localhost src]$ make all install
cd c; make "CC=gcc -ansi -pedantic" "CFLAGS=-DTEMPNAM" all
make[1]: Entering directory `/home/allan/noweb-2.11b/src/c'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/allan/noweb-2.11b/src/c'
for i in shell lib xdoc tex; do (cd $i; make all); done
make[1]: Entering directory `/home/allan/noweb-2.11b/src/shell'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/allan/noweb-2.11b/src/shell'
make[1]: Entering directory `/home/allan/noweb-2.11b/src/lib'
chmod +x unmarkup emptydefn toascii nwmtime pipedocs h2a btdefn
make[1]: Leaving directory `/home/allan/noweb-2.11b/src/lib'
make[1]: Entering directory `/home/allan/noweb-2.11b/src/xdoc'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/allan/noweb-2.11b/src/xdoc'
make[1]: Entering directory `/home/allan/noweb-2.11b/src/tex'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/allan/noweb-2.11b/src/tex'
cd awk; make "ICONT=" "ICONC=" all
make[1]: Entering directory `/home/allan/noweb-2.11b/src/awk'
chmod +x noindex totex noidx tohtml
make[1]: Leaving directory `/home/allan/noweb-2.11b/src/awk'
mkdir /home/allan/noweb-2.11b/src/bin /home/allan/noweb-2.11b/src/lib 2>/dev/null
make: [install-shell] Error 1 (ignored)
<<shell binaries>>
/bin/sh: -c: line 1: syntax error near unexpected token `binaries>>'
/bin/sh: -c: line 1: `<<shell binaries>>'
make: *** [install-shell] Error 2

OK, I guess some of the scripted stuff wound up in the extract. OK, I
removed everything from the first place where I found <<. Now the extract
stops at:
uninstall: uninstall-code uninstall-man uninstall-tex uninstall-elisp
-rmdir $(BIN) $(LIB) 2>/dev/null

Now let's try again:
make: *** No rule to make target `install-code', needed by `install'. Stop.

There are also lots of lines, as above, about how there is nothing to do
with making all in various subdirectories. OK, I took a better look at
all: in the Makefile.
all:
cd c; make "CC=$(CC)" "CFLAGS=$(CFLAGS)" all
for i in shell lib xdoc tex; do (cd $$i; make all); done
cd $(LIBSRC); make "ICONT=$(ICONT)" "ICONC=$(ICONC)" all

So, maybe I'd better go into the subdirectories of src and look at their
Makefiles. Hmm..., I see a file noweb-2.11b/src/rhmake. I executed
sh rhmake
and got lots of stuff about nothing to do, followed by:
make[1]: Entering directory `/home/allan/noweb-2.11b/src/icon'
totex.icn
make[1]: totex.icn: Command not found
make[1]: *** [totex] Error 127
make[1]: Leaving directory `/home/allan/noweb-2.11b/src/icon'
make: *** [all] Error 2

Now, this is after I edited the Makefile so that Icon wouldn't be used
and awk would be used instead.
# If you have Icon, you should use the Icon versions of the noweb pipeline.
# Set LIBSRC=icon
LIBSRC=awk
# If you have no Icon compiler, but do have icont, make ICONC=icont
#ICONC=iconc
ICONC=
#ICONT=icont
ICONT=
Hmm, maybe the script in Makefile.nw is an awk script?
[allan@localhost src]$ gawk -f Makefile.nw
gawk: Makefile.nw:1: I got sick and tired of copying goo for multiple files.
gawk: Makefile.nw:1: ^ parse error

OK, I give up. What is the right way to install noweb?

gratefulfrog

unread,
Oct 2, 2006, 5:35:21 AM10/2/06
to
I'm sorry to jump in to the discussion so late.

I had no problem building from source, and also installing the debian
package on my Ubuntu 64bit linux platform...

There is some info about using noweb with common lisp, and some
modifications to noweb and a lisp autodef file available at my site
http://gratefulfrog.net

I would suggest trying to get a noweb .deb for your platform.

Hope this may help.
GF

Allan Adler

unread,
Oct 2, 2006, 9:22:27 AM10/2/06
to
Allan Adler <a...@nestle.csail.mit.edu> writes:

> I tried again on a different machine, also running RH 7.1, and had different
> experiences, also unsuccessful. Simply typing make in the directory

> /home/allan/noweb-2.11b results in:[snip]

OK, I've made what I think is significant progress. First, I realized
that the .nw in Makefile.nw means that it is a noweb file. So, if I can
figure out how to install noweave and notangle, I can apply the latter
to Makefile.nw to produce the Makefile which I need to make noweave
and notangle. Therefore, I'll refer to Makefile.nw as the "chicken-and-egg
Makefile".

At this point, I gave up on Makefiles. I started looking around in other
directories. In the directory src/c, I found lots of C source and considered
briefly using CWEB to produce a literate document based on them, but then I saw
doc.ps and realized it might not be necessary. There are also 4 executables:
finduses, markup, mnt, nt, the last of these being based on notangle.c.
I tried: ./nt ../Makefile.nw
and got an error message saying that the program couldn't handle arguments
yet. It occurred to me that there might be a shell script that served
as a wrapper for nt, and remembered that I had seen scripts named notangle
and noweave in src/shell. I returned to src and executed:
sh shell/notangle Makefile.nw
and got an error message about being unable to find markup in the directory
LIB or LIBDIR. I edited the script shell/notangle to tell it where to find
markup and tried again. This time I got output that looked a lot like the
Makefile I was hoping to get. I redirected output to Makefile and had
my Makefile and also some error messages on stderr. When I executed make,
I got an error message about line 50 having 8 spaces instead of a TAB.
I edited line 50 to have a TAB instead of 8 spaces and then make reported
the error message:
Makefile:50: *** commands commence before first target. Stop.
I don't know enough about make to know what to do, so I gave up.
On the other hand, I had apparently figured out how to use the script
shell/notangle, so I tried my luck with shell/noweave and after some editing
of the file got it to run on Makefile.nw to produce a tex file. I ran it
through latex and, after responding to a prompt that it couldn't find noweb.sty
by telling it to use tex/noweb.sty, it produced a dvi file. I read the dvi
file in xdvi and found the resulting literate document neither more nor less
easy to read than the original Makefile.nw.

Anyway, to make a long story short: I seem to have managed to get notangle
and noweave to work. To make a short story a little longer: what I seem really
to have done was to go through a long process of discovering that notangle
and noweave were, in fact, successfully installed, in spite of all appearances,
based on the output of running Makefile, that it had failed.

Now that they work, all I have to do is figure out how to make better use of
them. I think I can handle that.

I think that someone should consider turning the installation process for
noweb into an Adventure game. Most of the work is done already.

Norman Ramsey

unread,
Oct 2, 2006, 7:53:41 PM10/2/06
to
In article <efq2fc$28qf$1...@bowser.eecs.harvard.edu>,
Allan Adler <a...@nestle.csail.mit.edu> wrote:
>> I've tried a few times to install noweb...
>... unsuccessful.... Simply typing make in the directory
>/home/allan/noweb-2.11b results in...

>
>There is no hint in the README file in that directory that one should
>do anything other than what I did.

You must have missed the following hint, which appears on line 9 of
the README file:

To build noweb, change to the `src' directory and follow the
instructions in the file INSTALL.

I've changed the default Makefile target to complain bitterly.
--
Norman Ramsey
http://www.eecs.harvard.edu/~nr

Allan Adler

unread,
Oct 4, 2006, 12:41:07 PM10/4/06
to
n...@eecs.harvard.edu (Norman Ramsey) writes:

> Allan Adler <a...@nestle.csail.mit.edu> wrote:
> >> I've tried a few times to install noweb...
> >... unsuccessful.... Simply typing make in the directory
> >/home/allan/noweb-2.11b results in...
> >
> >There is no hint in the README file in that directory that one should
> >do anything other than what I did.
>
> You must have missed the following hint, which appears on line 9 of
> the README file:
>
> To build noweb, change to the `src' directory and follow the
> instructions in the file INSTALL.

That is indeed a hint.

> I've changed the default Makefile target to complain bitterly.

That will be very helpful. When I unpack a new package, I first type
make if there is a makefile, or maybe configure and then make, in the
hope that it will just work and then I can read the documentation at my
leisure. The reason I do that, apart from laziness, is that I'm not very
confident that I will be able to read the relevant documentation and act
on it in general. Also, sometimes it produces results that help me make a
little more sense of the documentation. Most of the time, I can't really
make sense of the docs, but typing make works well enough anyway. When I
do this, i.e. type make, I assume that doing so won't clobber some of the
materials I need to do the installation correctly. I'm not sure why, in this
case, the Makefile in src was clobbered, maybe it was something else I did,
so I'm not saying it was the fault of the original distribution. I also
assume, based on overwhelming experience that this is the case, that the
Makefile in the top directory is the one that needs to be executed. I won't
assume that in the future. Having the top level Makefile make the user do
the right thing is definitely a good idea.

Allan Adler

unread,
Nov 7, 2006, 2:42:47 AM11/7/06
to
After my bumbling success a month ago in discovering that my unorthodox,
and now outlawed, installation process had worked to install noweave and
notangle, I just assumed that there were no more subtleties in using them.
This evening, the first time since then that I have had time to work with
noweb, I tried to run noweave and notangle on the example wc.nw. The first
problem I encountered was that totex complained about nawk being unavailable.
I took a look at the shell script totex and learned at the beginning that I
am not supposed to try to understand the file, so I spent a fair amount of
time looking around for some other file to understand. Eventually, I decided
there wasn't one and edited totex, after backing it up, and changed nawk to
awk. I thought this might be technically ok since I didn't try to understand
it, only to change it. As soon as I did that, noweave worked fine and I was
able to produce wc.tex. It ran through LaTeX with some complaints but produced
what looks like a reasonable document that I will try to read next time I have
time for this activity. Then I ran wc.nw through notangle, which had no
complaints and produced wc.c. I then executed

gcc wc.c

and got a few complaints from gcc. It didn't like the fact that on line
42 there were variables `argc and `argv and that on line 52 there was
another such left quoted int variable (`ld? I forget). I'm still too
much of a beginner at noweb to know whether these left quoted variables
are a bug or a feature or perhaps an error in wc.nw, but I thought I
would mention it. If it is an error in wc.nw, how does one fix it?
This is the same noweb-2.11b that I've been struggling with in earlier
postings in this thread.

I'll try a few more example files and when I'm convinced that they all work,
I'll see if I can imitate one of them on a simple program.

0 new messages