Use Perl for filtering MAKEFLAGS properly
Requires moving the checkflags code into CONFIG_BASE as that's where FIND_TOOL gets defined. Fixes #545
This commit is contained in:
@ -51,6 +51,7 @@ PODTOHTML_pl = $(TOOLS)/podToHtml.pl
|
||||
PODTOHTML_dep = $(PODTOHTML_pl) $(call FIND_PM,EPICS/PodHtml.pm)
|
||||
PODTOHTML = $(PERL) $(PODTOHTML_pl)
|
||||
CONVERTRELEASE = $(PERL) $(call FIND_TOOL,convertRelease.pl)
|
||||
FILTERMAKEFLAGS = $(PERL) $(call FIND_TOOL,filterMakeflags.pl)
|
||||
FULLPATHNAME = $(PERL) $(TOOLS)/fullPathName.pl
|
||||
GENVERSIONHEADER = $(PERL) $(TOOLS)/genVersionHeader.pl $(QUIET_FLAG) $(QUESTION_FLAG)
|
||||
|
||||
@ -67,6 +68,24 @@ INSTALL_LIBRARY = $(INSTALL)
|
||||
MKMF = $(PERL) $(TOOLS)/mkmf.pl
|
||||
REPLACEVAR = $(PERL) $(TOOLS)/replaceVAR.pl
|
||||
|
||||
#---------------------------------------------------------------
|
||||
# How to portably check the flags to make
|
||||
# GNUmake versions before 4.0 gave different values
|
||||
makeflags := $(shell $(FILTERMAKEFLAGS) $(MAKEFLAGS))
|
||||
define checkflags
|
||||
make-$1 := $(findstring $1,$(makeflags))
|
||||
endef
|
||||
# This is extensible to most single letter flags:
|
||||
$(foreach flag,s q, $(eval $(call checkflags,$(flag))))
|
||||
|
||||
# Silent builds - suppress messages during 'make -s'
|
||||
NOP = :
|
||||
ECHO = @$(if $(make-s),$(NOP),echo)
|
||||
QUIET_FLAG := $(if $(make-s),-q,)
|
||||
|
||||
# Convert 'make -q' flag into '-i' for genVersionHeader.pl
|
||||
QUESTION_FLAG := $(if $(make-q),-i,)
|
||||
|
||||
#---------------------------------------------------------------
|
||||
# tools for cleaning out unwanted files
|
||||
CVSCLEAN = $(call FIND_TOOL,cvsclean.pl)
|
||||
|
@ -81,23 +81,6 @@ FINAL_LOCATION = $(INSTALL_ABSOLUTE)
|
||||
# IOC's view of install path
|
||||
IOCS_APPL_TOP = $(INSTALL_ABSOLUTE)
|
||||
|
||||
#-------------------------------------------------------
|
||||
# How to portably check the flags to make
|
||||
makeflags := $(firstword $(filter-out -,$(filter-out --%,$(MAKEFLAGS))))
|
||||
define checkflags
|
||||
make-$1 := $(findstring $1,$(makeflags))
|
||||
endef
|
||||
# This is extensible to most single letter flags:
|
||||
$(foreach flag,s q, $(eval $(call checkflags,$(flag))))
|
||||
|
||||
# Silent builds - suppress messages during 'make -s'
|
||||
NOP = :
|
||||
ECHO = @$(if $(make-s),$(NOP),echo)
|
||||
QUIET_FLAG := $(if $(make-s),-q,)
|
||||
|
||||
# Convert 'make -q' flag into '-i' for genVersionHeader.pl
|
||||
QUESTION_FLAG := $(if $(make-q),-i,)
|
||||
|
||||
#-------------------------------------------------------
|
||||
ifdef T_A
|
||||
|
||||
|
@ -32,6 +32,7 @@ PERL_SCRIPTS += depclean.pl
|
||||
PERL_SCRIPTS += dos2unix.pl
|
||||
PERL_SCRIPTS += epicsProve.pl
|
||||
PERL_SCRIPTS += expandVars.pl
|
||||
PERL_SCRIPTS += filterMakeflags.pl
|
||||
PERL_SCRIPTS += fullPathName.pl
|
||||
PERL_SCRIPTS += installEpics.pl
|
||||
PERL_SCRIPTS += makeAPIheader.pl
|
||||
|
15
src/tools/filterMakeflags.pl
Normal file
15
src/tools/filterMakeflags.pl
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/env perl
|
||||
#
|
||||
# Filter all versions of GNU Make's MAKEFLAGS variable to return
|
||||
# only the single-letter flags. The content differed slightly
|
||||
# between 3.81, 3.82 and 4.0; Apple still ship 3.81.
|
||||
|
||||
use strict;
|
||||
|
||||
my @flags;
|
||||
foreach (@ARGV) {
|
||||
last if m/^--$/ or m/\w+=/;
|
||||
next if m/^--/ or m/^-$/;
|
||||
push @flags, $_;
|
||||
};
|
||||
print join(' ', @flags);
|
Reference in New Issue
Block a user