Re: [cc65] Please critique this makefile

From: <silverdr1wfmh.org.pl>
Date: 2010-04-25 22:01:15
On 2010-04-25, at 00:26, Oliver Schmidt wrote:

>> Cygwin uses GNU Sed;
>> it knows that "\t" means TAB.  But apparently, the Sed program on
>> silverdr's machine doesn't know it.

It is a BSD sed, which doesn't present itself as GNU. Surely I could  
install GNU sed but until now I didn't have to ;-)

>> ( http://www.grymoire.com/Unix/Sed.html says that "\t" started its  
>> life
>> as a "PERL Regular Expression" extension.)
>
> Okay...
>
>> Therefore, that command must be alterred:
>>        @sed -e"s!$(<:c=s)!$@!p" -e"s![^:]*:.\(.*\)!\1:!" < $(<:c=u) \
>>        > $(@:o=d)
>
> Thanks :-) Two remarks
>
> 1. The non-fluent sed readers might be interested to know that the
> code above reads up to the ':' (known to just preceed the tab) and
> than a single char whatever it may be.
>
> 2. While $(<:c=s) (and the other two substitution references)
> certainly works I intentionally prefer including the '.'  like this
> $(<:.c=.s) as it nicely resembles the file name extensions in the rule

Yes - I like it better to. It much more easily tells the reader what  
are we dealing with.

Now - with the line:

@sed -e"s!$(<:.c=.s)!$@!p" -e"s![^:]*:.\(.*\)!\1:!" < $(<:.c=.u) > $ 
(@:.o=.d)

I get what is expected:

obj/main.o:	src/main.c /usr/local/lib/cc65/include/stdio.h /usr/local/ 
lib/cc65/include/stddef.h /usr/local/lib/cc65/include/stdarg.h
src/main.c /usr/local/lib/cc65/include/stdio.h /usr/local/lib/cc65/ 
include/stddef.h /usr/local/lib/cc65/include/stdarg.h:

:-)

-- 
SD!
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Apr 25 22:01:25 2010

This archive was generated by hypermail 2.1.8 : 2010-04-25 22:01:27 CEST