Makefile issue

Ralf Corsepius ralf_corsepius at rtems.org
Fri Oct 1 10:14:53 UTC 2004


On Fri, 2004-10-01 at 11:38, James Yates wrote:
> I am building an application, linking it with a build of rtems. I list
> all of my source files in the makefile using:
> 
> C_PIECES= 	global uidata \
>             	dataproc setup 
> 
> C_FILES=$(C_PIECES:%=%.c)
> 
> 
> My makefile is based upon one of the standard contribution makefiles.
> When I want to build I run make VARIANT=debug.
> My code development is done under Windows XP, so I am using cygwin
> provide the environment for the builds to happen. I have a problem where
> some source files seem to get the Windows/Dos CR/LF line ends which I
> don't want to be present. I have added a rule to the makefile so that I
> can run dos2unix on the source files so that when I build, the line ends
> are adjusted to Unix style:
> 
> dos2unix:
> 	 d2u -U $(C_FILES)
> 
> So when I call make VARIANT=debug dos2unix, this is run with the source
> files passed. The problem I have is that at build, some source files are
> read-only. As soon as d2u encounters a file that is read-only it gives
> up and doesn't process the others in the list. Can anyone tell me the
> format I need to get this rule in the makefile to call d2u -U for every
> file rather than calling it once with all the files passed at once?
Well, ... there is no proper way to what you want with make, or at least
it would be of very doubtful wealth.

As far as permissions are concerned, the most simple work-around would
be:
chmod -R +w <sourcedir>

As far as dos textfiles are concerned:
find <sourcedir> -type f -exec dos2unix {} \;

>  Or
> can anyone point me in the direction of a different version of d2u that
> can cope with read-only files and ignore them?

IMO, you are playing with symptoms. The actual fix to issues like these
is to use editors which do not store unix-files in DOS mode.

IIRC, you also should mount the partition containing the sources binary,
otherwise some Cygwin text-utils will convert them to DOS-text-files.

Ralf





More information about the users mailing list