Chapter 9 The dependency generator (jcdep)
The jcdep command scans a set of source files (.j and .ji files)
for references to external compilation units, and outputs dependency
lines in a format suitable for the make utility. This ensures that
make will compile the source files in the correct order, and
recompile those files that need to when a source file is modified.
The typical usage is:
jcdep options *.ji *.j > .depend
where *.ji *.j expands to all source files in the current
directory and .depend is the file that should contain the
dependencies.
9.1 Options
The following command-line option is recognized by jcdep.
- -I directory
-
Add the given directory to the list of directories searched for
source files. If a source file foo.j mentions an external
compilation unit bar, a dependency on that unit's interface
bar.jio is generated only if the source for bar is found in the
current directory or in one of the directories specified with -I.
Otherwise, bar is assumed to be a module form the standard library,
and no dependencies are generated. For programs that span multiple
directories, it is recommended to pass jcdep the same -I options
that are passed to the compiler.
9.2 A typical Makefile
Here is a template Makefile for a join-calculus program.
JCC=jcc
JCDEP=jcdep
INCLUDES= #all relevant -I options here
JCCFLAGS=$(INCLUDES) #add other options for jcc here
# prog is composed of three units: mod1, mod2 and mod3.
# The list of object files for prog
PROG_OBJS=mod1.jo mod2.jo mod3.jo
prog: $(PROG1_OBJS)
$(JCC) -o prog $(JCFLAGS) $(PROG_OBJS)
# Common rules
.SUFFIXES: .j .ji .jo .jio
.j.jo:
$(JCC) $(JCFLAGS) -c $<
.ji.jio:
$(JCC) $(JCFLAGS) -c $<
# Clean up
clean:
rm -f prog
rm -f *.jo *.jio
# Dependencies
depend:
$(JCDEP) $(INCLUDES) *.ji *.j > .depend
include .depend