[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 3DLDF (fwd)
From: |
Alexandre Duret-Lutz |
Subject: |
Re: 3DLDF (fwd) |
Date: |
Sat, 15 Nov 2003 09:55:27 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
I don't know CWEB, so my answers may not always make sense.
>>> "Laurence" == Laurence Finston <address@hidden> writes:
[...]
Laurence> I've written 3DLDF in C++ using CWEB, so my source
Laurence> files are transfor.web, points.web, etc. When they
Laurence> are ctangled, they produce transfor.c, points.c,
Laurence> etc. In addition, ctangle generates header files
Laurence> transfor.h, points.h, etc., from the CWEB files. CWEB
Laurence> files that are processed later can depend on header
Laurence> files generated from CWEB files that were processed
Laurence> before.
Tools that output multiple files are generally handled
using rules a-la `bison -d'.
.y.c:
bison -d ...
parser.h: parser.c
## Recover from the removal of parser.h
@if test -f $@; then : else \
rm -f parser.c; \
$(MAKE) parser.c; \
fi
However you need to list all A.h/A.c couples if you do this.
Another possibility is to use a stamp file to represent the
output of the tool. (Above parser.c was used for this purpose.)
.web.wstamp:
$(CTANGLE) $< # Or whatever the syntax is.
.wstamp.h:
## Recover from the removal of $@
@if test -f $@; then : else \
rm -f $<; \
$(MAKE) $<; \
fi
.wstamp.c:
## Recover from the removal of $@
@if test -f $@; then : else \
rm -f $<; \
$(MAKE) $<; \
fi
With the above rules, you should be able to write
bin_PROGRAMS = foo
foo_SOURCES = a.web b.web c.web
BUILT_SOURCES = $(foo_SOURCES:.web=.h)
DISTCLEANFILES = $(BUILT_SOURCES) $(foo_SOURCES:.web=.c)
Automake knows that .web files can be translated into .wstamp
files and then into .c files, so it will output the rules to
translate .c files into .o files.
The BUILT_SOURCES part ensure that all .h files are built
before .c files get compiled.
[...]
Laurence> To solve this problem, I've written a second program,
Laurence> LDF3DCPL, which manages retangling, recompilation,
[...]
Laurence> It uses diff to determine whether a header file has
Laurence> changed since its last version, and procedes
Laurence> accordingly.
Such a program should replace $(CTANGLES) in the above rules.
Also any renaming from .c to .cxx should be performed there.
[...]
Laurence> I was unable to call the executables "3DLDF" and
Laurence> "3DLDFcpl", because the variables (or are they
Laurence> macros?) "3DLDF_SOURCES" and "3DLDFcpl_SOURCES"
Laurence> caused errors in Automake.
POSIX call them Makefile macros. We prefer to talk about
Makefile variables and use the work macro for Autoconf macros.
The errors you have probably indicate you are using Automake 1.4.
Please upgrade. We are at 1.7.9 now, and the
foo_SOURCES = a.web b.web c.web
line above assume you have a sufficiently recent version.
--
Alexandre Duret-Lutz
- Re: 3DLDF (fwd), Laurence Finston, 2003/11/14
- Re: 3DLDF (fwd),
Alexandre Duret-Lutz <=