See C:\> for /help for the gory details
I had googled up some references to "for /f", but decided I didn't really want to go down the path of invoking a batch script. (My batch programming skills are very close to non-existent.)
Besides, is it
really possible to write a batch script that will do the job of running "gcc -o file.exe file.c args" where args is the concatenation of ccopts() and ldopts(), and cannot be hard coded into the batch script ?
Of course, invoking a script to perform the task is not such a bad idea - but I think I'll make it a script that's at least readable:
use strict;
use warnings;
die "Usage: 'perl compile_it.pl filename'"
unless @ARGV == 1;
my $args = `perl -MExtUtils::Embed -e "ccopts"`;
chomp $args;
$args .= `perl -MExtUtils::Embed -e "ldopts"`;
chomp $args;
system "gcc", "-o", "$ARGV[0].exe", "$ARGV[0].c", $args;
Thanks holli.
Cheers,
Rob
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.