diff --git a/.gitignore b/.gitignore index 50a5c52..3e5ff6d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ results.tex subdir.tex tex.tex transform.tex +miun.compat.tex diff --git a/Makefile b/Makefile index 68ea4f6..60870aa 100644 --- a/Makefile +++ b/Makefile @@ -3,12 +3,11 @@ MKFILES+= pkg.mk pub.mk transform.mk MKFILES+= tex.mk doc.mk MKFILES+= noweb.mk haskell.mk MKFILES+= exam.mk results.mk -#MKFILES+= miun.port.mk +MKFILES+= miun.compat.mk MIUNFILES+= miun.docs.mk miun.tex.mk miun.subdir.mk MIUNFILES+= miun.package.mk miun.pub.mk miun.course.mk -MIUNFILES+= miun.export.mk miun.results.mk latexmkrc -MIUNFILES+= miun.depend.mk +MIUNFILES+= miun.export.mk miun.results.mk miun.depend.mk OTHERS+= latexmkrc OTHERS+= gitattributes @@ -16,7 +15,7 @@ OTHERS+= gitattributes .PHONY: all all: makefiles.pdf all: ${MKFILES} -#all: ${MIUNFILES} +all: ${MIUNFILES} all: ${OTHERS} makefiles.pdf: makefiles.tex preamble.tex intro.tex makefiles.bib @@ -38,6 +37,12 @@ gitattributes: transform.mk.nw notangle -t2 -R$@ $^ | cpif $@ +miun.compat.tex: miun.compat.mk.nw + +${MIUNFILES}: miun.compat.mk.nw + ${NOTANGLE.mk} + + .PHONY: clean clean: ${RM} makefiles.pdf @@ -54,14 +59,13 @@ clean: ${RM} haskell.tex ${RM} exam.tex ${RM} results.tex -# ${RM} miun.port.tex + ${RM} miun.compat.tex .PHONY: miun miun: ${MIUNFILES} -#PKG_PACKAGES?= main miun -PKG_PACKAGES?= main +PKG_PACKAGES?= main miun PKG_PREFIX= /usr/local PKG_INSTALL_DIR= /include @@ -70,19 +74,9 @@ PKG_NAME-main= makefiles PKG_INSTALL_FILES-main= ${MKFILES} PKG_TARBALL_FILES-main= ${PKG_INSTALL_FILES-main} ${OTHERS} Makefile README.md -#PKG_NAME-miun= build-all -#PKG_INSTALL_FILES-miun= ${MIUNFILES} -#PKG_TARBALL_FILES-miun= ${PKG_INSTALL_FILES-miun} Makefile README.md -# -# -#PUB_SITES?= miun -# -#PUB_SERVER-miun?= ver.miun.se -#PUB_DIR-miun?= /srv/web/svn -#PUB_CATEGORY-miun?= build -#PUB_METHOD-miun?= ssh -#PUB_GROUP-miun?= svn -#PUB_FILES-miun?= ${PKG_FILES-miun} ${PKG_NAME-miun}.tar.gz +PKG_NAME-miun= build-all +PKG_INSTALL_FILES-miun= ${MIUNFILES} +PKG_TARBALL_FILES-miun= ${PKG_INSTALL_FILES-miun} ${OTHERS} Makefile README.md INCLUDE_MAKEFILES=. @@ -90,5 +84,3 @@ include ${INCLUDE_MAKEFILES}/portability.mk include ${INCLUDE_MAKEFILES}/noweb.mk include ${INCLUDE_MAKEFILES}/tex.mk include ${INCLUDE_MAKEFILES}/pkg.mk -include ${INCLUDE_MAKEFILES}/pub.mk -#include ${INCLUDE_MAKEFILES}/miun.port.mk diff --git a/makefiles.tex b/makefiles.tex index ad1b32b..56edccf 100644 --- a/makefiles.tex +++ b/makefiles.tex @@ -71,11 +71,11 @@ \chapter{results.mk} \input{results.tex} -%\appendix -%\part{Appendices} -% -%\chapter{MIUN-specific includes} -%\input{miun.port.tex} +\appendix +\part{Appendices} + +\chapter{MIUN-compatibility layer} +\input{miun.compat.tex} \printbibliography[heading=bibintoc]{} diff --git a/miun.compat.mk b/miun.compat.mk new file mode 100644 index 0000000..6508775 --- /dev/null +++ b/miun.compat.mk @@ -0,0 +1,451 @@ +ifndef MIUN_COMPAT_MK +MIUN_COMPAT_MK=true + +ifndef MIUN_SUBDIR_MK +MIUN_SUBDIR_MK=true + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/subdir.mk + +endif # MIUN_SUBDIR_MK +ifndef MIUN_PACKAGE_MK +MIUN_PACKAGE_MK=true + +ifdef TARBALL_NAME +PKG_TARBALL?=${TARBALL_NAME}.tar.gz +endif + +ifdef DOCS_FILES +PKG_PACKAGES= main docs + +PKG_INSTALL_FILES-docs?=${DOCS_FILES} +PKG_INSTALL_DIR-docs?=${DOCSDIR} +endif + +.PHONY: all +all: package + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/pkg.mk + +endif # MIUN_PACKAGE_MK +ifndef MIUN_PUB_MK +MIUN_PUB_MK=true + +SERVER?= ver.miun.se +PUBDIR?= /srv/web/svn +CATEGORY?= +TMPDIR?= /var/tmp +PUB_GROUP?= svn + +ifdef NO_COMMIT +PUB_AUTOCOMMIT?=${NO_COMMIT} +endif + +ifdef COMMIT_OPTS +PUB_COMMIT_OPTS?=${COMMIT_OPTS} +endif + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/pub.mk + +endif # MIUN_PUB_MK +ifndef MIUN_EXPORT_MK +MIUN_EXPORT_MK=true + +TRANSFORM_SRC= .tex +TRANSFORM_DST= .exporttex + +TRANSFORM_LIST.exporttex= NoSolutions +TRANSFORM_LIST-Makefile.export= OldExportFilter ExportFilter + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/transform.mk + +endif # MIUN_EXPORT_MK +ifndef MIUN_TEX_MK +MIUN_TEX_MK=true + +TEX_OUTDIR?= . + +TEXMF?= ${HOME}/texmf + +ifneq (${USE_LATEXMK},yes) +LATEX?= latex +PDFLATEX?= pdflatex +endif + +ifneq (${USE_BIBLATEX},yes) +TEX_BBL= yes +endif + +solutions?= no +handout?= no + +TRANSFORM_SRC= .tex + +ifeq (${solutions},yes) +TRANSFORM_DST+= .solutions.tex +TRANSFORM_LIST.solutions.tex=PrintAnswers + +%.pdf: %.solutions.pdf + ${LN} $< $@ +endif + +ifeq (${handout},yes) +TRANSFORM_DST+= .handout.tex +TRANSFORM_LIST.handout.tex=Handout + +%.pdf: %.handout.pdf + ${LN} $< $@ +endif + +.PHONY: all +all: ${DOCUMENTS} + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/tex.mk +include ${INCLUDE_MAKEFILES}/transform.mk + +endif # MIUN_TEX_MK +ifndef MIUN_DOCS_MK +MIUN_DOCS_MK=true + +DOCUMENTS?= +PUB_FILES?= ${DOCUMENTS} +SERVER?= ver.miun.se +PUBDIR?= /srv/web/svn/dokument +CATEGORY?= + +ifdef PRINT +LPR?= ${PRINT} +endif + +.PHONY: all +all: ${DOCUMENTS} + +.PHONY: print +print: ${DOCUMENTS:.pdf=.ps} + +.PHONY: clean-docs +clean-docs: +ifneq (${DOCUMENTS},) + ${RM} ${DOCUMENTS} +endif + +.PHONY: clean +clean: clean-docs + +.PHONY: todo +todo: $(wildcard *) + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/miun.tex.mk +include ${INCLUDE_MAKEFILES}/miun.pub.mk + +endif # MIUN_DOCS_MK +ifndef MIUN_COURSE_MK +MIUN_COURSE_MK=true + +DOCUMENTS?= +PUB_FILES?= ${DOCUMENTS} +SERVER?= ver.miun.se +PUBDIR?= /srv/web/svn/courses +CATEGORY?= + +.PHONY: all +all: ${DOCUMENTS} + +.PHONY: clean-course +clean-course: +ifneq (${DOCUMENTS},) + ${RM} ${DOCUMENTS} +endif + +.PHONY: clean +clean: clean-course + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/miun.docs.mk +include ${INCLUDE_MAKEFILES}/miun.export.mk + +endif # MIUN_COURSE_MK +ifndef MIUN_RESULTS_MK +MIUN_RESULTS_MK=true + +in?= ${COURSE}.txt +out?= reported.csv +report?= new_results.pdf + +RESULTS_COURSE?= ${COURSE} +RESULTS_EMAIL?= ${EXPADDR} + +MAILER?= thunderbird -compose \ + "to=${EXPADDR},subject='resultat ${COURSE}',attachment='file://${report}'" +RESULTS_MAILER?= ${MAILER} + +REWRITES?= "s/Godkänd(G)/G/g" "s/Underkänd(U)/U/g" "s/Komplettering(Fx)/Fx/g" +RESULTS_REWRITES?=${REWRITES} + +FAILED?= -\|Fx\?\|U +RESULTS_FAILED?= ${FAILED} + +FAILED_regex= " \(${FAILED}\)\( .*\)*$$" +RESULTS_FAILED_regex?=${FAILED_regex} + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/results.mk + +endif # MIUN_RESULTS_MK +ifndef MIUN_DEPEND_MK +MIUN_DEPEND_MK=true + +CONF?= /etc/mk.conf +-include ${CONF} + +.PHONY: dvips +ifeq (${MAKE},gmake) +dvips: + which dvips || sudo pkg_add ghostscript +else +dvips: + which dvips || sudo apt-get install texlive-full +endif + +.PHONY: pdf2ps +ifeq (${MAKE},gmake) +pdf2ps: + which pdf2ps || sudo pkg_add ghostscript +else +pdf2ps: + which pdf2ps || sudo apt-get install texlive-full +endif + +.PHONY: latex +ifeq (${MAKE},gmake) +latex: + which latex || sudo pkg_add texlive_texmf-full +else +latex: + which latex || sudo apt-get install texlive-full +endif + +.PHONY: latexmk +ifeq (${MAKE},gmake) +latexmk: + which latexmk || sudo pkg_add latexmk +else +latexmk: + which latexmk || sudo apt-get install latexmk +endif + +.PHONY: pax +ifeq (${MAKE},gmake) +pax: + which pax +else +pax: + which pax || sudo apt-get install pax +endif + +.PHONY: sed +ifeq (${MAKE},gmake) +SED= gsed +SEDex= gsed -E +sed gsed: + which gsed || sudo pkg_add gsed +else +sed gsed: + which sed +endif + +.PHONY: grep +ifeq (${MAKE},gmake) +GREP= ggrep +GREPex= ggrep -E +grep ggrep: + which ggrep || sudo pkg_add ggrep +else +grep ggrep: + which grep +endif + +.PHONY: git +ifeq (${MAKE},gmake) +git: + which git || sudo pkg_add git git-svn +else +git: + which git || sudo apt-get install git git-svn +endif + +.PHONY: wget +ifeq (${MAKE},gmake) +wget: + which wget || sudo pkg_add wget +else +wget: + which wget || sudo apt-get install wget +endif + +.PHONY: localc +ifeq (${MAKE},gmake) +localc: + which localc || sudo pkg_add libreoffice +else +localc: + which localc || sudo apt-get install libreoffice +endif + +.PHONY: update + +update: update-rfc + +.PHONY: rfc remove-rfc update-rfc clean-rfc + +rfc: rfc.bib + +remove-rfc:: + ${RM} -f ${TEXMF}/tex/latex/rfc.bib + +update-rfc: remove-rfc ${TEXMF}/tex/latex/rfc.bib + +.PHONY: clean-depends +#clean: clean-depends +clean-depends: clean-rfc +clean-rfc: + ${RM} rfc.bib + +${TEXMF}/tex/latex/rfc.bib: ${wget-depend} + mkdir -p ${TEXMF}/tex/latex/ + wget -O - http://tm.uka.de/~bless/rfc.bib.gz 2>/dev/null | \ + uncompress - > ${@} + +rfc.bib: + if [ -e ${TEXMF}/tex/latex/rfc.bib ]; then \ + ln -s ${TEXMF}/tex/latex/rfc.bib rfc.bib ; \ + else \ + wget -O - http://tm.uka.de/~bless/rfc.bib.gz 2>/dev/null | \ + uncompress - > ${@} ; \ + fi + + +update: latexmkrc miun.tex.mk miun.course.mk miun.docs.mk +update: miun.export.mk miun.pub.mk miun.package.mk +update: miun.subdir.mk miun.results.mk + +latexmkrc miun.tex.mk \ +miun.course.mk miun.docs.mk miun.export.mk miun.pub.mk \ +miun.package.mk miun.subdir.mk miun.results.mk: + wget -O $@ http://ver.miun.se/build/$@ + +clean-depends: + ${RM} latexmkrc miun.tex.mk miun.course.mk miun.docs.mk miun.export.mk + ${RM} miun.pub.mk miun.package.mk miun.subdir.mk miun.results.mk + +update: miunmisc miunart miunasgn miunbeam miunexam +update: miunlett miunprot miunthes + +### MIUN Miscellanous package and Logo ### + +miunmisc-depend?= ${TEXMF}/tex/latex/miun/miunmisc/miunmisc.sty +logo-depend?= ${TEXMF}/tex/latex/miun/miunmisc/MU_logotyp_int_sv.eps \ + ${TEXMF}/tex/latex/miun/miunmisc/MU_logotyp_int_CMYK.eps + +${miunmisc-depend} ${logo-depend}: + wget -O /tmp/miunmisc.tar.gz \ + http://ver.miun.se/latex/packages/miunmisc.tar.gz + cd /tmp && tar -zxf miunmisc.tar.gz + cd /tmp/miunmisc && ${MAKE} install + +#.PHONY: miunmisc miunlogo +#miunmisc: ${miunmisc-depend} +#miunlogo: miunmisc + +### MIUN Article class ### + +miunart-depend?= ${TEXMF}/tex/latex/miun/miunart/miunart.sty +${miunart-depend}: + wget -O /tmp/miunart.tar.gz \ + http://ver.miun.se/latex/packages/miunart.tar.gz + cd /tmp && tar -zxf miunart.tar.gz + cd /tmp/miunart && ${MAKE} install + +#.PHONY: miunart +#miunart: ${miunart-depend} miunlogo + +### MIUN Assignment class ### + +miunasgn-depend?= ${TEXMF}/tex/latex/miun/miunasgn/miunasgn.sty +${miunasgn-depend}: + wget -O /tmp/miunasgn.tar.gz \ + http://ver.miun.se/latex/packages/miunasgn.tar.gz + cd /tmp && tar -zxf miunasgn.tar.gz + cd /tmp/miunasgn && ${MAKE} install + +#.PHONY: miunasgn +#miunasgn: ${miunasgn-depend} miunlogo + +### MIUN Beamer class ### + +miunbeam-depend?= ${TEXMF}/tex/latex/miun/miunbeam/miunbeam.sty +${miunbeam-depend}: + wget -O /tmp/miunbeam.tar.gz \ + http://ver.miun.se/latex/packages/miunbeam.tar.gz + cd /tmp && tar -zxf miunbeam.tar.gz + cd /tmp/miunbeam && ${MAKE} install + +#.PHONY: miunbeam +#miunbeam: ${miunbeam-depend} miunlogo + +### MIUN Exam class ### + +miunexam-depend?= ${TEXMF}/tex/latex/miun/miunexam/miunexam.sty +${miunexam-depend}: + wget -O /tmp/miunexam.tar.gz \ + http://ver.miun.se/latex/packages/miunexam.tar.gz + cd /tmp && tar -zxf miunexam.tar.gz + cd /tmp/miunexam && ${MAKE} install + +#.PHONY: miunexam +#miunexam: ${miunexam-depend} miunlogo + +### MIUN Letter class ### + +miunlett-depend?= ${TEXMF}/tex/latex/miun/miunlett/miunlett.sty +${miunlett-depend}: + wget -O /tmp/miunlett.tar.gz \ + http://ver.miun.se/latex/packages/miunlett.tar.gz + cd /tmp && tar -zxf miunlett.tar.gz + cd /tmp/miunlett && ${MAKE} install + +#.PHONY: miunlett +#miunlett: ${miunlett-depend} miunlogo + +### MIUN Protocol class ### + +miunprot-depend?= ${TEXMF}/tex/latex/miun/miunprot/miunprot.sty +${miunprot-depend}: + wget -O /tmp/miunprot.tar.gz \ + http://ver.miun.se/latex/packages/miunprot.tar.gz + cd /tmp && tar -zxf miunprot.tar.gz + cd /tmp/miunprot && ${MAKE} install + +#.PHONY: miunprot +#miunprot: ${miunprot-depend} miunlogo + +### MIUN Thesis class ### + +miunthes-depend?= ${TEXMF}/tex/latex/miun/miunthes/miunthes.sty +${miunthes-depend}: + wget -O /tmp/miunthes.tar.gz \ + http://ver.miun.se/latex/packages/miunthes.tar.gz + cd /tmp && tar -zxf miunthes.tar.gz + cd /tmp/miunthes && ${MAKE} install + +#.PHONY: miunthes +#miunthes: ${miunthes-depend} miunlogo + +endif # MIUN_DEPEND_MK + +endif diff --git a/miun.compat.mk.nw b/miun.compat.mk.nw new file mode 100644 index 0000000..925b053 --- /dev/null +++ b/miun.compat.mk.nw @@ -0,0 +1,557 @@ +\label{miun.compat.mk} +\section{Introduction} + +This entire makefile collection grew out of a set of generic makefiles for +handling course material that I started to develop at Mid Sweden University +(MIUN), starting back in 2011. +In 2014 I started my PhD in KTH Royal Institute of Technology and I started to +add some research oriented parts and by 2016 I refactored everything and rewrote +it using literate programming. +A lot of my material still depends on the original MIUN structure, the aim of +this file is to map the old \enquote{MIUN API} to the current one. + +We will create a file [[<>]] which will implement the old API +using the new. +We let [[<>]] implement each old module as a code block. +<>= +ifndef MIUN_COMPAT_MK +MIUN_COMPAT_MK=true + +<> +<> +<> +<> +<> +<> +<> +<> +<> + +endif +@ This way we can create separate files containing only the individual parts +too. +Then we do not have to modify old [[Makefile]]s to include [[miun.compat.mk]]. + + +\section{miun.subdir.mk} + +The code to recurse through subdirectories is essentially the same, it has no +API, so we simply include it using the recommended way. +<>= +ifndef MIUN_SUBDIR_MK +MIUN_SUBDIR_MK=true + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/subdir.mk + +endif # MIUN_SUBDIR_MK +@ + + +\section{miun.package.mk} + +We will base the old interface on revision 448 in the original internal MIUN +repo, i.e.\ dated 2014-11-18 16:14:21Z. +The current version of [[pkg.mk]] already maps the interface quite well, so we +only have to map the last few parts and include the new include file. +<>= +ifndef MIUN_PACKAGE_MK +MIUN_PACKAGE_MK=true + +ifdef TARBALL_NAME +PKG_TARBALL?=${TARBALL_NAME}.tar.gz +endif + +ifdef DOCS_FILES +PKG_PACKAGES= main docs + +PKG_INSTALL_FILES-docs?=${DOCS_FILES} +PKG_INSTALL_DIR-docs?=${DOCSDIR} +endif + +.PHONY: all +all: package + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/pkg.mk + +endif # MIUN_PACKAGE_MK +@ + + +\section{miun.pub.mk} + +We will base the old interface on revision 448 in the original internal MIUN +repo, i.e.\ dated 2014-11-18 16:14:21Z. +The current version of [[pub.mk]] already maps the interface quite well, so we +only have to set the old defaults, map the last few variables and include the +new include file. +<>= +ifndef MIUN_PUB_MK +MIUN_PUB_MK=true + +SERVER?= ver.miun.se +PUBDIR?= /srv/web/svn +CATEGORY?= +TMPDIR?= /var/tmp +PUB_GROUP?= svn + +ifdef NO_COMMIT +PUB_AUTOCOMMIT?=${NO_COMMIT} +endif + +ifdef COMMIT_OPTS +PUB_COMMIT_OPTS?=${COMMIT_OPTS} +endif + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/pub.mk + +endif # MIUN_PUB_MK +@ + + +\section{miun.export.mk} + +We will base the old interface on revision 287 in the original internal MIUN +repo, i.e.\ dated 2013-01-21 23:27:17Z. +<>= +ifndef MIUN_EXPORT_MK +MIUN_EXPORT_MK=true + +TRANSFORM_SRC= .tex +TRANSFORM_DST= .exporttex + +TRANSFORM_LIST.exporttex= NoSolutions +TRANSFORM_LIST-Makefile.export= OldExportFilter ExportFilter + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/transform.mk + +endif # MIUN_EXPORT_MK +@ + + +\section{miun.tex.mk} + +We will base the old interface on revision 450 in the original internal MIUN +repo, i.e.\ dated 2014-11-26 12:21:11Z. +It is only the [[submission]] target that is not implemented from that version. +<>= +ifndef MIUN_TEX_MK +MIUN_TEX_MK=true + +TEX_OUTDIR?= . + +TEXMF?= ${HOME}/texmf + +ifneq (${USE_LATEXMK},yes) +LATEX?= latex +PDFLATEX?= pdflatex +endif + +ifneq (${USE_BIBLATEX},yes) +TEX_BBL= yes +endif + +solutions?= no +handout?= no + +TRANSFORM_SRC= .tex + +ifeq (${solutions},yes) +TRANSFORM_DST+= .solutions.tex +TRANSFORM_LIST.solutions.tex=PrintAnswers + +%.pdf: %.solutions.pdf + ${LN} $< $@ +endif + +ifeq (${handout},yes) +TRANSFORM_DST+= .handout.tex +TRANSFORM_LIST.handout.tex=Handout + +%.pdf: %.handout.pdf + ${LN} $< $@ +endif + +.PHONY: all +all: ${DOCUMENTS} + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/tex.mk +include ${INCLUDE_MAKEFILES}/transform.mk + +endif # MIUN_TEX_MK +@ + + +\section{miun.docs.mk} + +We will base the old interface on revision 423 in the original internal MIUN +repo, i.e.\ dated 2014-05-09 09:36:13Z. +<>= +ifndef MIUN_DOCS_MK +MIUN_DOCS_MK=true + +DOCUMENTS?= +PUB_FILES?= ${DOCUMENTS} +SERVER?= ver.miun.se +PUBDIR?= /srv/web/svn/dokument +CATEGORY?= + +ifdef PRINT +LPR?= ${PRINT} +endif + +.PHONY: all +all: ${DOCUMENTS} + +.PHONY: print +print: ${DOCUMENTS:.pdf=.ps} + +.PHONY: clean-docs +clean-docs: +ifneq (${DOCUMENTS},) + ${RM} ${DOCUMENTS} +endif + +.PHONY: clean +clean: clean-docs + +.PHONY: todo +todo: $(wildcard *) + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/miun.tex.mk +include ${INCLUDE_MAKEFILES}/miun.pub.mk + +endif # MIUN_DOCS_MK +@ + + +\section{miun.course.mk} + +We will base the old interface on revision 423 in the original internal MIUN +repo, i.e.\ dated 2014-05-09 09:36:13Z. +<>= +ifndef MIUN_COURSE_MK +MIUN_COURSE_MK=true + +DOCUMENTS?= +PUB_FILES?= ${DOCUMENTS} +SERVER?= ver.miun.se +PUBDIR?= /srv/web/svn/courses +CATEGORY?= + +.PHONY: all +all: ${DOCUMENTS} + +.PHONY: clean-course +clean-course: +ifneq (${DOCUMENTS},) + ${RM} ${DOCUMENTS} +endif + +.PHONY: clean +clean: clean-course + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/miun.docs.mk +include ${INCLUDE_MAKEFILES}/miun.export.mk + +endif # MIUN_COURSE_MK +@ + + +\section{miun.results.mk} + +We will base the old interface on revision 448 in the original internal MIUN +repo, i.e.\ dated 2014-11-18 16:14:21Z. +<>= +ifndef MIUN_RESULTS_MK +MIUN_RESULTS_MK=true + +in?= ${COURSE}.txt +out?= reported.csv +report?= new_results.pdf + +RESULTS_COURSE?= ${COURSE} +RESULTS_EMAIL?= ${EXPADDR} + +MAILER?= thunderbird -compose \ + "to=${EXPADDR},subject='resultat ${COURSE}',attachment='file://${report}'" +RESULTS_MAILER?= ${MAILER} + +REWRITES?= "s/Godkänd(G)/G/g" "s/Underkänd(U)/U/g" "s/Komplettering(Fx)/Fx/g" +RESULTS_REWRITES?=${REWRITES} + +FAILED?= -\|Fx\?\|U +RESULTS_FAILED?= ${FAILED} + +FAILED_regex= " \(${FAILED}\)\( .*\)*$$" +RESULTS_FAILED_regex?=${FAILED_regex} + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/results.mk + +endif # MIUN_RESULTS_MK +@ + + +\section{miun.depend.mk} + +We will base the old interface on revision 464 in the original internal MIUN +repo, i.e.\ dated 2015-05-26 12:51:03Z. +However, we will adapt it to the new way of adding them as a Git submodule to +use them, instead of installation or download from the University servers. +Also, the dependencies for Springer, ACM etc.\ has been removed. +That is also the case for the things that now resides in [[portability.mk]]. +<>= +ifndef MIUN_DEPEND_MK +MIUN_DEPEND_MK=true + +CONF?= /etc/mk.conf +-include ${CONF} + +CURRENT_URL=https://github.com/dbosk/miuntex/releases/download/v1.0 + + +.PHONY: clean-depends + + +### MIUN Miscellanous package and Logo ### + +miunmisc-depend?= ${TEXMF}/tex/latex/miun/miunmisc/miunmisc.sty +logo-depend?= ${TEXMF}/tex/latex/miun/miunmisc/MU_logotyp_int_sv.eps \ + ${TEXMF}/tex/latex/miun/miunmisc/MU_logotyp_int_CMYK.eps + +${miunmisc-depend} ${logo-depend}: + wget -O /tmp/miunmisc.tar.gz \ + http://ver.miun.se/latex/packages/miunmisc.tar.gz + cd /tmp && tar -zxf miunmisc.tar.gz + cd /tmp/miunmisc && ${MAKE} install + +MIUNMISC_FILES= MU_logotyp_int_CMYK.eps MU_logotyp_int_CMYK.pdf +MIUNMISC_FILES+= MU_logotyp_int_sv.eps MU_logotyp_int_sv.pdf +MIUNMISC_FILES+= miunmisc.sty miunmisc-Swedish.dict miunmisc-English.dict + +${INCLUDE_MIUNTEX}/miunmisc/miunmisc.sty: + ${MAKE} -C ${INCLUDE_MIUNTEX}/miunmisc miunmisc.sty + +${INCLUDE_MIUNTEX}/miunmisc/miunmisc-Swedish.dict: + ${MAKE} -C ${INCLUDE_MIUNTEX}/miunmisc miunmisc-Swedish.dict + +${INCLUDE_MIUNTEX}/miunmisc/miunmisc-English.dict: + ${MAKE} -C ${INCLUDE_MIUNTEX}/miunmisc miunmisc-English.dict + +ifdef INCLUDE_MIUNTEX +$(foreach f,${MIUNMISC_FILES},$(eval $f: ${INCLUDE_MIUNTEX}/miunmisc/$f)) +${MIUNMISC_FILES}: + ln -s $^ $@ +else +${MIUNMISC_FILES}: + wget -O $@ ${CURRENT_URL}/$@ +endif + +.PHONY: miunmisc miunlogo +miunlogo: MU_logotyp_int_CMYK.eps MU_logotyp_int_CMYK.pdf +miunlogo: MU_logotyp_int_sv.eps MU_logotyp_int_sv.pdf + +miunmisc: miunmisc.sty miunmisc-English.dict miunmisc-Swedish.dict +miunmisc: miunlogo + +.PHONY: clean-miunmisc clean-miunlogo +clean-depends: clean-miunmisc clean-miunlogo +clean-miunmisc: clean-tex + ${RM} ${MIUNMISC_FILES} + ${RM} miunmisc.sty miunmisc-English.dict miunmisc-Swedish.dict +clean-miunlogo: + ${RM} MU_logotyp_int_CMYK.eps MU_logotyp_int_CMYK.pdf + ${RM} MU_logotyp_int_sv.eps MU_logotyp_int_sv.pdf + + +### MIUN Article class ### + +miunart-depend?= ${TEXMF}/tex/latex/miun/miunart/miunart.sty +${miunart-depend}: + wget -O /tmp/miunart.tar.gz \ + http://ver.miun.se/latex/packages/miunart.tar.gz + cd /tmp && tar -zxf miunart.tar.gz + cd /tmp/miunart && ${MAKE} install + +MIUNART_FILES= miunart.cls miunart-English.dict miunart-Swedish.dict + +ifdef INCLUDE_MIUNTEX +$(foreach f,${MIUNART_FILES},$(eval $f: ${INCLUDE_MIUNTEX}/miunart/$f)) +${MIUNART_FILES}: + ln -s $^ $@ +else +${MIUNART_FILES}: + wget -O $@ ${CURRENT_URL}/$@ +endif + +.PHONY: miunart +miunart: ${MIUNART_FILES} miunlogo + +.PHONY: clean-miunart +clean-depends: clean-miunart +clean-miunart: + ${RM} ${MIUNART_FILES} + + +### MIUN Assignment class ### + +miunasgn-depend?= ${TEXMF}/tex/latex/miun/miunasgn/miunasgn.sty +${miunasgn-depend}: + wget -O /tmp/miunasgn.tar.gz \ + http://ver.miun.se/latex/packages/miunasgn.tar.gz + cd /tmp && tar -zxf miunasgn.tar.gz + cd /tmp/miunasgn && ${MAKE} install + +MIUNASGN_FILES= miunasgn.cls miunasgn-English.dict miunasgn-Swedish.dict + +ifdef INCLUDE_MIUNTEX +$(foreach f,${MIUNASGN_FILES},$(eval $f: ${INCLUDE_MIUNTEX}/miunasgn/$f)) +${MIUNASGN_FILES}: + ln -s $^ $@ +else +${MIUNASGN_FILES}: + wget -O $@ ${CURRENT_URL}/$@ +endif + +.PHONY: miunasgn +miunasgn: ${MIUNASGN_FILES} miunlogo + +.PHONY: clean-miunasgn +clean-depends: clean-miunasgn +clean-miunasgn: + ${RM} ${MIUNASGN_FILES} + + +### MIUN Exam class ### + +miunexam-depend?= ${TEXMF}/tex/latex/miun/miunexam/miunexam.sty +${miunexam-depend}: + wget -O /tmp/miunexam.tar.gz \ + http://ver.miun.se/latex/packages/miunexam.tar.gz + cd /tmp && tar -zxf miunexam.tar.gz + cd /tmp/miunexam && ${MAKE} install + +MIUNEXAM_FILES= miunexam.cls miunexam-English.dict miunexam-Swedish.dict + +ifdef INCLUDE_MIUNTEX +$(foreach f,${MIUNEXAM_FILES},$(eval $f: ${INCLUDE_MIUNTEX}/miunexam/$f)) +${MIUNEXAM_FILES}: + ln -s $^ $@ +else +${MIUNEXAM_FILES}: + wget -O $@ ${CURRENT_URL}/$@ +endif + +.PHONY: miunexam +miunexam: ${MIUNEXAM_FILES} miunlogo + +.PHONY: clean-miunexam +clean-depends: clean-miunexam +clean-miunexam: + ${RM} ${MIUNEXAM_FILES} + + +### MIUN Letter class ### + +miunlett-depend?= ${TEXMF}/tex/latex/miun/miunlett/miunlett.sty +${miunlett-depend}: + wget -O /tmp/miunlett.tar.gz \ + http://ver.miun.se/latex/packages/miunlett.tar.gz + cd /tmp && tar -zxf miunlett.tar.gz + cd /tmp/miunlett && ${MAKE} install + +miunlett.cls: + wget -O $@ ${CURRENT_URL}/$@ + +.PHONY: miunlett +miunlett: miunlett.cls miunlogo + +.PHONY: clean-miunlett +clean-depends: clean-miunlett +clean-miunlett: + ${RM} miunlett.cls + + +### MIUN Protocol class ### + +miunprot-depend?= ${TEXMF}/tex/latex/miun/miunprot/miunprot.sty +${miunprot-depend}: + wget -O /tmp/miunprot.tar.gz \ + http://ver.miun.se/latex/packages/miunprot.tar.gz + cd /tmp && tar -zxf miunprot.tar.gz + cd /tmp/miunprot && ${MAKE} install + +MIUNPROT_FILES= miunprot.cls miunprot-English.dict miunprot-Swedish.dict + +ifdef INCLUDE_MIUNTEX +$(foreach f,${MIUNPROT_FILES},$(eval $f: ${INCLUDE_MIUNTEX}/miunprot/$f)) +${MIUNPROT_FILES}: + ln -s $^ $@ +else +${MIUNPROT_FILES}: + wget -O $@ ${CURRENT_URL}/$@ +endif + +.PHONY: miunprot +miunprot: ${MIUNPROT_FILES} miunlogo + +.PHONY: clean-miunprot +clean-depends: clean-miunprot +clean-miunprot: + ${RM} ${MIUNPROT_FILES} + + +### MIUN Thesis class ### + +miunthes-depend?= ${TEXMF}/tex/latex/miun/miunthes/miunthes.sty +${miunthes-depend}: + wget -O /tmp/miunthes.tar.gz \ + http://ver.miun.se/latex/packages/miunthes.tar.gz + cd /tmp && tar -zxf miunthes.tar.gz + cd /tmp/miunthes && ${MAKE} install + +MIUNTHES_FILES= miunthes.cls miunthes-English.dict miunthes-Swedish.dict + +ifdef INCLUDE_MIUNTEX +$(foreach f,${MIUNTHES_FILES},$(eval $f: ${INCLUDE_MIUNTEX}/miunthes/$f)) +${MIUNTHES_FILES}: + ln -s $^ $@ +else +${MIUNTHES_FILES}: + wget -O $@ ${CURRENT_URL}/$@ +endif + +.PHONY: miunthes +miunthes: ${MIUNTHES_FILES} miunlogo latexmkrc + +.PHONY: clean-miunthes +clean-depends: clean-miunthes +clean-miunthes: + ${RM} ${MIUNTHES_FILES} + + +### INCLUDES ### + +INCLUDE_MAKEFILES?= . +INCLUDES= depend.mk tex.mk + +define inc +ifeq ($(findstring $(1),${MAKEFILE_LIST}),) +$(1): + wget https://raw.githubusercontent.com/dbosk/makefiles/master/$(1) +include ${INCLUDE_MAKEFILES}/$(1) +endif +endef +$(foreach i,${INCLUDES},$(eval $(call inc,$i))) + +### END INCLUDES ### + +endif # MIUN_DEPEND_MK +@ diff --git a/miun.course.mk b/miun.course.mk index 84fed21..3c105b5 100644 --- a/miun.course.mk +++ b/miun.course.mk @@ -1,44 +1,26 @@ -# $Id$ -# Author: Daniel Bosk - ifndef MIUN_COURSE_MK MIUN_COURSE_MK=true -# add these to the document specific Makefile -SOURCES?= ${FILES} -DOCUMENTS?= -PUB_FILES?= ${DOCUMENTS} -SERVER?= ver.miun.se -PUBDIR?= /srv/web/courses +DOCUMENTS?= +PUB_FILES?= ${DOCUMENTS} +SERVER?= ver.miun.se +PUBDIR?= /srv/web/svn/courses CATEGORY?= -# the documents will be published to $SERVER/$PUBDIR/$CATEGORY - -.PHONY: all print clean clean-course todo +.PHONY: all all: ${DOCUMENTS} -clean-course: clean-tex +.PHONY: clean-course +clean-course: ifneq (${DOCUMENTS},) ${RM} ${DOCUMENTS} endif +.PHONY: clean clean: clean-course +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/miun.docs.mk +include ${INCLUDE_MAKEFILES}/miun.export.mk -### INCLUDES ### - -INCLUDE_MAKEFILES?= . -INCLUDES= miun.depend.mk miun.docs.mk export.mk - -define inc -ifeq ($(findstring $(1),${MAKEFILE_LIST}),) -$(1): - wget https://raw.githubusercontent.com/dbosk/makefiles/master/$(1) -include ${INCLUDE_MAKEFILES}/$(1) -endif -endef -$(foreach i,${INCLUDES},$(eval $(call inc,$i))) - -### END INCLUDES ### - -endif +endif # MIUN_COURSE_MK diff --git a/miun.docs.mk b/miun.docs.mk index d85ef74..64d573d 100644 --- a/miun.docs.mk +++ b/miun.docs.mk @@ -1,32 +1,36 @@ -# $Id$ -# Author: Daniel Bosk - ifndef MIUN_DOCS_MK MIUN_DOCS_MK=true -# add these to the document specific Makefile -SOURCES?= ${FILES} -DOCUMENTS?= -PUB_FILES?= ${DOCUMENTS} -SERVER?= ver.miun.se -PUBDIR?= /srv/web/documents +DOCUMENTS?= +PUB_FILES?= ${DOCUMENTS} +SERVER?= ver.miun.se +PUBDIR?= /srv/web/svn/dokument CATEGORY?= -# the documents will be published to $SERVER/$PUBDIR/$CATEGORY -### INCLUDES ### +ifdef PRINT +LPR?= ${PRINT} +endif + +.PHONY: all +all: ${DOCUMENTS} -INCLUDE_MAKEFILES?= . -INCLUDES= doc.mk tex.mk miun.depend.mk miun.pub.mk +.PHONY: print +print: ${DOCUMENTS:.pdf=.ps} -define inc -ifeq ($(findstring $(1),${MAKEFILE_LIST}),) -$(1): - wget https://raw.githubusercontent.com/dbosk/makefiles/master/$(1) -include ${INCLUDE_MAKEFILES}/$(1) +.PHONY: clean-docs +clean-docs: +ifneq (${DOCUMENTS},) + ${RM} ${DOCUMENTS} endif -endef -$(foreach i,${INCLUDES},$(eval $(call inc,$i))) -### END INCLUDES ### +.PHONY: clean +clean: clean-docs -endif +.PHONY: todo +todo: $(wildcard *) + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/miun.tex.mk +include ${INCLUDE_MAKEFILES}/miun.pub.mk + +endif # MIUN_DOCS_MK diff --git a/miun.export.mk b/miun.export.mk new file mode 100644 index 0000000..657a2a2 --- /dev/null +++ b/miun.export.mk @@ -0,0 +1,13 @@ +ifndef MIUN_EXPORT_MK +MIUN_EXPORT_MK=true + +TRANSFORM_SRC= .tex +TRANSFORM_DST= .exporttex + +TRANSFORM_LIST.exporttex= NoSolutions +TRANSFORM_LIST-Makefile.export= OldExportFilter ExportFilter + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/transform.mk + +endif # MIUN_EXPORT_MK diff --git a/miun.package.mk b/miun.package.mk new file mode 100644 index 0000000..8ebe33a --- /dev/null +++ b/miun.package.mk @@ -0,0 +1,21 @@ +ifndef MIUN_PACKAGE_MK +MIUN_PACKAGE_MK=true + +ifdef TARBALL_NAME +PKG_TARBALL?=${TARBALL_NAME}.tar.gz +endif + +ifdef DOCS_FILES +PKG_PACKAGES= main docs + +PKG_INSTALL_FILES-docs?=${DOCS_FILES} +PKG_INSTALL_DIR-docs?=${DOCSDIR} +endif + +.PHONY: all +all: package + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/pkg.mk + +endif # MIUN_PACKAGE_MK diff --git a/miun.pub.mk b/miun.pub.mk index 92112a0..2d4324e 100644 --- a/miun.pub.mk +++ b/miun.pub.mk @@ -1,39 +1,21 @@ -# $Id$ -# Author: Daniel Bosk - ifndef MIUN_PUB_MK MIUN_PUB_MK=true -SERVER?= ver.miun.se -PUBDIR?= /srv/web +SERVER?= ver.miun.se +PUBDIR?= /srv/web/svn CATEGORY?= -TMPDIR?= /var/tmp - -SSH_USER?= ${USER} -PUBGROUP?= svn - -PUB_METHOD-main?= ssh -PUB_SERVER-main?= ${SERVER} -PUB_DIR-main?= ${PUBDIR} -PUB_CATEGORY-main?= ${CATEGORY} -PUB_FILES-main?= ${PUB_FILES} -PUB_TMPDIR-main?= ${TMPDIR} -PUB_GROUP-main?= svn +TMPDIR?= /var/tmp +PUB_GROUP?= svn -### INCLUDES ### - -INCLUDE_MAKEFILES?= . -INCLUDES= depend.mk pub.mk +ifdef NO_COMMIT +PUB_AUTOCOMMIT?=${NO_COMMIT} +endif -define inc -ifeq ($(findstring $(1),${MAKEFILE_LIST}),) -$(1): - wget https://raw.githubusercontent.com/dbosk/makefiles/master/$(1) -include ${INCLUDE_MAKEFILES}/$(1) +ifdef COMMIT_OPTS +PUB_COMMIT_OPTS?=${COMMIT_OPTS} endif -endef -$(foreach i,${INCLUDES},$(eval $(call inc,$i))) -### END INCLUDES ### +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/pub.mk -endif +endif # MIUN_PUB_MK diff --git a/miun.results.mk b/miun.results.mk new file mode 100644 index 0000000..d73a81e --- /dev/null +++ b/miun.results.mk @@ -0,0 +1,27 @@ +ifndef MIUN_RESULTS_MK +MIUN_RESULTS_MK=true + +in?= ${COURSE}.txt +out?= reported.csv +report?= new_results.pdf + +RESULTS_COURSE?= ${COURSE} +RESULTS_EMAIL?= ${EXPADDR} + +MAILER?= thunderbird -compose \ + "to=${EXPADDR},subject='resultat ${COURSE}',attachment='file://${report}'" +RESULTS_MAILER?= ${MAILER} + +REWRITES?= "s/Godkänd(G)/G/g" "s/Underkänd(U)/U/g" "s/Komplettering(Fx)/Fx/g" +RESULTS_REWRITES?=${REWRITES} + +FAILED?= -\|Fx\?\|U +RESULTS_FAILED?= ${FAILED} + +FAILED_regex= " \(${FAILED}\)\( .*\)*$$" +RESULTS_FAILED_regex?=${FAILED_regex} + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/results.mk + +endif # MIUN_RESULTS_MK diff --git a/miun.subdir.mk b/miun.subdir.mk new file mode 100644 index 0000000..58e0c21 --- /dev/null +++ b/miun.subdir.mk @@ -0,0 +1,7 @@ +ifndef MIUN_SUBDIR_MK +MIUN_SUBDIR_MK=true + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/subdir.mk + +endif # MIUN_SUBDIR_MK diff --git a/miun.tex.mk b/miun.tex.mk new file mode 100644 index 0000000..cc862fb --- /dev/null +++ b/miun.tex.mk @@ -0,0 +1,45 @@ +ifndef MIUN_TEX_MK +MIUN_TEX_MK=true + +TEX_OUTDIR?= . + +TEXMF?= ${HOME}/texmf + +ifneq (${USE_LATEXMK},yes) +LATEX?= latex +PDFLATEX?= pdflatex +endif + +ifneq (${USE_BIBLATEX},yes) +TEX_BBL= yes +endif + +solutions?= no +handout?= no + +TRANSFORM_SRC= .tex + +ifeq (${solutions},yes) +TRANSFORM_DST+= .solutions.tex +TRANSFORM_LIST.solutions.tex=PrintAnswers + +%.pdf: %.solutions.pdf + ${LN} $< $@ +endif + +ifeq (${handout},yes) +TRANSFORM_DST+= .handout.tex +TRANSFORM_LIST.handout.tex=Handout + +%.pdf: %.handout.pdf + ${LN} $< $@ +endif + +.PHONY: all +all: ${DOCUMENTS} + +INCLUDE_MAKEFILES?=. +include ${INCLUDE_MAKEFILES}/tex.mk +include ${INCLUDE_MAKEFILES}/transform.mk + +endif # MIUN_TEX_MK diff --git a/subdir.mk b/subdir.mk index 2c6c54e..3d27be0 100644 --- a/subdir.mk +++ b/subdir.mk @@ -1,9 +1,12 @@ ifndef SUBDIR_MK SUBDIR_MK=true +INCLUDE_MAKEFILES?=. + ifdef SUBDIR -${SUBDIR}:: - ${MAKE} -C $@ ${MAKECMDGOALS} +.PHONY: ${SUBDIR} +${SUBDIR}: + ${MAKE} -C $@ -I ${INCLUDE_MAKEFILES} ${MAKECMDGOALS} endif SUBDIR_ALL?=yes diff --git a/subdir.mk.nw b/subdir.mk.nw index 1559685..cce187d 100644 --- a/subdir.mk.nw +++ b/subdir.mk.nw @@ -26,6 +26,8 @@ containing the space-separated list of subdirectories, exists. ifndef SUBDIR_MK SUBDIR_MK=true +INCLUDE_MAKEFILES?=. + ifdef SUBDIR <> endif @@ -45,9 +47,14 @@ the targets specified on the command-line, in all subdirectories listed in For each directory, we specify a recipe which runs make in the subdirectory with the goals specified on the command-line. <>= -${SUBDIR}:: - ${MAKE} -C $@ ${MAKECMDGOALS} -@ +.PHONY: ${SUBDIR} +${SUBDIR}: + ${MAKE} -C $@ -I ${INCLUDE_MAKEFILES} ${MAKECMDGOALS} +@ We also want to give the sub-make access to our [[INCLUDE_MAKEFILES]], hence +the [[-I]] option. +This is mostly due to (backwards) compatibility with the MIUN versions (see +\cref{miun.compat.mk}) of the makefiles, which pre-dates the +[[INCLUDE_MAKEFILES]] construction. To ensure these recipes are run we need to ensure that they are prerequisites to the goals.