9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Andy Spencer <andy753421@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] `mk` (from Plan9 ports) efficiency related issue
Date: Tue, 18 Jan 2011 06:09:30 +0000	[thread overview]
Message-ID: <20110118060930.GA1290@c.hsd1.tn.comcast.net> (raw)
In-Reply-To: <AANLkTimia=9=+F=uDXna8bZ=WuwssJTX8x8KsvZVv4pj@mail.gmail.com>

On 2011-01-17 19:31, Ciprian Dorin Craciun wrote:
>     * not all files of the same type are built by using the same rule;
> (for example for some files I want to enable debugging, for others
> not); thus I don't see how a meta-rule would solve this problem;
> (unless I create separate `mk` files or I resort to filename tags --
> for example I would call `*.debug.c` all C files that I want to be

Use a variable:

a_cflags=-g -Da
b_cflags=-g -Db
test: test.o a.o b.o
	gcc -o $target $prereq
%.o: %.c
	gcc $($stem^_cflags) -c -o $target $stem.c

Or only filename-tag the object files:

test: test.o a-debug.o b-opt.o c-prof.o
%.o: %.c
	gcc -c -o $target $prereq
%-opt.o: %.c
	gcc -O -c -o $target $prereq
%-debug.o: %.c
	gcc -g -c -o $target $prereq
%-prof.o: %.c
	gcc -p -c -o $target $prereq


>     * second, each file has a unique dependency graph -- for example
> one `*.c` file might include other headers than another `*.c` file in
> the same project; thus when updating a single header I want to be able
> to build only those `*.c` files that actually depend on it; (this
> observation is less important for C applications, but for other type
> of programs -- like Java -- this fine grained dependency tracking
> means a lot of saved computing power);

Have you looked at cpp -M? Many cpps will generate make style
dependencies for you, I think they'll work with mk as well. You can
include them and the use meta rules for all the real work.

It's still a large list of dependencies though, so it might not help you
in this case. I'm no sure if erlang has somethings similar or not.


>     * third, in my brief experience with make files, meta-rules are
> quite hard to get right... furthermore it is impossible to have two
> patterns like: `%.%.x`; just imagine I have two types of images:
> background and foreground and I want to superimpose them, then I would
> like to be able to write `%{foreground}.%{background}.jpg :
> %{foreground}.jpg %{background}.jpg ..."; (I know that I can resort
> here to "<| generating command" but it seems just plain wrong...)

Mk's meta rules are much easier to get right because they don't get
messed up by all of GNU Make's automatically added meta rules. Also:

default:V: circle-square.png

(.*)-(.*).png:R: \1.png \2.png
	composite $prereq $target

P.S. anyone know a better way to composite images using the
plan9/plan9port image tools?



  parent reply	other threads:[~2011-01-18  6:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-17 14:47 Ciprian Dorin Craciun
2011-01-17 14:59 ` erik quanstrom
2011-01-17 15:05   ` Ciprian Dorin Craciun
2011-01-17 16:50     ` Bakul Shah
2011-01-17 16:56       ` erik quanstrom
2011-01-17 18:36         ` Bakul Shah
2011-01-17 19:33           ` Ciprian Dorin Craciun
2011-01-17 19:59           ` Ciprian Dorin Craciun
2011-01-17 20:30             ` Bakul Shah
2011-01-17 15:00 ` Robert Raschke
2011-01-17 15:02   ` Robert Raschke
2011-01-17 15:18     ` erik quanstrom
2011-01-17 15:33   ` Ciprian Dorin Craciun
2011-01-17 15:51     ` Federico G. Benavento
2011-01-17 15:53     ` Robert Raschke
2011-01-17 16:02       ` andrey mirtchovski
2011-01-17 16:45         ` Ciprian Dorin Craciun
2011-01-17 17:31       ` Ciprian Dorin Craciun
2011-01-17 17:46         ` Federico G. Benavento
2011-01-17 17:51           ` Federico G. Benavento
2011-01-18  6:09         ` Andy Spencer [this message]
2011-01-18 13:26           ` erik quanstrom
2011-01-17 15:21 ` Ciprian Dorin Craciun

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=20110118060930.GA1290@c.hsd1.tn.comcast.net \
    --to=andy753421@gmail.com \
    --cc=9fans@9fans.net \
    /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).