simple makefile help

simple makefile help

am 16.04.2008 20:41:20 von Billy Patton

I don't write enough makefile to be fluent, but know what sone of what
can be done.
I have a cadence directory that has over 5K directories. Within each
directory there is a file 'layout' that is the focus of this make
file.
I need to have a gds file in one directory that is dependent on the
layout file in another so that when the layout is newer, the rule will
do a conversion.
So here's what I have done:
__BEGIN__
TECHNOLOGY := c014
PROCESS := C014.M
DROP_ZONE := /data/phy_ver10/DROP_ZONE/${TECHNOLOGY}/${PROCESS}/drc
CADENCEDB := /data/phy_ver10/regressionData/${TECHNOLOGY}/${PROCESS}/
REGRESSION
FILES := ${wildcard ${CADENCEDB}/RULE_*}
all : files

file : ${addsuffix .gds,${FILES}}

%.gds :
@echo $*
__END__

I get argument list too long.
The names in ${FILE} have CADENCEDB in each
I've tried patsubstr to remove CADENCEDB, that seemed to delete
everything.

What I'm after would be something like

${CADENCEDB}/%/layout : ${DROP_ZONE}/%.gds
convert ${CADENCEDB}/%/layout to ${DROP_ZONE}/%.gds

Re: simple makefile help

am 16.04.2008 20:53:40 von Hans-Peter Sauer

On Wed, 16 Apr 2008 11:41:20 -0700, bpatton wrote:

> I don't write enough makefile to be fluent, but know what sone of what
> can be done.

comp.compilers might be a better venue for your question?

Re: simple makefile help

am 17.04.2008 04:20:16 von Icarus Sparry

On Wed, 16 Apr 2008 11:41:20 -0700, bpatton wrote:

> I don't write enough makefile to be fluent, but know what sone of what
> can be done.
> I have a cadence directory that has over 5K directories. Within each
> directory there is a file 'layout' that is the focus of this make file.
> I need to have a gds file in one directory that is dependent on the
> layout file in another so that when the layout is newer, the rule will
> do a conversion.
> So here's what I have done:
> __BEGIN__
> TECHNOLOGY := c014
> PROCESS := C014.M
> DROP_ZONE := /data/phy_ver10/DROP_ZONE/${TECHNOLOGY}/${PROCESS}/drc
> CADENCEDB := /data/phy_ver10/regressionData/${TECHNOLOGY}/${PROCESS}/
> REGRESSION
> FILES := ${wildcard ${CADENCEDB}/RULE_*}
> all : files
>
> file : ${addsuffix .gds,${FILES}}
>
> %.gds :
> @echo $*
> __END__
>
> I get argument list too long.

This is a problem that "make" could offer you some help in avoiding. You
don't say which version of "make" you are using, but it looks as if it
might be GNUMake. However what you have posted would not produce the
result you claim. It would probably have just reported "No rule to make
target 'files' needed by 'all'".

> The names in ${FILE} have CADENCEDB in each I've tried patsubstr to
> remove CADENCEDB, that seemed to delete everything.
>
> What I'm after would be something like
>
> ${CADENCEDB}/%/layout : ${DROP_ZONE}/%.gds
> convert ${CADENCEDB}/%/layout to ${DROP_ZONE}/%.gds

You seem to have the terms reversed, and you should almost always
formulate your rules in terms of "$@" "$<" and "$^".

${DROP_ZONE}/%.gds : ${CADENCEDB}/%/layout
convert $< to $@

Can you post (or email, the address in the header is valid) your actual
Makefile? Also the version of make you are using, and an indication if
you would be prepared to change version or even program if it would solve
your problem.

Re: simple makefile help

am 17.04.2008 07:41:52 von Dan Stromberg

On Wed, 16 Apr 2008 11:41:20 -0700, bpatton wrote:

> I don't write enough makefile to be fluent, but know what sone of what
> can be done.
> I have a cadence directory that has over 5K directories. Within each
> directory there is a file 'layout' that is the focus of this make file.
> I need to have a gds file in one directory that is dependent on the
> layout file in another so that when the layout is newer, the rule will
> do a conversion.
> So here's what I have done:
> __BEGIN__
> TECHNOLOGY := c014
> PROCESS := C014.M
> DROP_ZONE := /data/phy_ver10/DROP_ZONE/${TECHNOLOGY}/${PROCESS}/drc
> CADENCEDB := /data/phy_ver10/regressionData/${TECHNOLOGY}/${PROCESS}/
> REGRESSION
> FILES := ${wildcard ${CADENCEDB}/RULE_*} all : files
>
> file : ${addsuffix .gds,${FILES}}
>
> %.gds :
> @echo $*
> __END__
>
> I get argument list too long.
> The names in ${FILE} have CADENCEDB in each I've tried patsubstr to
> remove CADENCEDB, that seemed to delete everything.
>
> What I'm after would be something like
>
> ${CADENCEDB}/%/layout : ${DROP_ZONE}/%.gds convert
> ${CADENCEDB}/%/layout to ${DROP_ZONE}/%.gds

I'm not a make expert either, though I have written quite a number of
simple Makefile's.

But I'm not sure that pure make is what you need, despite make's actions
being miniature shell scripts.

If you really want to stick with make, you may want to automatically
generate a Makefile with one rule for each "%", perhaps using ls -f,
"while read" and printf.

But at that point, you almost may as well use some language that has a
stat function and forget about make. Some *ix's have a "stat" command
(as opposed to the stat() function I believe they all have), and I've
used the os.stat() functionality in python a lot. Probably nearly all
systems-programming-oriented *ix scripting languages have a stat() of
some kind that you could base such a script on.

I'm not sure comp.compilers is really the right place for this question.
make's not really a compiler, and comp.compilers is more about -writing-
compilers, than about using them.

There might be a GNU make mailing list, or gnu.misc.discuss or
something... if you really want to do this with pure make (aside from the
miniature shell scripts that form the actions in make's pattern-action
pairings).