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.
.java
files in one command-line -vs- one target for each .class
file?
It ended up being most expedient (and the norm for java development as a whole) to just specify all source files in a single build step and allow javac
to resolve all the dependencies that way.