-
Notifications
You must be signed in to change notification settings - Fork 35
Add -MMD option #1673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Add -MMD option #1673
Changes from 1 commit
d5a6d3b
b0d6423
a7ae0f8
3141ee4
ef09a05
c746d29
fab491a
b9c8a44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
verilog/v_hier_top.v.d: verilog/v_hier_top.v verilog/v_hier_inc.vh | ||
piecea marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
verilog/v_hier_top.v.d: verilog/v_hier_top.v verilog/v_hier_inc.vh | ||
|
||
verilog/v_hier_inc.vh: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test_dir/res.vpp: verilog/v_hier_top.v verilog/v_hier_inc.vh | ||
test_dir/res.vpp: verilog/v_sv_intf.v verilog/v_sv_pkg.v |
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10,6 +10,7 @@ use lib "$RealBin"; | |||||||||||||||||
use Getopt::Long; | ||||||||||||||||||
use IO::File; | ||||||||||||||||||
use Pod::Usage; | ||||||||||||||||||
use File::Basename; | ||||||||||||||||||
|
||||||||||||||||||
use Verilog::Preproc; | ||||||||||||||||||
use Verilog::Getopt; | ||||||||||||||||||
|
@@ -25,6 +26,8 @@ $Debug = 0; | |||||||||||||||||
my $opt_output_filename = undef; | ||||||||||||||||||
my $opt_blank=1; | ||||||||||||||||||
my $opt_dump_defines; | ||||||||||||||||||
my $opt_mmd; | ||||||||||||||||||
my $opt_mp; | ||||||||||||||||||
my @opt_files; | ||||||||||||||||||
my @opt_pp_flags; | ||||||||||||||||||
|
||||||||||||||||||
|
@@ -45,6 +48,8 @@ if (! GetOptions ( | |||||||||||||||||
"blank!" => \$opt_blank, | ||||||||||||||||||
"comment!" => sub { push @opt_pp_flags, (keep_comments=>$_[1]); }, | ||||||||||||||||||
"dump-defines!" => \$opt_dump_defines, | ||||||||||||||||||
"MMD!" => \$opt_mmd, | ||||||||||||||||||
"MP!" => \$opt_mp, | ||||||||||||||||||
"line!" => sub { push @opt_pp_flags, (line_directives=>$_[1]); }, | ||||||||||||||||||
"P!" => sub { $opt_blank=0; push @opt_pp_flags, (line_directives=>$_[1]); }, | ||||||||||||||||||
"pedantic!" => sub { push @opt_pp_flags, (pedantic=>$_[1]); }, | ||||||||||||||||||
|
@@ -93,6 +98,53 @@ if ($opt_dump_defines) { | |||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
|
||||||||||||||||||
# MMD MP option | ||||||||||||||||||
# produces a list of makefile dependency rules suitable for use by a make utility | ||||||||||||||||||
if ($opt_mmd) { | ||||||||||||||||||
my $opt_output_filename_d; # .d file | ||||||||||||||||||
my $dep_file; # MMD target | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move to inside foreach, just before set |
||||||||||||||||||
if ($opt_output_filename) { | ||||||||||||||||||
# Create a single .d | ||||||||||||||||||
my($filename, $dirs, $suffix) = File::Basename::fileparse($opt_output_filename, qr/\.[^.]*/); | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
$opt_output_filename_d = File::Spec->canonpath("$dirs$filename.d"); | ||||||||||||||||||
open(TARGET_D, '>', $opt_output_filename_d) or die "%Error: $! $opt_output_filename\n"; | ||||||||||||||||||
piecea marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
} else { | ||||||||||||||||||
# Create a .d for each input file | ||||||||||||||||||
} | ||||||||||||||||||
my %includes = %{$Opt->{includes}}; | ||||||||||||||||||
foreach my $target (sort (keys %includes)) { | ||||||||||||||||||
# Setup dep file | ||||||||||||||||||
if($opt_output_filename){ | ||||||||||||||||||
piecea marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
$dep_file = $opt_output_filename; | ||||||||||||||||||
} else { | ||||||||||||||||||
$dep_file = "$target.d"; | ||||||||||||||||||
open(TARGET_D, '>', $dep_file) or die $!; | ||||||||||||||||||
} | ||||||||||||||||||
# Create mmd dep | ||||||||||||||||||
printf TARGET_D "$dep_file: $target"; | ||||||||||||||||||
my @deps = (sort (keys %{$includes{$target}})); | ||||||||||||||||||
foreach my $dep (@deps) { | ||||||||||||||||||
$dep = File::Spec->canonpath($Opt->file_path($dep)); | ||||||||||||||||||
printf TARGET_D " $dep"; | ||||||||||||||||||
} | ||||||||||||||||||
printf TARGET_D "\n"; | ||||||||||||||||||
# Create phony dependency targets (MP) | ||||||||||||||||||
if ($opt_mp) { | ||||||||||||||||||
foreach my $dep (@deps) { | ||||||||||||||||||
$dep = File::Spec->canonpath($Opt->file_path($dep)); | ||||||||||||||||||
printf TARGET_D "\n$dep:\n"; | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
if (!$opt_output_filename){ | ||||||||||||||||||
close(TARGET_D); | ||||||||||||||||||
} | ||||||||||||||||||
} | ||||||||||||||||||
if ($opt_output_filename) { | ||||||||||||||||||
close(TARGET_D); | ||||||||||||||||||
} | ||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Close not needed once use handles. |
||||||||||||||||||
} | ||||||||||||||||||
|
||||||||||||||||||
exit(0); | ||||||||||||||||||
|
||||||||||||||||||
###################################################################### | ||||||||||||||||||
|
@@ -201,6 +253,14 @@ Use the given filename for output instead of stdout. | |||||||||||||||||
Suppress normal output, and instead print a list of all defines existing at | ||||||||||||||||||
the end of processing the input file. | ||||||||||||||||||
|
||||||||||||||||||
=item --MMD | ||||||||||||||||||
|
||||||||||||||||||
Create .d dependency files. | ||||||||||||||||||
piecea marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
|
||||||||||||||||||
=item --MP | ||||||||||||||||||
|
||||||||||||||||||
Create phony dependency targets. | ||||||||||||||||||
piecea marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||
|
||||||||||||||||||
=item --noblank | ||||||||||||||||||
|
||||||||||||||||||
Removes empty lines from the output. Should be used with --noline, as if | ||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.