Thanks for your comments...

We've now gone live with the following changes:

    static int xargs_file_count = 0;

    static char *
    func_xargs(o, argv, funcname)
            char *o;
            char **argv;
            const char* funcname;
    {
        char filename[256];
        FILE* fd;
        char* rm_str;
        char* xargs_str;

        sprintf (filename, "/tmp/gnumake.%d.%d.xargs", getpid(), xargs_file_count++);
        fd = fopen(filename, "w");
        fprintf(fd, "%s\n", argv[1]);
        fclose(fd);

        xargs_str = o;
        o = reference_variable(o, "XARGS", 5);
        if (o == xargs_str)
          o = variable_buffer_output(o, "xargs", 5);

        o = variable_buffer_output(o, " ", 1);
        o = variable_buffer_output(o, argv[0], strlen(argv[0]));
        o = variable_buffer_output(o, " < ", 3);
        o = variable_buffer_output(o, filename, strlen(filename));
        o = variable_buffer_output(o, "; ", 2);

        rm_str = o;
        o = reference_variable(o, "RM", 2);
        if (o == rm_str)
          o = variable_buffer_output(o, "rm -f", 5);

        o = variable_buffer_output(o, " ", 1);
        o = variable_buffer_output(o, filename, strlen(filename));

        return o;
    }

Note that I changed this to use $(XARGS) and $(RM), and "<" instead of 'cat'.

Initially I tried stuffing in $(XARGS) and $(RM), but found that the function
string is not recursively expanded.  So, I had to expose the
'reference_variable' function in variable.c to get the expansions.

Perhaps you can suggest cleanups to this code.  If so I'll integrate them.

So, you guys up to adding this in the next release?  Or will I always have to
go back and hack it in myself?

Reid


-- 
Reid Madsen                             [EMAIL PROTECTED]                      
Senior Member, Tech. Staff              (972) 536-3261 (Desk)
I2 Technologies                         (214) 850-9613 (Cellular)
--
Making incrementally (without 'clean') since May 18, 2000.
Long live incremental make!

_______________________________________________
Bug-make mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-make

Reply via email to