After generating the source ?¬?les, you can generate the make
?¬?le, including the contents of that variable or temporary ?¬?le at the appropriate
place.
The alternative to using make, or its equivalents such as nmake and successors such
as ant, is to generate and execute the command lines for the build commands. You can
either execute the build commands directly from the generator or generate them into a
batch ?¬?le and execute that. In general, the latter approach is easier to work with, since
the batch ?¬?le also forms a record of exactly what commands were executed.
You also want to make sure you get a record of any errors that occurred, especially
while you are still working on the generators. One good way is to redirect error output
to a ?¬?le, and open that ?¬?le in a text editor if there were errors. Below is an example for
Java onWindows NT/2000/XP. The ?¬?rst line runs the Java compiler, redirecting error
output to an errors.txt ?¬?le. The second line checks if the compiler returned an error
code, and if so opens the errors.txt ?¬?le and exits. The /b exits the batch ?¬?le, as opposed
to the whole command shell, and the 1 makes the batch ?¬?le return an error code, so a
calling program knows there was a problem.
javac *.java 2>errors.txt
if errorlevel 1 start errors.txt & exit /b 1
298 GENERATOR DEFINITION
The main difference between using make and directly calling build commands
is in how platform dependent the build process is.
Pages:
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556