Replaced makeDbDepends with mkmf
This commit is contained in:
@@ -14,8 +14,8 @@ define RELEASE_FLAGS_template
|
|||||||
SHRLIB_SEARCH_DIRS += $$($(1)_LIB)
|
SHRLIB_SEARCH_DIRS += $$($(1)_LIB)
|
||||||
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/os/$$(OS_CLASS)))
|
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/os/$$(OS_CLASS)))
|
||||||
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include))
|
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include))
|
||||||
RELEASE_DBDFLAGS += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/dbd))
|
RELEASE_DBD_DIRS += $$(wildcard $$(strip $$($(1)))/dbd)
|
||||||
RELEASE_DBFLAGS += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/db))
|
RELEASE_DB_DIRS += $$(wildcard $$(strip $$($(1)))/db)
|
||||||
RELEASE_PERL_MODULE_DIRS += $$(wildcard $$($(1)_LIB)/perl)
|
RELEASE_PERL_MODULE_DIRS += $$(wildcard $$($(1)_LIB)/perl)
|
||||||
endef
|
endef
|
||||||
$(foreach top, $(RELEASE_TOPS), $(eval $(call RELEASE_FLAGS_template,$(top)) ))
|
$(foreach top, $(RELEASE_TOPS), $(eval $(call RELEASE_FLAGS_template,$(top)) ))
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ vpath %.acs $(USR_VPATH) $(GENERIC_SRC_DIRS) $(COMMON_DIR)
|
|||||||
|
|
||||||
##################################################### dbdflags
|
##################################################### dbdflags
|
||||||
|
|
||||||
# dbExpand
|
DBD_SEARCH_DIRS = . .. $(COMMON_DIR) $(SRC_DIRS) $(INSTALL_DBD) $(RELEASE_DBD_DIRS)
|
||||||
INSTALL_DBDFLAGS += -I $(INSTALL_DBD)
|
DB_SEARCH_DIRS = . .. $(COMMON_DIR) $(SRC_DIRS) $(INSTALL_DB) $(RELEASE_DB_DIRS)
|
||||||
INSTALL_DBFLAGS += -I $(INSTALL_DB)
|
|
||||||
DBDFLAGS = $(USR_DBDFLAGS) -I. -I.. -I$(COMMON_DIR) $(INSTALL_DBDFLAGS) $(RELEASE_DBDFLAGS)
|
DBDFLAGS = $(USR_DBDFLAGS) $(addprefix -I,$(DBD_SEARCH_DIRS))
|
||||||
DBFLAGS = $($*_DBFLAGS) $(USR_DBFLAGS) -I. -I.. -I$(COMMON_DIR) $(INSTALL_DBFLAGS) $(RELEASE_DBFLAGS)
|
DBFLAGS = $($*_DBFLAGS) $(USR_DBFLAGS) $(addprefix -I,$(DB_SEARCH_DIRS))
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
# To allow os specific dbd files AND have the -j option work properly,
|
# To allow os specific dbd files AND have the -j option work properly,
|
||||||
@@ -100,7 +100,7 @@ ACF_CPPFLAGS = $(ACF_CPPFLAGS_$(GNU))
|
|||||||
|
|
||||||
ACF_INCLUDES = -I. $(TARGET_INCLUDES) $(USR_INCLUDES)\
|
ACF_INCLUDES = -I. $(TARGET_INCLUDES) $(USR_INCLUDES)\
|
||||||
$(SRC_INCLUDES) -I$(INSTALL_DB)
|
$(SRC_INCLUDES) -I$(INSTALL_DB)
|
||||||
ACFDEPENDS_CMD = -$(MKMF) -m $(notdir $@)$(DEP) $(subst -I,,$(ACF_INCLUDES)) $@ $<
|
ACFDEPENDS_CMD = -$(MKMF) -m $(notdir $@)$(DEP) $(ACF_INCLUDES) $@ $<
|
||||||
ACF_CMD = $(CPP) $(ACF_CPPFLAGS) $(ACF_INCLUDES) $< > $@
|
ACF_CMD = $(CPP) $(ACF_CPPFLAGS) $(ACF_INCLUDES) $< > $@
|
||||||
|
|
||||||
##################################################### dependancies
|
##################################################### dependancies
|
||||||
@@ -112,11 +112,9 @@ DBDDEPENDS_FILES += $(addsuffix $(DEP),$(HINC) \
|
|||||||
$(patsubst $(COMMON_DIR)/%,%,$(COMMON_DBS)) \
|
$(patsubst $(COMMON_DIR)/%,%,$(COMMON_DBS)) \
|
||||||
$(patsubst $(COMMON_DIR)/%,%,$(COMMON_DBDS)))
|
$(patsubst $(COMMON_DIR)/%,%,$(COMMON_DBDS)))
|
||||||
|
|
||||||
DBDDEPENDS_FLAGS = $(subst -I,,$(filter-out -S%,$(DBDFLAGS)))
|
DBDDEPENDS_FLAGS = $(filter-out -S%,$(DBDFLAGS))
|
||||||
DBDDEPENDS_CMD = -$(MKMF) -m $(notdir $@)$(DEP) $(DBDDEPENDS_FLAGS) $@ $<
|
DBDDEPENDS_CMD = -$(MKMF) -m $(notdir $@)$(DEP) $(DBDDEPENDS_FLAGS) $@ $<
|
||||||
|
|
||||||
MAKEDBDEPENDS = $(PERL) $(TOOLS)/makeDbDepends.pl
|
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
|
|
||||||
ifndef T_A
|
ifndef T_A
|
||||||
@@ -308,7 +306,7 @@ $(COMMON_DIR)/%.db$(RAW): $(COMMON_DIR)/%.edf
|
|||||||
|
|
||||||
$(COMMON_DIR)/%.db$(RAW): %.substitutions
|
$(COMMON_DIR)/%.db$(RAW): %.substitutions
|
||||||
@$(RM) $(notdir $@)$(DEP)
|
@$(RM) $(notdir $@)$(DEP)
|
||||||
@$(MAKEDBDEPENDS) $@ $< $(TEMPLATE_FILENAME) >> $(notdir $@)$(DEP)
|
@$(MKMF) -m$(notdir $@)$(DEP) $(DBFLAGS) $@ $< $(TEMPLATE_FILENAME)
|
||||||
echo "$@ : $(TEMPLATE_FILENAME)" >> $(notdir $@)$(DEP)
|
echo "$@ : $(TEMPLATE_FILENAME)" >> $(notdir $@)$(DEP)
|
||||||
$(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)"
|
$(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)"
|
||||||
@$(RM) $@ $*.tmp
|
@$(RM) $@ $*.tmp
|
||||||
@@ -317,7 +315,7 @@ $(COMMON_DIR)/%.db$(RAW): %.substitutions
|
|||||||
|
|
||||||
$(COMMON_DIR)/%.db$(RAW): %.template
|
$(COMMON_DIR)/%.db$(RAW): %.template
|
||||||
@$(RM) $(notdir $@)$(DEP)
|
@$(RM) $(notdir $@)$(DEP)
|
||||||
@$(MAKEDBDEPENDS) $@ $^ >> $(notdir $@)$(DEP)
|
@$(MKMF) -m$(notdir $@)$(DEP) $(DBFLAGS) $@ $< $(TEMPLATE_FILENAME)
|
||||||
$(ECHO) "Inflating database from $<"
|
$(ECHO) "Inflating database from $<"
|
||||||
@$(RM) $@ $*.tmp
|
@$(RM) $@ $*.tmp
|
||||||
$(MSI) $(DBFLAGS) $< > $*.tmp
|
$(MSI) $(DBFLAGS) $< > $*.tmp
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
|
|
||||||
if $running_under_some_shell; # makeDbDepends.pl
|
|
||||||
|
|
||||||
# Called from within RULES.Db in the Db directories.
|
|
||||||
# Searches .substitutions and .template files (from the command line) for
|
|
||||||
# file ["']xxx["'] {
|
|
||||||
# and
|
|
||||||
# include "xxx"
|
|
||||||
# entries to include in the DEPENDS file
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
my $target = shift @ARGV;
|
|
||||||
my %depends;
|
|
||||||
|
|
||||||
while (my $line = <>) {
|
|
||||||
$depends{$2}++ if $line =~ m/^ \s* file \s* (["']?) (\S*) \1 /x;
|
|
||||||
$depends{$1}++ if $line =~ m/^ \s* include \s* "(.*)" /x;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (%depends) {
|
|
||||||
my @depends = keys %depends;
|
|
||||||
print "$target: @depends\n";
|
|
||||||
}
|
|
||||||
45
src/tools/mkmf.pl
Normal file → Executable file
45
src/tools/mkmf.pl
Normal file → Executable file
@@ -25,39 +25,39 @@
|
|||||||
#
|
#
|
||||||
#-----------------------------------------------------------------------
|
#-----------------------------------------------------------------------
|
||||||
|
|
||||||
use Getopt::Std;
|
use strict;
|
||||||
|
|
||||||
|
use FindBin;
|
||||||
|
use lib "$FindBin::Bin/../../lib/perl";
|
||||||
|
|
||||||
|
use EPICS::Getopts;
|
||||||
|
|
||||||
my $version = 'mkmf.pl,v 1.5 2002/03/25 21:33:24 jba Exp $ ';
|
my $version = 'mkmf.pl,v 1.5 2002/03/25 21:33:24 jba Exp $ ';
|
||||||
my $endline = $/;
|
my $endline = $/;
|
||||||
my %output;
|
my %output;
|
||||||
my @includes;
|
my @includes;
|
||||||
|
|
||||||
use vars qw( $opt_d $opt_m );
|
our ( $opt_d, $opt_m, @opt_I);
|
||||||
getopts( 'dm:' ) || die "\aSyntax: $0 [-d] [-m dependsFile] includeDirs objFile srcFile\n";
|
getopts( 'dm:I@' ) || die "\aSyntax: $0 [-d] [-m dependsFile] [-I incdir [-I incdir]...] objFile srcFile [srcfile]... \n";
|
||||||
my $debug = $opt_d;
|
my $debug = $opt_d;
|
||||||
my $depFile = $opt_m;
|
my $depFile = $opt_m;
|
||||||
|
my @incdirs = @opt_I;
|
||||||
print "$0 $version\n" if $debug;
|
my $objFile = shift;
|
||||||
|
my @srcFiles=@ARGV;
|
||||||
# directory list
|
|
||||||
my @dirs;
|
|
||||||
my $i;
|
|
||||||
foreach $i (0 .. $#ARGV-2) {
|
|
||||||
push @dirs, $ARGV[$i];
|
|
||||||
}
|
|
||||||
|
|
||||||
my $objFile = $ARGV[$#ARGV-1];
|
|
||||||
my $srcFile = $ARGV[$#ARGV];
|
|
||||||
|
|
||||||
if( $debug ) {
|
if( $debug ) {
|
||||||
print "DEBUG: dirs= @dirs\n";
|
print "$0 $version\n";
|
||||||
print "DEBUG: source= $srcFile\n";
|
print "DEBUG: incdirs= @incdirs\n";
|
||||||
print "DEBUG: object= $objFile\n";
|
print "DEBUG: objFile= $objFile\n";
|
||||||
|
print "DEBUG: srcFiles= @srcFiles\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print "Generating dependencies for $objFile\n" if $debug;
|
print "Generating dependencies for $objFile\n" if $debug;
|
||||||
scanFile($srcFile);
|
|
||||||
scanIncludesList();
|
foreach my $srcFile (@srcFiles) {
|
||||||
|
scanFile($srcFile);
|
||||||
|
scanIncludesList();
|
||||||
|
}
|
||||||
|
|
||||||
$depFile = 'depends' unless $depFile;
|
$depFile = 'depends' unless $depFile;
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ sub scanIncludesList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#-----------------------------------------
|
#-----------------------------------------
|
||||||
# find filename on #include line
|
# find filename on #include and file lines
|
||||||
sub findNextIncName {
|
sub findNextIncName {
|
||||||
my $line = shift;
|
my $line = shift;
|
||||||
my $is_subst = shift;
|
my $is_subst = shift;
|
||||||
@@ -130,6 +130,7 @@ sub findNextIncName {
|
|||||||
if ($is_subst) {
|
if ($is_subst) {
|
||||||
return 0 if not $line =~ /^\s*file\s*([^\s{]*)/;
|
return 0 if not $line =~ /^\s*file\s*([^\s{]*)/;
|
||||||
$incname = $1;
|
$incname = $1;
|
||||||
|
$incname = substr $incname, 1, length($incname)-2 if $incname =~ /^".+?"$/;
|
||||||
} else {
|
} else {
|
||||||
return 0 if not $line =~ /^#?\s*include\s*('.*?'|<.*?>|".*?")/;
|
return 0 if not $line =~ /^#?\s*include\s*('.*?'|<.*?>|".*?")/;
|
||||||
$incname = substr $1, 1, length($1)-2;
|
$incname = substr $1, 1, length($1)-2;
|
||||||
@@ -139,7 +140,7 @@ sub findNextIncName {
|
|||||||
return $incname if -f $incname;
|
return $incname if -f $incname;
|
||||||
return 0 if ( $incname =~ /^\// || $incname =~ /^\\/ );
|
return 0 if ( $incname =~ /^\// || $incname =~ /^\\/ );
|
||||||
|
|
||||||
foreach $dir ( @dirs ) {
|
foreach $dir ( @incdirs ) {
|
||||||
chomp($dir);
|
chomp($dir);
|
||||||
$incfile = "$dir/$incname";
|
$incfile = "$dir/$incname";
|
||||||
print "DEBUG: checking for $incname in $dir\n" if $debug;
|
print "DEBUG: checking for $incname in $dir\n" if $debug;
|
||||||
|
|||||||
Reference in New Issue
Block a user