Recall, that to compile and run your p1 program from the command-line, you had to type each of the following commands.
javac *.java java TestPQ NoPQ PQ01 PQ02 PQ03 MyPQ
To run the program and redirect the output to a file, you typed:
java TestPQ NoPQ PQ01 PQ02 PQ03 MyPQ > results.txt
Wouldn't it be nice to save these commands somewhere so that you didn't have to retype them all the time? Yes, of course. And that is where Linux's make utility excels. The Linux make program provides way to improve your command-line program development process. make is a Linux program that interprets and executes the rules that are found in a Makefile
The basic process is:
Create a text-only file named Makefile where the name is case-sensitive and does not have a file extension.
make: javac *.java java MyJavaProgram clean: rm MyProgram.class
CS400 p1's Makefile: Makefile
To run the code that is in the first Makefile rule, type:
make
To run the code listed under the Makefile's clean rule, type:
make clean
The make utility is much more powerful than this example. A web search for how to write a Makefile will provide dozens of examples and additional instructions. There are also other popular build utilities that can be run from a Linux command line, including Ant, Maven, and Gradle