A complete example
To put all this together, here is a complete example. This is the
tclmakefile from the
tclmake top-level directory. For
additional examples, see the
default.not file, and the
tclmakefiles in the
doc/ subdirectory.
# Directories to recurse in
DIRS = doc bin
# TCL files
TCL_SRCS = \
main.tcl \
parse.tcl \
update.tcl
# Update the Tcl index file
tclIndex: $(TCL_SRCS)
auto_mkindex $(MAKEDIR) $^
# Clean the directory
clean:
@if { [glob -nocomplain *~ core #*# ,*] == "" } {
break
}
eval file delete [glob -nocomplain *~ core #*# ,* dist/* dist]
# Make sources from sccs
% :: SCCS/s.%
exec sccs get $@
# Explicit rule for making sources
sources: % :: SCCS/s.%
exec sccs get $@
# The option-rule for recursion in directories
-r --recursive:
@foreach dir {$(DIRS)} {
if { [file type $dir] == "directory" && [file executable $dir] } {
set cwd [pwd]
cd $dir
$(MAKE) $(MFLAGS) $(MAKEVARS) $!
cd $cwd
}
}