Don't treat .d (depend) files separately from object files
.d (.MMS in the VMS world) files with just dependencies are built from exactly the same conditions as the object files. Therefore, the rules for them can be built at the same time as the rules for the corresponding object files. This removes the requirement for a src2dep function in the build file templates, and for common.tmpl to call it. In the end, the existence of depend files is entirely up to the build file. Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
parent
7d1037661a
commit
88297284ad
5 changed files with 14 additions and 100 deletions
|
@ -480,26 +480,6 @@ The build-file template is expected to define at least the following
|
|||
perl functions in a perl code fragment enclosed with "{-" and "-}".
|
||||
They are all expected to return a string with the lines they produce.
|
||||
|
||||
src2dep - function that produces build file lines to get the
|
||||
dependencies for an object file into a dependency
|
||||
file.
|
||||
|
||||
It's called like this:
|
||||
|
||||
src2dep(obj => "PATH/TO/objectfile",
|
||||
srcs => [ "PATH/TO/sourcefile", ... ],
|
||||
deps => [ "dep1", ... ],
|
||||
incs => [ "INCL/PATH", ... ]);
|
||||
|
||||
'obj' has the dependent object file as well as
|
||||
object file the dependencies are for; it's *without*
|
||||
extension, src2dep() is expected to add that.
|
||||
'srcs' has the list of source files to build the
|
||||
object file, with the first item being the source
|
||||
file that directly corresponds to the object file.
|
||||
'deps' is a list of explicit dependencies. 'incs'
|
||||
is a list of include file directories.
|
||||
|
||||
src2obj - function that produces build file lines to build an
|
||||
object file from source files and associated data.
|
||||
|
||||
|
|
|
@ -384,24 +384,6 @@ build static libraries from object files, to build shared libraries
|
|||
from static libraries, to programs from object files and libraries,
|
||||
etc.
|
||||
|
||||
src2dep - function that produces build file lines to get the
|
||||
dependencies for an object file into a dependency
|
||||
file.
|
||||
|
||||
It's called like this:
|
||||
|
||||
src2dep(obj => "PATH/TO/objectfile",
|
||||
srcs => [ "PATH/TO/sourcefile", ... ],
|
||||
incs => [ "INCL/PATH", ... ]);
|
||||
|
||||
'obj' has the dependent object file as well as
|
||||
object file the dependencies are for; it's *without*
|
||||
extension, src2dep() is expected to add that.
|
||||
'srcs' has the list of source files to build the
|
||||
object file, with the first item being the source
|
||||
file that directly corresponds to the object file.
|
||||
'incs' is a list of include file directories.
|
||||
|
||||
src2obj - function that produces build file lines to build an
|
||||
object file from source files and associated data.
|
||||
|
||||
|
|
|
@ -43,11 +43,6 @@
|
|||
deps => [ reducedepends(resolvedepends($obj)) ],
|
||||
incs => [ @{$unified_info{includes}->{$bin}},
|
||||
@{$unified_info{includes}->{$obj}} ]);
|
||||
$OUT .= src2dep(obj => $obj_no_o,
|
||||
srcs => $unified_info{sources}->{$obj},
|
||||
deps => [ reducedepends(resolvedepends($obj)) ],
|
||||
incs => [ @{$unified_info{includes}->{$bin}},
|
||||
@{$unified_info{includes}->{$obj}} ]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -410,43 +410,6 @@ descrip.mms : {- sourcefile("Configurations", "descrip.mms.tmpl") -} $(SRCDIR)Co
|
|||
{-
|
||||
use File::Basename;
|
||||
use File::Spec::Functions qw/abs2rel rel2abs catfile catdir/;
|
||||
sub src2dep {
|
||||
my %args = @_;
|
||||
my $dep = $args{obj};
|
||||
my $deps = join(", -\n\t\t", @{$args{srcs}}, @{$args{deps}});
|
||||
|
||||
# Because VMS C isn't very good at combining a /INCLUDE path with
|
||||
# #includes having a relative directory (like '#include "../foo.h"),
|
||||
# the best choice is to move to the first source file's intended
|
||||
# directory before compiling, and make sure to write the object file
|
||||
# in the correct position (important when the object tree is other
|
||||
# than the source tree).
|
||||
my $forward = dirname($args{srcs}->[0]);
|
||||
my $backward = abs2rel(rel2abs("."), rel2abs($forward));
|
||||
my $depd = abs2rel(rel2abs(dirname($dep)), rel2abs($forward));
|
||||
my $depn = basename($dep);
|
||||
my $srcs =
|
||||
join(", ",
|
||||
map { abs2rel(rel2abs($_), rel2abs($forward)) } @{$args{srcs}});
|
||||
my $incs =
|
||||
"/INCLUDE=(".join(",",
|
||||
map {
|
||||
file_name_is_absolute($_)
|
||||
? $_ : catdir($backward,$_)
|
||||
} @{$args{incs}}).")";
|
||||
my $before = $unified_info{before}->{$dep.".OBJ"} || "\@ !";
|
||||
my $after = $unified_info{after}->{$dep.".OBJ"} || "\@ !";
|
||||
|
||||
return <<"EOF";
|
||||
$dep.MMS : $deps
|
||||
${before}
|
||||
SET DEFAULT $forward
|
||||
\$(CC) \$(CFLAGS)${incs} /MMS=(TARGET=.OBJ)/OBJECT=${depd}${depn}.MMS $srcs
|
||||
SET DEFAULT $backward
|
||||
${after}
|
||||
- PURGE $dep.MMS
|
||||
EOF
|
||||
}
|
||||
sub src2obj {
|
||||
my %args = @_;
|
||||
my $obj = $args{obj};
|
||||
|
@ -475,7 +438,9 @@ EOF
|
|||
my $after = $unified_info{after}->{$obj.".OBJ"} || "\@ !";
|
||||
|
||||
return <<"EOF";
|
||||
$obj.OBJ : $deps
|
||||
$obj.MMS : $deps
|
||||
\$(CC) \$(CFLAGS)${incs} /MMS=(FILE=${objd}${objn}.MMS,TARGET=$obj.OBJ) /NOOBJECT $srcs
|
||||
$obj.OBJ : $obj.MMS
|
||||
${before}
|
||||
SET DEFAULT $forward
|
||||
\$(CC) \$(CFLAGS)${incs} /OBJECT=${objd}${objn}.OBJ /REPOSITORY=$backward $srcs
|
||||
|
|
|
@ -732,17 +732,16 @@ Makefile: {- $config{build_file_template} -} $(SRCDIR)/Configure $(SRCDIR)/confi
|
|||
} } @_;
|
||||
}
|
||||
|
||||
sub src2dep {
|
||||
sub src2obj {
|
||||
my %args = @_;
|
||||
my $dep = $args{obj}.'$(DEP_EXT)';
|
||||
my $obj = $args{obj}.'$(OBJ_EXT)';
|
||||
my $obj = $args{obj};
|
||||
my $srcs = join(" ", @{$args{srcs}});
|
||||
my $deps = join(" ", @{$args{srcs}}, @{$args{deps}});
|
||||
my $incs = join(" ", map { " -I".$_ } @{$args{incs}});
|
||||
my $makedepprog = $config{makedepprog};
|
||||
if ($makedepprog eq "makedepend") {
|
||||
return <<"EOF";
|
||||
$dep : $deps
|
||||
$obj\$(DEP_EXT): $deps
|
||||
rm -f \$\@.tmp; touch \$\@.tmp
|
||||
\$(MAKEDEPEND) -f\$\@.tmp -o"|$obj" \\
|
||||
-- -DOPENSSL_DOING_MAKEDEPEND \$(DEPFLAGS)$incs \\
|
||||
|
@ -750,21 +749,14 @@ $dep : $deps
|
|||
2>/dev/null
|
||||
sed -e 's/^.*|//' -e 's/ \\/\\(\\\\.\\|[^ ]\\)*//g' -e '/: *\$\$/d' -e '/^\\(#.*\\| *\\)\$\$/d' \$\@.tmp > \$\@
|
||||
rm \$\@.tmp
|
||||
$obj\$(OBJ_EXT): $obj\$(DEP_EXT)
|
||||
\$(CC) \$(CFLAGS)$incs -c -o \$\@ $srcs
|
||||
EOF
|
||||
}
|
||||
return <<"EOF";
|
||||
$dep : $deps Makefile
|
||||
$obj\$(DEP_EXT): $deps
|
||||
\$(CC) -DOPENSSL_DOING_MAKEDEPEND \$(DEPFLAGS)$incs -MM -MF \$\@ -MQ $obj $srcs
|
||||
EOF
|
||||
}
|
||||
sub src2obj {
|
||||
my %args = @_;
|
||||
my $obj = $args{obj}.'$(OBJ_EXT)';
|
||||
my $srcs = join(" ", @{$args{srcs}});
|
||||
my $deps = join(" ", @{$args{srcs}}, @{$args{deps}});
|
||||
my $incs = join(" ", map { " -I".$_ } @{$args{incs}});
|
||||
return <<"EOF";
|
||||
$obj : $deps
|
||||
$obj\$(OBJ_EXT): $obj\$(DEP_EXT)
|
||||
\$(CC) \$(CFLAGS)$incs -c -o \$\@ $srcs
|
||||
EOF
|
||||
}
|
||||
|
@ -795,7 +787,7 @@ EOF
|
|||
# It's not necessary to have both as targets. The choice falls on the
|
||||
# simplest, {libname}\$(SHLIB_EXT_SIMPLE).a for Windows POSIX layers and
|
||||
# {libname}\$(SHLIB_EXT_SIMPLE) for the Unix platforms.
|
||||
$shlibtarget : $lib\$(LIB_EXT) $deps $ordinalsfile
|
||||
$shlibtarget: $lib\$(LIB_EXT) $deps $ordinalsfile
|
||||
\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
|
||||
PLATFORM=\$(PLATFORM) \\
|
||||
PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
|
||||
|
@ -848,7 +840,7 @@ EOF
|
|||
my $lib = $args{lib};
|
||||
my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
|
||||
return <<"EOF";
|
||||
$lib\$(LIB_EXT) : $objs
|
||||
$lib\$(LIB_EXT): $objs
|
||||
\$(AR) \$\@ $objs
|
||||
\$(RANLIB) \$\@ || echo Never mind.
|
||||
EOF
|
||||
|
@ -867,7 +859,7 @@ EOF
|
|||
" -L$d -l$l" } @{$args{deps}});
|
||||
my $shlib_target = $config{no_shared} ? "" : $target{shared_target};
|
||||
return <<"EOF";
|
||||
$bin\$(EXE_EXT) : $objs $deps
|
||||
$bin\$(EXE_EXT): $objs $deps
|
||||
\$(RM) $bin\$(EXE_EXT)
|
||||
\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
|
||||
PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\
|
||||
|
@ -886,7 +878,7 @@ EOF
|
|||
"util", "dofile.pl")),
|
||||
rel2abs($config{builddir}));
|
||||
return <<"EOF";
|
||||
$script : $sources
|
||||
$script: $sources
|
||||
\$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\
|
||||
"-o$target{build_file}" $sources > "$script"
|
||||
chmod a+x $script
|
||||
|
|
Loading…
Reference in a new issue