Installation

Usage

walk is built on top of a very simple concept; when you want to build a target, walk executes a file called Walkfile to determine:

What other targets the given target depends on.

How to build the target.

For example, if you wanted to build a program called prog from main.c and parse.c, you might write a Walkfile like this:

#!/bin/bash# The first argument is the "phase", which will either be `deps` or `exec`. In# the `deps` phase, the Walkfile should print the name of the targets that this# target depends on.
phase=$1# The second argument is the name of the target, like `prog`, `parse.o`, etc.
target=$2case$targetin
prog)
case$phasein# Prog depends on the object files we'll build from source. We simply# print each dependency on a single line.
deps)
echo main.o
echo parse.o
;;
exec) exec gcc -Wall -o $target$($0 deps $target) ;;
esac ;;
# A generic recipe for building a .o file from a corresponding .c file.*.o)
case$phasein
deps) echo${target//.o/.c} ;;
exec) exec gcc -Wall -o $target -c $($0 deps $target) ;;
esac ;;
# When invoking walk(1) without any arguments, it defaults to a target called# `all`.
all)
case$phasein
deps) echo prog ;;
esac ;;
# In general, it's good practice to include a fallback rule like this, in# case someone tries to build a target that we don't know how to build (or# someone makes a typo).*.c|*.h) ;; # static files*) >&2echo"No rule for target \"$target\""&&exit 1 ;;
esac