[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #32493] new function to output information to file. kind of extensi
From: |
Olexiy Buyanskyy |
Subject: |
[bug #32493] new function to output information to file. kind of extension of $(info) function, but outputs to file |
Date: |
Tue, 15 Feb 2011 13:15:01 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13 |
URL:
<http://savannah.gnu.org/bugs/?32493>
Summary: new function to output information to file. kind of
extension of $(info) function, but outputs to file
Project: make
Submitted by: olexiyb
Submitted on: Tue 15 Feb 2011 01:15:01 PM GMT
Severity: 3 - Normal
Item Group: Enhancement
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: 3.82
Operating System: Any
Fixed Release: None
Triage Status: None
_______________________________________________________
Details:
Hi,
We have real performance issue related to shell command line limitation. By
design we need to output list of targets to file to prepare tar file. The list
can be very long. I have used recommended approach to split list to multiple
pieces and call $(shell $(part)). But too many shell invocations completely
kills performance of this operation. I propose to have some new function to
output any information to file in function.c
/**
* Output information to file.
* argv - file name
* argv + 1 - can be w,a, see fopen
* argv + 2,... - message to output to file
*/
static char * func_file(char *o, char **argv, const char *funcname) {
char **argvp;
int len = 0;
FILE * pFile = fopen(*argv,*(argv+1));
if (pFile != 0) {
for (argvp = argv+2; *argvp != 0; ++argvp) {
char * param = *argvp;
replace_all(param,"\\n","\n");
replace_all(param,"\\t","\t");
/* need to put more here */
len += strlen(param) + 2;
fputs(param,pFile);
}
fclose(pFile);
} else {
error(reading_file, _("Could not open file: `%s`"), *argv);
}
return o;
}
After this patch operation to output looks like
$(file $(outputfile),w,$(patsubst %,%\n,$@))
You can even append to existing file
$(file $(outputfile),a,$(patsubst %,%\n,$@))
Now instead of minutes! it takes less then a second to output 10000 build
targets to the file.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?32493>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [bug #32493] new function to output information to file. kind of extension of $(info) function, but outputs to file,
Olexiy Buyanskyy <=