If you are using the Unix make utility to build your document and source files, you
can add lines to your
Makefile to take care
of building the program source files.
The exact rules depend on whether your literate programs
are executable or not. We'll assume that both executable
and non-executable programs are produced, and that the
BASENAME is the name of your
DocBook file minus its “
.xml” extension. below.
First, define three variables like this:
m1 m2 ...EXECUTABLES =
e1 e2 ...CODE_TARGETS = $(EXECUTABLES) $(MODULES)
, and so forth
are the names of non-executable files, and
, and so on
are the names of your executable files.
Then, in the rules part of your
Makefile, change the first (default) target
to read like this:
all: web pdf code
Add these rules:
code: $(CODE_TARGETS) $(CODE_TARGETS): $(BASENAME).xml litlxml $<; \ chmod +x $(EXECUTABLES)
If no executables are produced, change the latter rule to:
$(CODE_TARGETS): $(BASENAME).xml litlxml $<
Makefile is included in Writing documentation with DocBook-XML 4.3.