From: Uwe Koloska <uwe.koloska@mailbox.tu-dresden.de>
Subject: Re: make files
Date: Sat, 9 Jun 2001 11:34:34 +0200 [thread overview]
Message-ID: <01060911343402.26539@bilbo> (raw)
In-Reply-To: <3.0.6.32.20010608103147.00a3a3d0@server-1>
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 <TAB> ist needed before the command(s). That is general make syntax
(all makes on all plattforms).
Without the <TAB> 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 ;-)
next prev parent reply other threads:[~2001-06-09 9:34 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-08 8:31 Hans Hagen
2001-06-08 8:53 ` Marc van Dongen
2001-06-08 9:00 ` Gilbert van den Dobbelsteen
2001-06-08 9:25 ` Taco Hoekwater
2001-06-08 9:38 ` Marc van Dongen
[not found] ` <Pine.LNX.4.30.0106081058490.20802-100000@panter.soci.aau.d k>
2001-06-08 9:36 ` Hans Hagen
2001-06-08 9:56 ` Marc van Dongen
2001-06-09 9:35 ` David Antos
2001-06-10 20:20 ` Hans Hagen
2001-06-11 5:53 ` Gilbert van den Dobbelsteen
2001-06-11 11:12 ` Marc van Dongen
2001-06-08 17:25 ` Berend de Boer
2001-06-09 9:34 ` Uwe Koloska [this message]
2001-06-10 20:10 ` Hans Hagen
2001-06-11 7:21 ` Berend de Boer
2001-06-11 11:09 ` Marc van Dongen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=01060911343402.26539@bilbo \
--to=uwe.koloska@mailbox.tu-dresden.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).