From 5dcd56e4975e78976faeb0709d5ee7ad3c5fafb8 Mon Sep 17 00:00:00 2001
From: Longman E <el7g15@soton.ac.uk>
Date: Wed, 9 Jan 2019 16:51:02 +0000
Subject: [PATCH] Add Comments to Makefile and stop it looping through files
 when out of date

---
 Makefile | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index c221226..6928062 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,19 @@
 #*=============================================================================
 # Makefile for ecsdocs LaTeX Style
 # Date: 11/05/2002
-# Author: Steve Gunn
-#*=============================================================================
+# Author: Steve Gunn and Edward Longman
+# Use for rebuilding class files when the original dtx source has been changed
+# Change TEXMF to represent the installation directory of texlive (or MiKTeX)
+# The style is the name of the style for these templates.
+# make
+#	     all - creates all the necessart files to install the class
+#      install - moves all of the created files into the
+#*======================BUILD AND INSTALL NAMES================================
 
 TEXMF      = C:/Apps/texlive/texmf-local
 STYLE      = ecsdocs
 
-#*=============================================================================
+#*====================DEFINE EXPECTED OUTPUT FILES=============================
 
 CLSFILES   = ecsthesis.cls \
              ecsminithesis.cls \
@@ -64,20 +70,25 @@ DOCDIR     = "$(TEXMF)/doc/latex/$(STYLE)"
 BSTDIR     = "$(TEXMF)/bibtex/bst/$(STYLE)"
 BIBDIR     = "$(TEXMF)/bibtex/bib/$(STYLE)"
 
-#*===========================================================================
+#*====================== LATEX INSTALLATION CONFIG ==========================
 
 LATEX      = pdflatex
 PDFTEXIFY  = texify --pdf
 MAKEINDEX  = makeindex
 
-#*===========================================================================
+#*==================== DIFFERENT MAKE CONFIGURATIONS ========================
 
 all: $(GENFILES) $(DOCFILES)
 
 dist: $(STYLE).zip
 test: $(GENFILES) $(TESTFILES)
 
-$(GENFILES): $(STYLE).dtx $(STYLE).ins Makefile
+#* .SECONDARY used to stop it building repeatedly
+#* https://stackoverflow.com/questions/2973445/
+#* gnu-makefile-rule-generating-a-few-targets-from-a-single-source-file
+$(GENFILES): $(STYLE).intermediate;
+.SECONDARY: $(STYLE).intermediate
+$(STYLE).intermediate: $(STYLE).dtx $(STYLE).ins Makefile
 	$(LATEX) $(STYLE).ins
 
 $(DOCFILES): $(STYLE).dtx
@@ -89,14 +100,14 @@ $(DOCFILES): $(STYLE).dtx
 %.pdf: %.tex
 	$(PDFTEXIFY) $*.tex
 
-#*===========================================================================
+#*========================== ZIP REQUIREMENTS ===============================
 
 
 $(STYLE).zip: $(GENFILES) $(DOCFILES)
 	$(MAKE) clean
 	zip $@ $(SRCFILES) $(GENFILES) $(DOCFILES)
 
-#*===========================================================================
+#*============================= CLEAN TYPES =================================
 clean:
 	-$(RM) *.aux *.log *.ind *.idx *.glo *.gls *.ilg *.toc *.bak *.lol *.lot *.out *.lof *.bbl *.blg
 
@@ -106,7 +117,7 @@ veryclean: clean
 distclean: veryclean
 	-$(RM) *.cls *.tex *.eps *.bib *.bst *.zip
 
-#*===========================================================================
+#*======================= INSTALL INTO TEXMF DIRECTORY ======================
 
 install: $(GENFILES) $(DOCFILES)
 	install -d $(CLSDIR)
-- 
GitLab