I'm working on a build system that has bad practices piled on other bad practices for a long time and I'm in the process of re-writing the build. The languages involved are C/C++, Fortran, Ada, and Java and for the time being I'm sticking with GNU style makefiles -- though we're considering other alternatives such as SCons.
With that said, I'm looking for some specific recommendations -- not recommendations of the form "use a different build system", etc.
Whoever wrote the particular makefile I'm looking at right now had planned on a sequential build of java code that looks something like this:
LIST_OF_JAVA_FILES = file1.java
LIST_OF_JAVA_FILES += file2.java
LIST_OF_JAVA_FILES += file3.java
...
LIST_OF_JAVA_FILES += fileN.java
all: ${LIST_OF_JAVA_FILES}
${LIST_OF_JAVA_FILES} : %.class : %.java
${JAVAC} ${CLASSPATH} ${<}
Provided you perform a build in serial, this works fine. However, as soon as dependencies come into the mix it becomes more problematic.
- C/C++ compilers have options built-in for dependency generation ... does a similar facility exist for Java?
- Is it necessary to use third party tools (like Jikes) to generate dependencies?
- Typically speaking, if a team were using makefiles for building anything java related, is it more typical to call the java compiler one time listing out all
.java
files in one command-line -vs- one target for each.class
file?- If this is more common, is this strictly for simplicity sake or is there a deeper reason?
- note: I understand that for a sequential build this would be the faster option, but I want an answer to do empirical tests for parallel builds