Permalink
Browse files

Added 'reconfig' make target and corresponding --reconfig option to

Configure.pl, so its very easy to re-run Configure.pl with the last
(command-line) options you passed it.


git-svn-id: https://svn.parrot.org/parrot/trunk@782 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent c18258c commit c15d8e544a61ccadc47f64d47ce578ec468cb4f3 Gregor N. Purdy committed Jan 8, 2002
Showing with 57 additions and 1 deletion.
  1. +1 −0 .cvsignore
  2. +52 −0 Configure.pl
  3. +4 −1 Makefile.in
View
@@ -1,4 +1,5 @@
blib
+config.opt
core_ops.c
core_ops_prederef.c
Makefile
View
@@ -30,8 +30,41 @@
# Handle options:
#
+my $reconfig = 0;
+
my($opt_debugging, $opt_defaults, $opt_version, $opt_help) = (0, 0, 0, 0);
my(%opt_defines);
+
+if (@ARGV and $ARGV[0] eq '--reconfig') {
+ print STDERR "Configure.pl: Reconfiguring based on config.opt file...\n";
+ open OPTS, "<config.opt" or die "Can't --reconfig. Could not open config.opt for reading!";
+
+ foreach my $opt (<OPTS>) {
+ chomp $opt;
+
+ if ($opt =~ m/^\s*debugging\s*$/) {
+ $opt_debugging = 1;
+ $opt = 'debugging';
+ }
+ elsif ($opt =~ m/^\s*defaults\s*$/) {
+ $opt_defaults = 1;
+ $opt = 'defaults';
+ }
+ elsif ($opt =~ m/^\s*define\s+(.*)\s*=\s*(.*)\s*$/) {
+ $opt_defines{$1} = $2;
+ $opt = "define $1=$2";
+ }
+ else {
+ die "Unrecognized option in config.opt: '$opt'!";
+ }
+
+ print " $opt\n";
+ }
+
+ close OPTS;
+ $reconfig = 1;
+}
+
my $result = GetOptions(
'debugging!' => \$opt_debugging,
'defaults!' => \$opt_defaults,
@@ -50,6 +83,7 @@
print <<"EOT";
$0 - Parrot Configure
Options:
+ --reconfig Reconfigure with saved options
--debugging Enable debugging
--defaults Accept all default values
--define name=value Defines value name as value
@@ -59,6 +93,24 @@
exit;
}
+
+#
+# If we didn't just reconfig, store the config options out to config.opt.
+#
+
+if (!$reconfig) {
+ open OPTS, ">config.opt" or die "Could not open config.opt for writing!";
+ print OPTS "debugging\n" if $opt_debugging;
+ print OPTS "defaults\n" if $opt_defaults;
+ print(OPTS map { sprintf "define %s=%s\n", $_, $opt_defines{$_}; } keys %opt_defines) if %opt_defines;
+ close OPTS;
+}
+
+
+#
+#
+#
+
my($DDOK)=undef;
eval {
require Data::Dumper;
View
@@ -26,7 +26,7 @@ languages/jako/Makefile languages/miniperl/Makefile languages/scheme/Makefile
GEN_CONFIGS = include/parrot/config.h include/parrot/platform.h Parrot/Config.pm \
Parrot/Types.pm platform.c
-STICKY_FILES = $(GEN_CONFIGS) $(GEN_MAKEFILES)
+STICKY_FILES = $(GEN_CONFIGS) $(GEN_MAKEFILES) config.opt
###############################################################################
@@ -377,6 +377,8 @@ distclean:
cvsclean:
$(PERL) -MExtUtils::Manifest=filecheck -le ${PQ}$$ExtUtils::Manifest::Quiet=1; do { unlink $$_ unless $$_ =~ m!(?:CVS/|\.cvs)! } for filecheck()${PQ}
+reconfig:
+ $(MAKE) clean; $(PERL) Configure.pl --reconfig
###############################################################################
@@ -394,3 +396,4 @@ status:
lint: ${test_prog}
$(LINT) ${cc_inc} -Iclasses $(LINTFLAGS) `echo $(O_FILES) | sed 's/\.o/\.c/g'`
$(LINT) ${cc_inc} $(LINTFLAGS) test_main.c
+

0 comments on commit c15d8e5

Please sign in to comment.