help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help-make Digest, Vol 80, Issue 6


From: xiangfeng shen
Subject: Re: Help-make Digest, Vol 80, Issue 6
Date: Wed, 8 Jul 2009 10:28:25 +0800

Hi,
 
I encounter a use of 'set -e' in make file shell.
such as:
all:
    set -e; cmd1; cmd2; cmd3
 
Does the 'set -e' means open error for cmd chain?
And does the above rule similiar with next one?
all:
    cmd1 && cmd2 && cmd3
 
Best Regards.
carl shen

2009/7/8 <address@hidden>
Send Help-make mailing list submissions to
       address@hidden

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.gnu.org/mailman/listinfo/help-make
or, via email, send a message with subject or body 'help' to
       address@hidden

You can reach the person managing the list at
       address@hidden

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Help-make digest..."


Today's Topics:

  1. Re: Auto-checkout a file from RCS that is used to construct a
     prerequisites list (Richard Bassett)


----------------------------------------------------------------------

Message: 1
Date: Mon, 06 Jul 2009 21:13:53 +0200
From: Richard Bassett <address@hidden>
Subject: Re: Auto-checkout a file from RCS that is used to construct a
       prerequisites list
To: Philip Guenther <address@hidden>
Cc: address@hidden
Message-ID: <address@hidden>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

For the record, I've managed to resolve this problem with some input
from CHEN Cheng that I don't think was CCed to help-make.  He suggested
creating a rule such that Makefile itself depends on the _WITHTAB.PP
files that I need to be available in order to construct other dependencies.

This seems to work because the rule for Makefile itself causes the
_WITHTAB.PP files to be retrieved from RCS and, provided the rule also
touches Makefile itself, causes make to 'restart' and thus re-evaluate
all the other dependency rules and incorporate any information contained
in the _WITHTAB.PP files that are now available.

However, it was still necessary to make the $(shell cat ..) calls in
those other dependency rules smart enough not to generate a 'missing
file' error initially when the files in question have yet to be fetched
from RCS.

So, this is what I ended up with (simplifying the actual situation
somewhat):

Makefile: msg/_WITHTAB.PP
   touch Makefile

$(msg_dsl_targets) : msg/_WITHTAB.PP $(patsubst %,$(target)%.tabo,$(subst $(comma),$(space),$(shell if [[ -e msg/_WITHTAB.PP ]] \; then cat msg/_WITHTAB.PP \; fi )))


I'd like to thank Philip for his input too, which was very instructive
even though I didn't need to go quite that far.

Richard

Philip Guenther wrote:
> On Thu, Jul 2, 2009 at 8:45 AM, Richard
> Bassett<address@hidden> wrote:
>
>> Background:  I'm bootstrapping a Domain-specific language and I'm trying to
>> automate a full build, where make checks all the required files out from
>> RCS.  My DSL has a simple preprocessor for textual substitution and
>> currently I allow a file named _WITHTAB.PP in a source subdirectory to
>> specify a list of 'preprocessor substitution tables' to apply to all the
>> sources in that subdirectory.
>>
>> This means that the targets produced from each source file in a directory
>> depend on any _WITHTAB.PP file in that directory and on the 'preprocessor
>> substitution tables to apply' that are listed in the _WITHTAB.PP file.
>>
>> So, I tried to handle that in my makefile like this:
>>
> ...
>
>>   $(msg_dsl_targets) : msg/_WITHTAB.PP $(patsubst
>>   %,$(target)%.tabo,$(subst $(comma),$(space),$(shell cat
>>   msg/_WITHTAB.PP)))
>>
>
> Hmm, you must have .SECONDEXPANSION: in play...
>
>
>
>> As is probably obvious, the _WITHTAB.PP file contains a commalist of simple
>> names such as  "STD,T1,T2" and I'm just transforming that into a
>> space-separated list of the prerequisite targets (that will be built from
>> the source 'substitution tables') such as "STD.tabo T1.tabo T2.tabo"
>>
>> This seems just fine in my development environment where the _WITHTAB.PP
>> file already exists.  My problem is that when I try and build in some other
>> 'clean' environment and I want make to fetch all the source from RCS
>> automatically, I get the following error:
>>
>>   cat: msg/_WITHTAB.PP: No such file or directory
>>
>>
>> Now, I *think* I understand this - I'm assuming that make wants to process
>> all the rules and construct its 'database' before actually taking any
>> actions such as fetching something from RCS.
>>
>> So, if I have understood correctly, my problem is that I somehow need to get
>> make to fetch the msg/_WITHTAB.PP file from RCS *before* constructing those
>> dependencies in which the file itself participates.. but I'm not quite clear
>> if that's possible or how one would go about it.
>>
>> I can see that what I'm doing is conceptually similar to include-ing another
>> makefile except that my _WITHTAB.PP file is not in fact a makefile fragment.
>>  So I wonder if there's some trick possible with include maybe - but again I
>> can't quite see how to make it happen!
>>
>> I can also see there is an analogy with an #included C header file that
>> #includes other header files and that leads me to think that I could
>> manually maintain say a _WITHTAB.d file alongside each _WITHTAB.PP file -
>> ie. _WITHTAB.d would be an includeable makefile fragment that just expressed
>> the dependency of _WITHTAB.PP on the items listed therein.
>>
>> But then I'd have to maintain two files, sacrilege.
>>
>
> Well, there's always the alternate heresy of fixing the program that
> generates _WITHTAB.PP to write "TABS=" at the start of it.  Then you
> could include it directly and use ${TABS} where needed.  Problem
> solved.
>
>
> Otherwise, if you need something more complex...
>
> It sounds like you need some tool that you could tell how to build
> _WITHTAB.d from _WITHTAB.PP and that that only needed to be done if
> the latter was newer than the former.  Have you considered using
> 'make' for that?
>
> _WITHTAB.d: _WITHTAB.PP
>         sed -e 's/^/TABS=/' -e 's/,/ /g' -e 1q <_WITHTAB.PP >$@
> -include _WITHTAB.d
>
>
> Philip Guenther
>
>




------------------------------

_______________________________________________
Help-make mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make


End of Help-make Digest, Vol 80, Issue 6
****************************************


reply via email to

[Prev in Thread] Current Thread [Next in Thread]