What are the rules regarding writing Makefiles to be part of CTAN packages?

I would like to include a Makefile in a package I wrote. The package is in .dtx format with its .ins file embedded.

When I run make, it generates all package files, including .tex examples. Of course it also compiles the documentation in PDF format.

When I run make all, it behaves the same way as make but also all .tex examples are compiled.

make clean removes all generated files except the .cls and the documentation. make distclean removes also these files.

1) There is a problem distributing a package with a Makefile` that behaves this way?

This Makefile includes UNIX syntax and UNIX commands, in particular I have shell variable pointed to /bin/sh, which is the default:

SHELL = /bin/sh

Also I do use for command to compile everything and grep and sed to extract the version number from .dtx file.

2) It is OK distributing the package with such a Makefile? MiKTeX users won't be able to compile anything. Or... are Makefiles always useless to Windows users?

3) How safe is using latexmk to compile everything? This Perl script is present on MiKTeX basic installation? I'm running Debian and I've it installed but I don't know if it is a common package on LaTeX distributions...

4) What is the best place to put makeindex lines (for change history and index)? in Makefile between two pdflatex (or latexmk...) runs or inside the .ins file?

If I let latexmk run makeindex, the resulting PDF has overlapped entries on index, and no change history appears (no .gls file is created), so I must put makeindex lines by hand on Makefile or inside the .dtx (inside it embedded .ins).

  • Why do you need to distribute the Makefile? It's common to send only the 'business end' to CTAN with the assumption that most people will get it via their TeX system (which have their own build scripts) or will download and build manually. – Joseph Wright Mar 23 '15 at 17:45
  • 1
    BTW, make is runnable on Windows but is non-standard, and I'd probably work on the basis that most people with make there have Cygwin or similar Unix-like' tools available. So for most 'end user' MiKTeX people the answer is 'no, not useful' (write an equivalent make.bat file if you want parallel features). – Joseph Wright Mar 23 '15 at 17:47
  • 1
    @EmilioLazo I don't think TeX distributions compile anything not provided by the CTAN upload. For simple uploads, I think they run tex on the ins file to extract from the dtx the package file; even if the dtx is structured so that running tex directly on it is possible and does the extraction. They do not recompile pdf documentation already in the upload. Furthermore if your submission has a package.tds.zip included, that's what (at least TeXLive) will take as is. At least in my experience, but others surely know more. – user4686 Mar 23 '15 at 20:29
  • 1
    @EmilioLazo I never investigated the issue of the ins as I always provide it, although all my dtx are self-extracting. Regarding the pdf I just checked for confirmation on two of my packages, and when opening the files in Adobe Reader and checking the creation date, it is exactly the same as the ones of my uploads (the file modification dates differ, thus I needed to open them in a pdf viewer to check the info fields). Thus, there was no re-compilation of the pdf. – user4686 Mar 24 '15 at 18:54
  • 1
    @EmilioLazo I agree that the rule of CTAN probably does not apply to ins files because in the old days there were (I think) no self-extracting dtx (I don't know who started the habit). Furthermore I pay attention to the fact that extraction is possible using tex, not pdftex which has the e-TeX extensions, the ins file should always be compilable with pure tex (the dtx also is for etoc). Regarding etoc, simultaneous bilingual would be a challenge because of all the table of contents of the doc itself which are generated on the fly. – user4686 Mar 24 '15 at 20:37

Your Answer


Browse other questions tagged or ask your own question.