in reply to Parameters to make-invoked script

I can't find any method to pass variables to the Makefile other than by the environment, but

$ cat echo.pl #!/usr/bin/perl print("$ARGV[0]\n"); $ cat Makefile testing: echo.pl $(TEXT) > $@ $ TEXT=moo make testing echo.pl moo > testing $ cat testing moo

I feel this meets your needs. If not, let us know how it doesn't.

Replies are listed 'Best First'.
Re^2: Parameters to make-invoked script
by Sixtease (Friar) on Jul 23, 2008 at 09:07 UTC

    Thanks for the input!

    I use ExtUtils::MakeMaker, so messing with Makefile itself is something I'd like to avoid. If you think that env variables are something I can use to tweak the details of the build process without shame, then I'm very much satisfied. I'll simply take care of the environment variables in the script, that's no problem.

    Thank you once again.

    use strict; use warnings; print "Just Another Perl Hacker\n";
Re^2: Parameters to make-invoked script
by betterworld (Curate) on Jul 23, 2008 at 12:48 UTC
    echo.pl $(TEXT) > $@

    Note that you will have a really hard time making sure that there are no shell special characters in TEXT. Unfortunately, there is no such thing as system() with several arguments in make. I believe some make programs provide implementation-specific means for quoting strings. However, if you expect TEXT to have strange characters, you'd be better off using the environment.