an unfortunate consequence of the pace of technological advancement is the lack of knowledge among new developers concerning the lore and tools of previous generations. while much of old technology is quaint and should be left behind (how many programmers do you know that miss pdp 11 assembly language?), some good ideas were there as well.
one of the not-so-old and not-completely-forgotten programmer utilities of the past is the make utility. im not suggesting that make isnt still used (especially in the unix world), but the percentage of programmers who know what a make utility is and what it does is pretty small. yet the need for its functionality has never been greater, particularly for large-scale java projects. i hope this article will return it to the forefront where it belongs.
first, for the unenlightened, a little background on what a make utility does. then ill discuss the best thing to happen to java since cream and sugar - ant.
make utilities
back in the dark ages of software development (about 10 years ago), most code was written in a good editor (back when the editor was the ide). to make sure it was all compiled and linked correctly, a make utility was used. a make utility is a command line utility that uses a text file that contains a bunch of rules to transform one thing into another thing. for example, the make file would define the relationship between a ".c" source file and the ".obj" file generated by the compiler. the make file would then follow the rules (i.e., how to invoke the compiler) to make the transformation happen. you could also define dependencies to control the order in which artifacts were created. for example, you must compile the source files before you deploy them. make files dont flow from the top of the file to the bottom. you tell the make file what the ultimate target is and it executes the necessary steps (in the correct order) to fulfill the target.
an example is in order. listing 1 shows a simple make file for a c++ project (all code listings can be found at javadevelopersjournal.com). the top of the make file defines what files make up the project. next, compiler flags are listed as properties of the make file, and the compiler executables are defined as properties. in the last part of th... 下一页