General and specific make questions

Roland Smith rsmith at xs4all.nl
Mon Jun 8 20:12:21 UTC 2009


On Sun, Jun 07, 2009 at 11:52:17PM -0500, Lars Eighner wrote:
> 
> What I need most is to find (a) make tutorial(s) that do not suppose make is
> being used for compling c/c++ programs.  Yes, I know, that is mostly why
> make exists, but many tutorials plunge right into C examples with implicit C
> rules, while -- it seems to me -- make could be much more useful for a
> variety of things, and I could sure use more of the general and arbitrary
> examples.

I use make to e.g. build complex LaTeX documents with included gnuplot
graphs. Works like a charm. But that it is not conceptually different
from compiling a C program.
 
> I have some sources which may or may not exist.  My target should be rebuilt
> if a source exists that is younger than the target.  But sources that do
> not exist should be ignored and make should not be perplexed over how to
> create them.  How do I express that kind of relationship?

I use the following to create PDFs from gnuplot files without
enumerating them beforehand. Maybe that is what you're looking for?

----- Makefile fragment -----
# See SPECIAL TARGETS in make(1)
.PHONY: all clean
.SUFFIXES: .eps .pdf .gp .d

# See VARIABLE ASSIGNMENTS in make(1)
GP!=ls *.gp|sed -e 's/\.gp/\.pdf/g'

all: ${GP}

# Suffix-transformation rule. See chapter 3 in the PMake tutorial 
# (/usr/share/doc/psd/12.make/paper.ascii.gz)
.gp.pdf: 
	gnuplot $*.gp 2>&-
	epstopdf $*.eps
	rm -f $*.eps *.log

clean:
	rm -f *.log *.pdf *.eps
----- Makefile fragment -----

Roland
-- 
R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090608/06d7eed3/attachment.pgp


More information about the freebsd-questions mailing list