# Sample Makefile # Jeff Ondich, April 2005 # # Exercises to try: # # 1. make hello # what happens? # # 1(a) make hello # if you do it right away again, what # happens the second time? # # 1(b) make clean # make hello # # 1(c) make hello # (same as 1(a), right?) # # 1(d) Make a small change to Hello.java, and then # try "make hello" again. # # Do you understand why sometimes "make hello" will make changes, and sometimes # it won't? How does make determine when nothing needs to be done? # # 2. make release # make test # Before you do this, you'll need to create # test-input.txt and expected-output.txt. # # 3. make debug # make test # how did the tests in 2 and 3 differ? # # 4. make # what happens when you type "make" with # no arguments? # # 5. Add a line "all: hello release" to the top # of the file (before "hello: Hello.java"). # Then execute "make" or "make all". # What happens? hello: Hello.class release: nodebugcopy DebugState.class Decapitalizer.class debug: debugcopy DebugState.class Decapitalizer.class nodebugcopy: cp NoDebug.java DebugState.java debugcopy: cp Debug.java DebugState.java Hello.class: Hello.java javac Hello.java Decapitalizer.class: Decapitalizer.java javac Decapitalizer.java DebugState.class: DebugState.java javac DebugState.java test: java Decapitalizer test-input.txt > output.txt diff expected-output.txt output.txt clean: rm *.class