-if ($subdir eq '.') {
- $vars{SUBDIR} = 'roff char mdoc man tbl eqn';
-} else {
- parse_makefile "$subdir/Makefile";
- parse_makefile "$subdir/../Makefile.inc"
- if -e "$subdir/../Makefile.inc";
-}
-
-my @mandoc = '../mandoc';
-my @subdir_names;
-my (@regress_testnames, @utf8_testnames, @html_testnames, @lint_testnames);
-my (%skip_ascii, %skip_man);
-
-push @mandoc, split ' ', $vars{MOPTS} if $vars{MOPTS};
-delete $vars{MOPTS};
-delete $vars{SKIP_GROFF};
-delete $vars{SKIP_GROFF_ASCII};
-delete $vars{TBL};
-delete $vars{EQN};
-if (defined $vars{SUBDIR}) {
- @subdir_names = split ' ', $vars{SUBDIR};
- delete $vars{SUBDIR};
-}
-if (defined $vars{REGRESS_TARGETS}) {
- @regress_testnames = split ' ', $vars{REGRESS_TARGETS};
- delete $vars{REGRESS_TARGETS};
-}
-if (defined $vars{UTF8_TARGETS}) {
- @utf8_testnames = split ' ', $vars{UTF8_TARGETS};
- delete $vars{UTF8_TARGETS};
-}
-if (defined $vars{HTML_TARGETS}) {
- @html_testnames = split ' ', $vars{HTML_TARGETS};
- delete $vars{HTML_TARGETS};
-}
-if (defined $vars{LINT_TARGETS}) {
- @lint_testnames = split ' ', $vars{LINT_TARGETS};
- delete $vars{LINT_TARGETS};
-}
-if (defined $vars{SKIP_ASCII}) {
- for (split ' ', $vars{SKIP_ASCII}) {
- $skip_ascii{$_} = 1;
- $skip_man{$_} = 1;
+my (@regress_tests, @utf8_tests, @lint_tests, @html_tests);
+my (%tag_tests, %skip_ascii, %skip_man, %skip_markdown);
+foreach my $module (qw(roff char mdoc man tbl eqn)) {
+ my %modvars;
+ parse_makefile "$module/Makefile", \%modvars;
+ foreach my $subdir (split ' ', $modvars{SUBDIR}) {
+ my %subvars = (MOPTS => '');
+ parse_makefile "$module/$subdir/Makefile", \%subvars;
+ parse_makefile "$module/Makefile.inc", \%subvars;
+ delete $subvars{GOPTS};
+ delete $subvars{SKIP_GROFF};
+ delete $subvars{SKIP_GROFF_ASCII};
+ my @mopts = split ' ', $subvars{MOPTS};
+ delete $subvars{MOPTS};
+ my @regress_testnames;
+ if (defined $subvars{TAG_TARGETS}) {
+ $tag_tests{"$module/$subdir/$_"} = 1
+ for split ' ', $subvars{TAG_TARGETS};
+ delete $subvars{TAG_TARGETS};
+ }
+ if (defined $subvars{REGRESS_TARGETS}) {
+ push @regress_testnames,
+ split ' ', $subvars{REGRESS_TARGETS};
+ push @regress_tests, {
+ NAME => "$module/$subdir/$_",
+ MOPTS => \@mopts,
+ } foreach @regress_testnames;
+ delete $subvars{REGRESS_TARGETS};
+ }
+ if (defined $subvars{UTF8_TARGETS}) {
+ push @utf8_tests, {
+ NAME => "$module/$subdir/$_",
+ MOPTS => \@mopts,
+ } foreach split ' ', $subvars{UTF8_TARGETS};
+ delete $subvars{UTF8_TARGETS};
+ }
+ if (defined $subvars{HTML_TARGETS}) {
+ push @html_tests, {
+ NAME => "$module/$subdir/$_",
+ MOPTS => \@mopts,
+ } foreach split ' ', $subvars{HTML_TARGETS};
+ delete $subvars{HTML_TARGETS};
+ }
+ if (defined $subvars{LINT_TARGETS}) {
+ push @lint_tests, {
+ NAME => "$module/$subdir/$_",
+ MOPTS => \@mopts,
+ } foreach split ' ', $subvars{LINT_TARGETS};
+ delete $subvars{LINT_TARGETS};
+ }
+ if (defined $subvars{SKIP_ASCII}) {
+ for (split ' ', $subvars{SKIP_ASCII}) {
+ $skip_ascii{"$module/$subdir/$_"} = 1;
+ $skip_man{"$module/$subdir/$_"} = 1;
+ }
+ delete $subvars{SKIP_ASCII};
+ }
+ if (defined $subvars{SKIP_TMAN}) {
+ $skip_man{"$module/$subdir/$_"} = 1
+ for split ' ', $subvars{SKIP_TMAN};
+ delete $subvars{SKIP_TMAN};
+ }
+ if (defined $subvars{SKIP_MARKDOWN}) {
+ $skip_markdown{"$module/$subdir/$_"} = 1
+ for split ' ', $subvars{SKIP_MARKDOWN};
+ delete $subvars{SKIP_MARKDOWN};
+ }
+ if (keys %subvars) {
+ my @vars = keys %subvars;
+ die "unknown var(s) @vars in dir $module/$subdir";
+ }
+ map {
+ $skip_ascii{"$module/$subdir/$_"} = 1;
+ } @regress_testnames if $skip_ascii{"$module/$subdir/ALL"};
+ map {
+ $skip_man{"$module/$subdir/$_"} = 1;
+ } @regress_testnames if $skip_man{"$module/$subdir/ALL"};
+ map {
+ $skip_markdown{"$module/$subdir/$_"} = 1;
+ } @regress_testnames if $skip_markdown{"$module/$subdir/ALL"};
+ }
+ delete $modvars{SUBDIR};
+ if (keys %modvars) {
+ my @vars = keys %modvars;
+ die "unknown var(s) @vars in module $module";