bugmake - Bugs: bug #32493, new function to output information...

 
 

bug #32493: new function to output information to file. kind of extension of $(info) function, but outputs to file

Submitted by:  Olexiy Buyanskyy <olexiyb>
Submitted on:  Tue 15 Feb 2011 01:15:01 PM UTC  
 
Severity: 3 - NormalItem Group: Enhancement
Status: DuplicatePrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 3.82Operating System: Any
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 29 Jan 2012 06:15:36 PM UTC, comment #1:

See bug #35147

Paul D. Smith <psmith>
Project Administrator
Tue 15 Feb 2011 01:15:01 PM UTC, original submission:

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.

Olexiy Buyanskyy <olexiyb>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by psmith (Posted a comment)
  • -unavailable- added by olexiyb (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 29 Jan 2012 06:15:36 PM UTCpsmithStatusNone=>Duplicate
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1