A variable is defined with the syntax
var_name = definitionand is expanded with with $(var_name).
Useful variables for the makefile defined above would include:
dlxasm = ../dlxasm/$(ARCH)/dlxasm dlxcpu = ../dlxcpu/$(ARCH)/dlxcpu dlxcpuopt = -b -d -p -a -m 8192Notice that the definition of dlxasm and dlxcpu include the expansion of another variable, $(ARCH). This variable an environment variable -- set in the Unix environment, outside of the makefile. It has been arranged to contain either DS3100 or SPARC, depending on the kind of machine the user is running. The test suite then automatically chooses the correct versions of the executable to use for the test.
A makefile using these variables follows.
# Assemble the program. t1.Addi.o: t1.Addi.dlx dlxasm $(dlxasm) -o t1.Addi.o < t1.Addi.dlx # Run the test t1.Addi: t1.Addi.o t1.Addi.out dlxcpu $(dlxcpu) $(dlxcpuopt) t1.Addi.o > t1.Addi.tmp diff t1.Addi.tmp t1.Addi.out rm t1.Addi.tmp
Copyright 1996 by Byron Weber Becker