my $public_file = undef;
my $private_file = undef;
+my $all_file = undef;
my $public_define = undef;
my $private_define = undef;
my $_public = "";
my $_private = "";
my $public_data = \$_public;
my $private_data = \$_private;
-my $builddir = undef;
-my $srcdir = undef;
+my $builddir = ".";
+my $srcdir = ".";
sub public($)
{
GetOptions(
'public=s' => sub { my ($f,$v) = @_; $public_file = $v; },
+ 'all=s' => sub { my ($f,$v) = @_; $public_file = $v; $private_file = $v; },
'private=s' => sub { my ($f,$v) = @_; $private_file = $v; },
'define=s' => sub {
my ($f,$v) = @_;
sub file_load($)
{
- my($filename) = shift;
+ my($filename) = @_;
local(*INPUTFILE);
- open(INPUTFILE, $filename) || return undef;
+ open(INPUTFILE, $filename) or return undef;
my($saved_delim) = $/;
undef $/;
my($data) = <INPUTFILE>;
print_header(\&public, $public_define);
-if ($public_file ne $private_file) {
+if (defined($private_file) and defined($public_file) and $public_file ne $private_file) {
print_header(\&private, $private_define);
private("/* this file contains prototypes for functions that " .
process_file(\&public, \&private, $_) foreach (@ARGV);
print_footer(\&public, $public_define);
-if ($public_file ne $private_file) {
+if (defined($private_file) and $public_file ne $private_file) {
print_footer(\&private, $private_define);
}
print STDOUT $$private_data;
}
-my $old_public_data = file_load($public_file);
-my $old_private_data = file_load($private_file);
-
mkpath(dirname($public_file), 0, 0755);
open(PUBLIC, ">$public_file") or die("Can't open `$public_file': $!");
print PUBLIC "$$public_data";
close(PUBLIC);
-if ($public_file ne $private_file) {
+if (defined($private_file) and $public_file ne $private_file) {
mkpath(dirname($private_file), 0, 0755);
open(PRIVATE, ">$private_file") or die("Can't open `$private_file': $!");
print PRIVATE "$$private_data";