[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make with multiple variables for multiple targets.
From: |
John Graham-Cumming |
Subject: |
Re: Make with multiple variables for multiple targets. |
Date: |
Tue, 28 Dec 2004 14:40:35 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104 |
Bill Godfrey wrote:
Hello. I first raised this question on comp.programming. I was advised that
this group may be better placed. This article contains much of both posts
with some editing. If I may ask your collective assistance please?
[snip]
You could do something like this:
1. Rename your current Makefile to include-me.mak
2. The new top-level Makefile looks like this:
BUILD := foo
include include-me.mak
BUILD := bar
include include-me.mak
BUILD := baz
include include-me.mak
or if you want to get really fancy you could do
define INCLUDE_IT
BUILD := $1
include include-me.mak
endef
BUILDS := foo bar baz
$(foreach B,$(BUILDS),$(call INCLUDE_IT,$B))
You will have problems with globally defined variables like CFLAGS which
are not $(BUILD) specific, so you'll have to fix that in include-me.mak.
John.
--
John Graham-Cumming
jgc@jgc.org
Home: http://www.jgc.org/
Work: http://www.electric-cloud.com/
POPFile: http://getpopfile.org/