From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/4807 Path: main.gmane.org!not-for-mail From: Uwe Koloska Newsgroups: gmane.comp.tex.context Subject: Re: make files Date: Sat, 9 Jun 2001 11:34:34 +0200 Sender: owner-ntg-context@let.uu.nl Message-ID: <01060911343402.26539@bilbo> References: <3.0.6.32.20010608103147.00a3a3d0@server-1> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1035395447 28904 80.91.224.250 (23 Oct 2002 17:50:47 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 17:50:47 +0000 (UTC) Original-To: ntg-context@ntg.nl In-Reply-To: <3.0.6.32.20010608103147.00a3a3d0@server-1> Xref: main.gmane.org gmane.comp.tex.context:4807 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:4807 Hi Hans, Am Freitag, 8. Juni 2001 10:31 hast du geschrieben: > Hi, > > Say that i want to process a couple of files, how does a make file look? > With: > > tex : blabla.tex > texexec --pdf blabla Here a ist needed before the command(s). That is general make syntax (all makes on all plattforms). Without the there is no command to make target "tex" and thus the make prompted out: > and > > make tex > > i get 'no rule to make target' so i miss a point there, To write a proper makefile is rocket science -- if you want to deserve special purposes. But if you have only simple needs the following introduction should be enough. A makefile can have arbitrary names, but make considers the following filenames without explicitly naming it on the make commandline (in this order): GNUmakefile (only GNU make) makefile Makefile A simple make rule have a - target that is to be build - some prerequisites that the target depend on - some commands that are used to build the target So what your rule from above really means: Hey make, build me target "tex", check it's dependencies from blabla.tex and execute the command "texexec --pdf blabla". What you really wanted is: blabla.pdf: blabla.tex [TAB] texexec --pdf blabla [TAB] any other command Now, what does it mean: check the dependencies of the target? Simply said, make looks wether one of the dependencies (or prerequisites as the make manual names them) is newer than the target. So, if you modified the source blabla.tex it will be rebuild. If you haven't change anything the target is current and make doesn't need to do anything. If your main source blabla.tex includes other files (pictures, environments, etc.) you can name them all as dependencies and make check's wether something has changed. It's in a way comparable to texexec that calls all necessary commands to make all pictures, indices and such current. sidestep: maybe it is possible to replace texexec with make (e.g. for platforms where perl isn't available But there is more make does for dependencies. For every prerequisite make checks wether that is current, too. Say, you don't use context (boo ...) and want to include an eps picture build from metapost. The following make rules will do that: picture.eps: picture.mp mp picture.mp blabla.pdf: blabla.tex picture.eps texexec --pdf blabla The first rule inside a makefile will be processed by default so if you exchange the above rules a simple make will build blabla.pdf. Two other important things you want to know about make will close this short introduction: if a target is not a real file and the commands should be always started or the dependencies allways taken as unsatisfied, you can make a special rule that name all such targets: .PHONY: all clean all: blabla.pdf clean: rm blabla.pdf this is necessary if there accidentally is a file called clean because the rule clean has no dependencies and thus is always considered up to date (there is no dependency that is newer than clean) and so the command will not be executed. The last thing to know is about variables. I cite a part from the make manual ("info make" on unix): CC = gcc objects = program.o foo.o utils.o program : $(objects) $(CC) -o program $(objects) $(objects) : defs.h It is a good idea to look into the GNU make manual. It is well written and has many examples. I hope this short introduction helps you (and possibly others) to write nice makefiles to produce good looking context documents ;-) Uwe -- mailto:koloska@rcs.urz.tu-dresden.de http://rcswww.urz.tu-dresden.de/~koloska/ -- -- right now the web page is in german only but this will change as time goes by ;-)