Replaced makeDbDepends with mkmf
This commit is contained in:
@@ -14,8 +14,8 @@ define RELEASE_FLAGS_template
|
||||
SHRLIB_SEARCH_DIRS += $$($(1)_LIB)
|
||||
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include/os/$$(OS_CLASS)))
|
||||
RELEASE_INCLUDES += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/include))
|
||||
RELEASE_DBDFLAGS += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/dbd))
|
||||
RELEASE_DBFLAGS += $$(addprefix -I,$$(wildcard $$(strip $$($(1)))/db))
|
||||
RELEASE_DBD_DIRS += $$(wildcard $$(strip $$($(1)))/dbd)
|
||||
RELEASE_DB_DIRS += $$(wildcard $$(strip $$($(1)))/db)
|
||||
RELEASE_PERL_MODULE_DIRS += $$(wildcard $$($(1)_LIB)/perl)
|
||||
endef
|
||||
$(foreach top, $(RELEASE_TOPS), $(eval $(call RELEASE_FLAGS_template,$(top)) ))
|
||||
|
||||
@@ -21,11 +21,11 @@ vpath %.acs $(USR_VPATH) $(GENERIC_SRC_DIRS) $(COMMON_DIR)
|
||||
|
||||
##################################################### dbdflags
|
||||
|
||||
# dbExpand
|
||||
INSTALL_DBDFLAGS += -I $(INSTALL_DBD)
|
||||
INSTALL_DBFLAGS += -I $(INSTALL_DB)
|
||||
DBDFLAGS = $(USR_DBDFLAGS) -I. -I.. -I$(COMMON_DIR) $(INSTALL_DBDFLAGS) $(RELEASE_DBDFLAGS)
|
||||
DBFLAGS = $($*_DBFLAGS) $(USR_DBFLAGS) -I. -I.. -I$(COMMON_DIR) $(INSTALL_DBFLAGS) $(RELEASE_DBFLAGS)
|
||||
DBD_SEARCH_DIRS = . .. $(COMMON_DIR) $(SRC_DIRS) $(INSTALL_DBD) $(RELEASE_DBD_DIRS)
|
||||
DB_SEARCH_DIRS = . .. $(COMMON_DIR) $(SRC_DIRS) $(INSTALL_DB) $(RELEASE_DB_DIRS)
|
||||
|
||||
DBDFLAGS = $(USR_DBDFLAGS) $(addprefix -I,$(DBD_SEARCH_DIRS))
|
||||
DBFLAGS = $($*_DBFLAGS) $(USR_DBFLAGS) $(addprefix -I,$(DB_SEARCH_DIRS))
|
||||
|
||||
#####################################################
|
||||
# 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)\
|
||||
$(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) $< > $@
|
||||
|
||||
##################################################### dependancies
|
||||
@@ -112,11 +112,9 @@ DBDDEPENDS_FILES += $(addsuffix $(DEP),$(HINC) \
|
||||
$(patsubst $(COMMON_DIR)/%,%,$(COMMON_DBS)) \
|
||||
$(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) $@ $<
|
||||
|
||||
MAKEDBDEPENDS = $(PERL) $(TOOLS)/makeDbDepends.pl
|
||||
|
||||
#####################################################
|
||||
|
||||
ifndef T_A
|
||||
@@ -308,7 +306,7 @@ $(COMMON_DIR)/%.db$(RAW): $(COMMON_DIR)/%.edf
|
||||
|
||||
$(COMMON_DIR)/%.db$(RAW): %.substitutions
|
||||
@$(RM) $(notdir $@)$(DEP)
|
||||
@$(MAKEDBDEPENDS) $@ $< $(TEMPLATE_FILENAME) >> $(notdir $@)$(DEP)
|
||||
@$(MKMF) -m$(notdir $@)$(DEP) $(DBFLAGS) $@ $< $(TEMPLATE_FILENAME)
|
||||
echo "$@ : $(TEMPLATE_FILENAME)" >> $(notdir $@)$(DEP)
|
||||
$(ECHO) "Inflating database from $< $(TEMPLATE_FILENAME)"
|
||||
@$(RM) $@ $*.tmp
|
||||
@@ -317,7 +315,7 @@ $(COMMON_DIR)/%.db$(RAW): %.substitutions
|
||||
|
||||
$(COMMON_DIR)/%.db$(RAW): %.template
|
||||
@$(RM) $(notdir $@)$(DEP)
|
||||
@$(MAKEDBDEPENDS) $@ $^ >> $(notdir $@)$(DEP)
|
||||
@$(MKMF) -m$(notdir $@)$(DEP) $(DBFLAGS) $@ $< $(TEMPLATE_FILENAME)
|
||||
$(ECHO) "Inflating database from $<"
|
||||
@$(RM) $@ $*.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 $endline = $/;
|
||||
my %output;
|
||||
my @includes;
|
||||
|
||||
use vars qw( $opt_d $opt_m );
|
||||
getopts( 'dm:' ) || die "\aSyntax: $0 [-d] [-m dependsFile] includeDirs objFile srcFile\n";
|
||||
our ( $opt_d, $opt_m, @opt_I);
|
||||
getopts( 'dm:I@' ) || die "\aSyntax: $0 [-d] [-m dependsFile] [-I incdir [-I incdir]...] objFile srcFile [srcfile]... \n";
|
||||
my $debug = $opt_d;
|
||||
my $depFile = $opt_m;
|
||||
|
||||
print "$0 $version\n" if $debug;
|
||||
|
||||
# directory list
|
||||
my @dirs;
|
||||
my $i;
|
||||
foreach $i (0 .. $#ARGV-2) {
|
||||
push @dirs, $ARGV[$i];
|
||||
}
|
||||
|
||||
my $objFile = $ARGV[$#ARGV-1];
|
||||
my $srcFile = $ARGV[$#ARGV];
|
||||
my @incdirs = @opt_I;
|
||||
my $objFile = shift;
|
||||
my @srcFiles=@ARGV;
|
||||
|
||||
if( $debug ) {
|
||||
print "DEBUG: dirs= @dirs\n";
|
||||
print "DEBUG: source= $srcFile\n";
|
||||
print "DEBUG: object= $objFile\n";
|
||||
print "$0 $version\n";
|
||||
print "DEBUG: incdirs= @incdirs\n";
|
||||
print "DEBUG: objFile= $objFile\n";
|
||||
print "DEBUG: srcFiles= @srcFiles\n";
|
||||
}
|
||||
|
||||
print "Generating dependencies for $objFile\n" if $debug;
|
||||
scanFile($srcFile);
|
||||
scanIncludesList();
|
||||
|
||||
foreach my $srcFile (@srcFiles) {
|
||||
scanFile($srcFile);
|
||||
scanIncludesList();
|
||||
}
|
||||
|
||||
$depFile = 'depends' unless $depFile;
|
||||
|
||||
@@ -118,7 +118,7 @@ sub scanIncludesList {
|
||||
}
|
||||
|
||||
#-----------------------------------------
|
||||
# find filename on #include line
|
||||
# find filename on #include and file lines
|
||||
sub findNextIncName {
|
||||
my $line = shift;
|
||||
my $is_subst = shift;
|
||||
@@ -130,6 +130,7 @@ sub findNextIncName {
|
||||
if ($is_subst) {
|
||||
return 0 if not $line =~ /^\s*file\s*([^\s{]*)/;
|
||||
$incname = $1;
|
||||
$incname = substr $incname, 1, length($incname)-2 if $incname =~ /^".+?"$/;
|
||||
} else {
|
||||
return 0 if not $line =~ /^#?\s*include\s*('.*?'|<.*?>|".*?")/;
|
||||
$incname = substr $1, 1, length($1)-2;
|
||||
@@ -139,7 +140,7 @@ sub findNextIncName {
|
||||
return $incname if -f $incname;
|
||||
return 0 if ( $incname =~ /^\// || $incname =~ /^\\/ );
|
||||
|
||||
foreach $dir ( @dirs ) {
|
||||
foreach $dir ( @incdirs ) {
|
||||
chomp($dir);
|
||||
$incfile = "$dir/$incname";
|
||||
print "DEBUG: checking for $incname in $dir\n" if $debug;
|
||||
|
||||
Reference in New Issue
Block a user