[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: command line limitation
From: |
ma |
Subject: |
Re: command line limitation |
Date: |
Fri, 14 Jul 2006 10:45:54 +0100 |
"Maxim Yegorushkin" <address@hidden> wrote in message
news:address@hidden
> ma wrote:
>
>> I have a make file that is automatically generated. It that makefile,
>> I have a variable that is very long. It is around 88K long. When I am
>> trying to pass it to any function (ar for example), the operating system
>> complains that the command line is too long. The other way is to put this
>> variable in a text file and call ar in this way:
>>
>> ar @a.txt
>>
>> The problem is I don't know how I can write this variable into a file? I
>> can't use something such as echo $(Long_Var) >a.txt since then the
>> command line to echo is too long. Is there any way that I can do in
>> gmake? Is there any function in gmake that help to write a variable into
>> a file?
>
> You could output the variable word by word to a file:
>
> words = a b c d
> foo :
> @for w in $(words); do echo -n "$$w " >> $@; done
>
> And then feed the words from the file to ar as command line arguments
> using xarg utility.
Thanks Maxim,
It is a very nice trick.
I wrote a batch file as follow and it was working well:
for %%w in (a b c d); do echo "%%w" next word >>test.txt ;done
The only problem that I have is that it echoes put a new line after each
word. I don't know what is '-n' switch to echo as it doesn't work for me.
When I am trying to use it, a -n will be appear in my text.txt file before
each word.
I removed -n and add it to my make file. And change it a little and now it
is working.
the structure of make file is as follow:
lib_modul= a0001.obj a.0002.obj a.0003.obj ....# there are more than 1000
object in this line
lib: $(lib_module)
for %%w in ($(lin_module)); do echo %%w >>test.txt
If I remove a lot of entries from lib_module, it is working well but when
all entries are there, it doesn't work and the error is: input line is too
long
Any suggestion on how I can solve this?
Can I write the value of a make variable into a file without relaying on
shell functions?
Can I write a C program that does this?
Can I redirect a make variable to a dos file or command? For example can I
do something such as this?
$(lib_module) | copy con test.txt
In this way since copy get data from console, it shouldn't crash. I hope cmd
doesn't crash in this case!
Best regards