mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-01 14:55:12 +00:00
Better devdir support in mkdep.pl
This commit is contained in:
15
mkdep.pl
15
mkdep.pl
@@ -9,6 +9,7 @@ die "usage: $0 Makefile ...\n" unless $#ARGV >= 0;
|
|||||||
my @incpaths;
|
my @incpaths;
|
||||||
my %dir_vars;
|
my %dir_vars;
|
||||||
my %implicit;
|
my %implicit;
|
||||||
|
my %generated;
|
||||||
|
|
||||||
# Read in MANIFEST fail if present
|
# Read in MANIFEST fail if present
|
||||||
my %manifest;
|
my %manifest;
|
||||||
@@ -48,6 +49,7 @@ sub mkdep {
|
|||||||
$makefile =~ s/\\\n//mg;
|
$makefile =~ s/\\\n//mg;
|
||||||
|
|
||||||
# Expand some configure bits
|
# Expand some configure bits
|
||||||
|
$makefile =~ s:\@DEV\@::g;
|
||||||
$makefile =~ s:\@COMMON_OBJS\@:aix.lo:;
|
$makefile =~ s:\@COMMON_OBJS\@:aix.lo:;
|
||||||
$makefile =~ s:\@SUDO_OBJS\@:preload.o selinux.o sesh.o sudo_noexec.lo:;
|
$makefile =~ s:\@SUDO_OBJS\@:preload.o selinux.o sesh.o sudo_noexec.lo:;
|
||||||
$makefile =~ s:\@SUDOERS_OBJS\@:bsm_audit.lo linux_audit.lo ldap.lo plugin_error.lo:;
|
$makefile =~ s:\@SUDOERS_OBJS\@:bsm_audit.lo linux_audit.lo ldap.lo plugin_error.lo:;
|
||||||
@@ -70,6 +72,13 @@ sub mkdep {
|
|||||||
push(@incpaths, $1) unless $1 eq ".";
|
push(@incpaths, $1) unless $1 eq ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check for generated files
|
||||||
|
if ($makefile =~ /GENERATED\s*=\s*(.+)$/m) {
|
||||||
|
foreach (split(/\s+/, $1)) {
|
||||||
|
$generated{$_} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Values of srcdir, top_srcdir, top_builddir, incdir
|
# Values of srcdir, top_srcdir, top_builddir, incdir
|
||||||
%dir_vars = ();
|
%dir_vars = ();
|
||||||
$file =~ m:^(.*)/+[^/]+:;
|
$file =~ m:^(.*)/+[^/]+:;
|
||||||
@@ -108,6 +117,7 @@ sub mkdep {
|
|||||||
} elsif (exists $manifest{$src}) {
|
} elsif (exists $manifest{$src}) {
|
||||||
$src = $manifest{$src};
|
$src = $manifest{$src};
|
||||||
foreach (sort { length($b) <=> length($a) } keys %dir_vars) {
|
foreach (sort { length($b) <=> length($a) } keys %dir_vars) {
|
||||||
|
next if $_ eq "devdir";
|
||||||
last if $src =~ s:^\Q$dir_vars{$_}/\E:\$\($_\)/:;
|
last if $src =~ s:^\Q$dir_vars{$_}/\E:\$\($_\)/:;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -198,10 +208,15 @@ sub find_header {
|
|||||||
return ("\$(top_builddir\)/$hdr", "./${hdr}.in") if -r "./${hdr}.in";
|
return ("\$(top_builddir\)/$hdr", "./${hdr}.in") if -r "./${hdr}.in";
|
||||||
return ("./$hdr", "$dir_vars{'srcdir'}/${hdr}.in") if -r "$dir_vars{'srcdir'}/${hdr}.in";
|
return ("./$hdr", "$dir_vars{'srcdir'}/${hdr}.in") if -r "$dir_vars{'srcdir'}/${hdr}.in";
|
||||||
|
|
||||||
|
if (exists $generated{$hdr}) {
|
||||||
|
my $hdr_path = $dir_vars{'devdir'} . '/' . $hdr;
|
||||||
|
return ('$(devdir)/' . $hdr, $hdr_path) if -r $hdr_path;
|
||||||
|
}
|
||||||
foreach my $inc (@incpaths) {
|
foreach my $inc (@incpaths) {
|
||||||
my $hdr_path = "$inc/$hdr";
|
my $hdr_path = "$inc/$hdr";
|
||||||
# resolve variables in include path
|
# resolve variables in include path
|
||||||
foreach (keys %dir_vars) {
|
foreach (keys %dir_vars) {
|
||||||
|
next if $_ eq "devdir";
|
||||||
$hdr_path =~ s/\$[\(\{]$_[\)\}]/$dir_vars{$_}/g;
|
$hdr_path =~ s/\$[\(\{]$_[\)\}]/$dir_vars{$_}/g;
|
||||||
}
|
}
|
||||||
return ("$inc/$hdr", $hdr_path) if -r $hdr_path;
|
return ("$inc/$hdr", $hdr_path) if -r $hdr_path;
|
||||||
|
@@ -417,7 +417,7 @@ check_iolog_path.o: $(srcdir)/regress/iolog_path/check_iolog_path.c \
|
|||||||
$(devdir)/def_data.h $(srcdir)/logging.h \
|
$(devdir)/def_data.h $(srcdir)/logging.h \
|
||||||
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
|
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
|
||||||
$(incdir)/sudo_debug.h $(incdir)/gettext.h \
|
$(incdir)/sudo_debug.h $(incdir)/gettext.h \
|
||||||
$(srcdir)/def_data.c
|
$(devdir)/def_data.c
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/regress/iolog_path/check_iolog_path.c
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/regress/iolog_path/check_iolog_path.c
|
||||||
check_wrap.o: $(srcdir)/regress/logging/check_wrap.c $(top_builddir)/config.h \
|
check_wrap.o: $(srcdir)/regress/logging/check_wrap.c $(top_builddir)/config.h \
|
||||||
$(incdir)/missing.h $(incdir)/error.h
|
$(incdir)/missing.h $(incdir)/error.h
|
||||||
@@ -435,7 +435,7 @@ defaults.lo: $(srcdir)/defaults.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
|
|||||||
$(srcdir)/defaults.h $(devdir)/def_data.h $(srcdir)/logging.h \
|
$(srcdir)/defaults.h $(devdir)/def_data.h $(srcdir)/logging.h \
|
||||||
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
|
$(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
|
||||||
$(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/parse.h \
|
$(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/parse.h \
|
||||||
$(devdir)/gram.h $(srcdir)/def_data.c
|
$(devdir)/gram.h $(devdir)/def_data.c
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/defaults.c
|
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/defaults.c
|
||||||
env.lo: $(srcdir)/env.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
|
env.lo: $(srcdir)/env.c $(top_builddir)/config.h $(srcdir)/sudoers.h \
|
||||||
$(top_builddir)/pathnames.h $(incdir)/missing.h $(incdir)/error.h \
|
$(top_builddir)/pathnames.h $(incdir)/missing.h $(incdir)/error.h \
|
||||||
@@ -486,7 +486,7 @@ gram.lo: $(devdir)/gram.c $(top_builddir)/config.h $(top_builddir)/config.h \
|
|||||||
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
|
$(incdir)/fileops.h $(srcdir)/defaults.h $(devdir)/def_data.h \
|
||||||
$(srcdir)/logging.h $(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
|
$(srcdir)/logging.h $(srcdir)/sudo_nss.h $(incdir)/sudo_plugin.h \
|
||||||
$(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/parse.h \
|
$(incdir)/sudo_debug.h $(incdir)/gettext.h $(srcdir)/parse.h \
|
||||||
$(srcdir)/toke.h
|
$(srcdir)/toke.h $(devdir)/gram.h
|
||||||
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(devdir)/gram.c
|
$(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(devdir)/gram.c
|
||||||
group_plugin.lo: $(srcdir)/group_plugin.c $(top_builddir)/config.h \
|
group_plugin.lo: $(srcdir)/group_plugin.c $(top_builddir)/config.h \
|
||||||
$(top_srcdir)/compat/dlfcn.h $(srcdir)/sudoers.h \
|
$(top_srcdir)/compat/dlfcn.h $(srcdir)/sudoers.h \
|
||||||
|
Reference in New Issue
Block a user