Fix "make --question" mode

Fix for lp:1669891
This commit is contained in:
Martin Konrad
2018-07-31 17:29:03 -04:00
parent 27431facb8
commit 46b5d6006e
4 changed files with 12 additions and 5 deletions

View File

@ -67,7 +67,7 @@ REGISTERRECORDDEVICEDRIVER = $(PERL) $(TOOLS)/registerRecordDeviceDriver.pl
CONVERTRELEASE = $(PERL) $(call FIND_TOOL,convertRelease.pl)
FULLPATHNAME = $(PERL) $(TOOLS)/fullPathName.pl
TAPTOJUNIT = $(PERL) $(TOOLS)/tap-to-junit-xml.pl
GENVERSIONHEADER = $(PERL) $(TOOLS)/genVersionHeader.pl $(QUIET_FLAG)
GENVERSIONHEADER = $(PERL) $(TOOLS)/genVersionHeader.pl $(QUIET_FLAG) $(QUESTION_FLAG)
#---------------------------------------------------------------
# tools for installing libraries and products

View File

@ -80,6 +80,7 @@ IOCS_APPL_TOP = $(shell $(FULLPATHNAME) $(INSTALL_LOCATION))
NOP = :
ECHO = @$(if $(findstring s,$(patsubst T_A=%,,$(MAKEFLAGS))),$(NOP),echo)
QUIET_FLAG := $(if $(findstring s,$(MAKEFLAGS)),-q,)
QUESTION_FLAG := $(if $(findstring q,$(MAKEFLAGS)),-i,)
#-------------------------------------------------------
ifdef T_A

View File

@ -185,7 +185,7 @@ endif
# RELEASE file consistency checking
checkRelease:
$(CONVERTRELEASE) checkRelease
+$(CONVERTRELEASE) checkRelease
warnRelease:
-$(CONVERTRELEASE) checkRelease
noCheckRelease:

View File

@ -23,18 +23,20 @@ my $tfmt = '%Y-%m-%dT%H:%M';
$tfmt .= '%z' unless $^O eq 'MSWin32'; # %z returns zone name on Windows
my $now = strftime($tfmt, localtime);
our ($opt_h, $opt_v, $opt_q);
our ($opt_d, $opt_h, $opt_i, $opt_v, $opt_q);
our $opt_t = '.';
our $opt_N = 'VCSVERSION';
our $opt_V = $now;
my $vcs;
getopts('hvqt:N:V:') && @ARGV == 1
getopts('dhivqt:N:V:') && @ARGV == 1
or HELP_MESSAGE();
my ($outfile) = @ARGV;
if ($opt_d) { exit 0 } # exit if make is run in dry-run mode
if (!$vcs && -d "$opt_t/_darcs") { # Darcs
print "== Found <top>/_darcs directory\n" if $opt_v;
# v1-4-dirty
@ -148,6 +150,8 @@ if (open($DST, '+<', $outfile)) {
or die "Can't create $outfile: $!\n";
}
if ($opt_i) { exit 1 }; # exit if make is run in "question" mode
seek $DST, 0, 0;
truncate $DST, 0;
print $DST $output;
@ -158,9 +162,11 @@ sub HELP_MESSAGE {
Usage:
genVersionHeader.pl -h
Display this Usage message
genVersionHeader.pl [-v] [-q] [-t top] [-N NAME] [-V version] output.h";
genVersionHeader.pl [-v] [-d] [-q] [-t top] [-N NAME] [-V version] output.h";
Generate or update the header file output.h
-v - Verbose (debugging messages)
-d - Dry-run
-i - Question mode
-q - Quiet
-t top - Path to the module's top (default '$opt_t')
-N NAME - Macro name to be defined (default '$opt_N')