@@ -375,15 +375,23 @@ static void writeLatexMakefile()
375375 t << " \t ps2pdf $(MANUAL_FILE).ps $(MANUAL_FILE).pdf\n\n " ;
376376 t << " $(MANUAL_FILE).dvi: clean $(MANUAL_FILE).tex doxygen.sty\n "
377377 << " \t echo \" Running latex...\"\n "
378- << " \t $(LATEX_CMD) $(MANUAL_FILE).tex\n "
378+ << " \t $(LATEX_CMD) $(MANUAL_FILE).tex || \\\n "
379+ << " \t if [ $$? != 0 ] ; then \\\n "
380+ << " \t \\ echo \" Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n "
381+ << " \t false; \\\n "
382+ << " \t fi\n "
379383 << " \t echo \" Running makeindex...\"\n "
380384 << " \t $(MKIDX_CMD) $(MANUAL_FILE).idx\n " ;
381385 if (generateBib)
382386 {
383387 t << " \t echo \" Running bibtex...\"\n " ;
384388 t << " \t $(BIBTEX_CMD) $(MANUAL_FILE)\n " ;
385389 t << " \t echo \" Rerunning latex....\"\n " ;
386- t << " \t $(LATEX_CMD) $(MANUAL_FILE).tex\n " ;
390+ t << " \t $(LATEX_CMD) $(MANUAL_FILE).tex || \\\n "
391+ << " \t if [ $$? != 0 ] ; then \\\n "
392+ << " \t \\ echo \" Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n "
393+ << " \t false; \\\n "
394+ << " \t fi\n " ;
387395 }
388396 t << " \t echo \" Rerunning latex....\"\n "
389397 << " \t $(LATEX_CMD) $(MANUAL_FILE).tex\n "
@@ -392,10 +400,19 @@ static void writeLatexMakefile()
392400 << " \t do \\\n "
393401 << " \t echo \" Rerunning latex....\" ;\\\n "
394402 << " \t $(LATEX_CMD) $(MANUAL_FILE).tex ; \\\n "
403+ << " \t $(LATEX_CMD) $(MANUAL_FILE).tex || \\\n "
404+ << " \t if [ $$? != 0 ] ; then \\\n "
405+ << " \t \\ echo \" Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n "
406+ << " \t false; \\\n "
407+ << " \t fi; \\\n "
395408 << " \t latex_count=`expr $$latex_count - 1` ;\\\n "
396409 << " \t done\n "
397410 << " \t $(MKIDX_CMD) $(MANUAL_FILE).idx\n "
398- << " \t $(LATEX_CMD) $(MANUAL_FILE).tex\n\n "
411+ << " \t $(LATEX_CMD) $(MANUAL_FILE).tex || \\\n "
412+ << " \t if [ $$? != 0 ] ; then \\\n "
413+ << " \t \\ echo \" Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n "
414+ << " \t false; \\\n "
415+ << " \t fi\n "
399416 << " $(MANUAL_FILE).ps: $(MANUAL_FILE).ps\n "
400417 << " \t psnup -2 $(MANUAL_FILE).ps >$(MANUAL_FILE).ps\n "
401418 << " \n "
@@ -407,23 +424,43 @@ static void writeLatexMakefile()
407424 t << " all: $(MANUAL_FILE).pdf\n\n "
408425 << " pdf: $(MANUAL_FILE).pdf\n\n " ;
409426 t << " $(MANUAL_FILE).pdf: clean $(MANUAL_FILE).tex\n " ;
410- t << " \t $(LATEX_CMD) $(MANUAL_FILE)\n " ;
427+ t << " \t $(LATEX_CMD) $(MANUAL_FILE) || \\\n "
428+ << " \t if [ $$? != 0 ] ; then \\\n "
429+ << " \t \\ echo \" Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n "
430+ << " \t false; \\\n "
431+ << " \t fi\n " ;
411432 t << " \t $(MKIDX_CMD) $(MANUAL_FILE).idx\n " ;
412433 if (generateBib)
413434 {
414435 t << " \t $(BIBTEX_CMD) $(MANUAL_FILE)\n " ;
415- t << " \t $(LATEX_CMD) $(MANUAL_FILE)\n " ;
436+ t << " \t $(LATEX_CMD) $(MANUAL_FILE) || \\\n "
437+ << " \t if [ $$? != 0 ] ; then \\\n "
438+ << " \t \\ echo \" Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n "
439+ << " \t false; \\\n "
440+ << " \t fi\n " ;
416441 }
417- t << " \t $(LATEX_CMD) $(MANUAL_FILE)\n "
442+ t << " \t $(LATEX_CMD) $(MANUAL_FILE) || \\\n "
443+ << " \t if [ $$? != 0 ] ; then \\\n "
444+ << " \t \\ echo \" Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n "
445+ << " \t false; \\\n "
446+ << " \t fi\n "
418447 << " \t latex_count=$(LATEX_COUNT) ; \\\n "
419448 << " \t while grep -E -s 'Rerun (LaTeX|to get cross-references right|to get bibliographical references right)' $(MANUAL_FILE).log && [ $$latex_count -gt 0 ] ;\\\n "
420449 << " \t do \\\n "
421450 << " \t echo \" Rerunning latex....\" ;\\\n "
422- << " \t $(LATEX_CMD) $(MANUAL_FILE) ;\\\n "
451+ << " \t $(LATEX_CMD) $(MANUAL_FILE) || \\\n "
452+ << " \t if [ $$? != 0 ] ; then \\\n "
453+ << " \t \\ echo \" Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n "
454+ << " \t false; \\\n "
455+ << " \t fi; \\\n "
423456 << " \t latex_count=`expr $$latex_count - 1` ;\\\n "
424457 << " \t done\n "
425458 << " \t $(MKIDX_CMD) $(MANUAL_FILE).idx\n "
426- << " \t $(LATEX_CMD) $(MANUAL_FILE)\n\n " ;
459+ << " \t $(LATEX_CMD) $(MANUAL_FILE) || \\\n "
460+ << " \t if [ $$? != 0 ] ; then \\\n "
461+ << " \t \\ echo \" Please consult $(MANUAL_FILE).log to see the error messages\" ; \\\n "
462+ << " \t false; \\\n "
463+ << " \t fi\n " ;
427464 }
428465
429466 t << " \n "
@@ -467,13 +504,15 @@ static void writeMakeBat()
467504 if (!Config_getBool (USE_PDFLATEX)) // use plain old latex
468505 {
469506 t << " %LATEX_CMD% %MANUAL_FILE%.tex\r\n " ;
507+ t << " @if ERRORLEVEL 1 goto :error\r\n " ;
470508 t << " echo ----\r\n " ;
471509 t << " %MKIDX_CMD% %MANUAL_FILE%.idx\r\n " ;
472510 if (generateBib)
473511 {
474512 t << " %BIBTEX_CMD% %MANUAL_FILE%\r\n " ;
475513 t << " echo ----\r\n " ;
476514 t << " \t %LATEX_CMD% %MANUAL_FILE%.tex\r\n " ;
515+ t << " @if ERRORLEVEL 1 goto :error\r\n " ;
477516 }
478517 t << " setlocal enabledelayedexpansion\r\n " ;
479518 t << " set count=%LAT#EX_COUNT%\r\n " ;
@@ -487,11 +526,13 @@ static void writeMakeBat()
487526 t << " if !count! EQU 0 goto :skip\r\n\r\n " ;
488527 t << " echo ----\r\n " ;
489528 t << " %LATEX_CMD% %MANUAL_FILE%.tex\r\n " ;
529+ t << " @if ERRORLEVEL 1 goto :error\r\n " ;
490530 t << " goto :repeat\r\n " ;
491531 t << " :skip\r\n " ;
492532 t << " endlocal\r\n " ;
493533 t << " %MKIDX_CMD% %MANUAL_FILE%.idx\r\n " ;
494534 t << " %LATEX_CMD% %MANUAL_FILE%.tex\r\n " ;
535+ t << " @if ERRORLEVEL 1 goto :error\r\n " ;
495536 t << " dvips -o %MANUAL_FILE%.ps %MANUAL_FILE%.dvi\r\n " ;
496537 t << Portable::ghostScriptCommand ();
497538 t << " -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "
@@ -500,15 +541,19 @@ static void writeMakeBat()
500541 else // use pdflatex
501542 {
502543 t << " %LATEX_CMD% %MANUAL_FILE%\r\n " ;
544+ t << " @if ERRORLEVEL 1 goto :error\r\n " ;
503545 t << " echo ----\r\n " ;
504546 t << " %MKIDX_CMD% %MANUAL_FILE%.idx\r\n " ;
505547 if (generateBib)
506548 {
507549 t << " %BIBTEX_CMD% %MANUAL_FILE%\r\n " ;
508550 t << " %LATEX_CMD% %MANUAL_FILE%\r\n " ;
551+ t << " @if ERRORLEVEL 1 goto :error\r\n " ;
509552 }
510553 t << " echo ----\r\n " ;
511- t << " %LATEX_CMD% %MANUAL_FILE%\r\n\r\n " ;
554+ t << " %LATEX_CMD% %MANUAL_FILE%\r\n " ;
555+ t << " @if ERRORLEVEL 1 goto :error\r\n " ;
556+ t << " \r\n " ;
512557 t << " setlocal enabledelayedexpansion\r\n " ;
513558 t << " set count=%LATEX_COUNT%\r\n " ;
514559 t << " :repeat\r\n " ;
@@ -521,13 +566,21 @@ static void writeMakeBat()
521566 t << " if !count! EQU 0 goto :skip\r\n\r\n " ;
522567 t << " echo ----\r\n " ;
523568 t << " %LATEX_CMD% %MANUAL_FILE%\r\n " ;
569+ t << " @if ERRORLEVEL 1 goto :error\r\n " ;
524570 t << " goto :repeat\r\n " ;
525571 t << " :skip\r\n " ;
526572 t << " endlocal\r\n " ;
527573 t << " %MKIDX_CMD% %MANUAL_FILE%.idx\r\n " ;
528574 t << " %LATEX_CMD% %MANUAL_FILE%\r\n " ;
575+ t << " @if ERRORLEVEL 1 goto :error\r\n " ;
529576 }
530577 t<< " \r\n " ;
578+ t << " goto :end\r\n " ;
579+ t << " :error\r\n " ;
580+ t << " @echo ===============\r\n " ;
581+ t << " @echo Please consult %MANUAL_FILE%.log to see the error messages\r\n " ;
582+ t << " @echo ===============\r\n " ;
583+ t<< " \r\n " ;
531584 t<< " @REM reset environment\r\n " ;
532585 t<< " popd\r\n " ;
533586 t<< " set LATEX_CMD=%ORG_LATEX_CMD%\r\n " ;
0 commit comments