1 1.1 christos ## 2 1.1 christos ## Makefile for OpenSSL 3 1.1 christos ## 4 1.1 christos ## {- join("\n## ", @autowarntext) -} 5 1.1 christos {- 6 1.1.1.2 christos use Time::Piece; 7 1.1.1.2 christos 8 1.1 christos use OpenSSL::Util; 9 1.1 christos 10 1.1 christos our $makedep_scheme = $config{makedep_scheme}; 11 1.1 christos our $makedepcmd = platform->makedepcmd(); 12 1.1 christos 13 1.1 christos sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } 14 1.1 christos 15 1.1 christos # Shared AIX support is special. We put libcrypto[64].so.ver into 16 1.1 christos # libcrypto.a and use libcrypto_a.a as static one, unless using 17 1.1 christos # shared_target style aix-solib. In that mode, create 18 1.1 christos # libcrypto.so as a link-import library that inserts runtime 19 1.1 christos # dependencies on libcrypto.so.ver, and the static library is 20 1.1 christos # named libcrypto.a. 21 1.1 christos sub sharedaix { !$disabled{shared} && $target{shared_target} =~ /^aix(?!-solib$)/ } 22 1.1 christos sub sharedaix_solib { !$disabled{shared} && $target{shared_target} =~ /^aix-solib$/ } 23 1.1 christos 24 1.1 christos our $sover_dirname = platform->shlib_version_as_filename(); 25 1.1 christos 26 1.1 christos # This makes sure things get built in the order they need 27 1.1 christos # to. You're welcome. 28 1.1 christos sub dependmagic { 29 1.1 christos my $target = shift; 30 1.1 christos my $help = shift; 31 1.1 christos 32 1.1 christos return "$target: build_generated ## $help\n\t\"\$(MAKE)\" depend && \"\$(MAKE)\" _$target\n_$target"; 33 1.1 christos } 34 1.1 christos 35 1.1 christos our $COLUMNS = $ENV{COLUMNS}; 36 1.1 christos if ($COLUMNS =~ /^\d+$/) { 37 1.1 christos $COLUMNS = int($COLUMNS) - 2; # 2 to leave space for ending ' \' 38 1.1 christos } else { 39 1.1 christos $COLUMNS = 76; 40 1.1 christos } 41 1.1 christos 42 1.1 christos sub fill_lines { 43 1.1 christos my $item_sep = shift; # string 44 1.1 christos my $line_length = shift; # number of chars 45 1.1 christos 46 1.1 christos my @result = (); 47 1.1 christos my $resultpos = 0; 48 1.1 christos 49 1.1 christos foreach (@_) { 50 1.1 christos my $fill_line = $result[$resultpos] // ''; 51 1.1 christos my $newline = 52 1.1 christos ($fill_line eq '' ? '' : $fill_line . $item_sep) . $_; 53 1.1 christos 54 1.1 christos if (length($newline) > $line_length) { 55 1.1 christos # If this is a single item and the intended result line 56 1.1 christos # is empty, we put it there anyway 57 1.1 christos if ($fill_line eq '') { 58 1.1 christos $result[$resultpos++] = $newline; 59 1.1 christos } else { 60 1.1 christos $result[++$resultpos] = $_; 61 1.1 christos } 62 1.1 christos } else { 63 1.1 christos $result[$resultpos] = $newline; 64 1.1 christos } 65 1.1 christos } 66 1.1 christos return @result; 67 1.1 christos } 68 1.1 christos ''; 69 1.1 christos -} 70 1.1 christos PLATFORM={- $config{target} -} 71 1.1 christos OPTIONS={- $config{options} -} 72 1.1 christos CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) 73 1.1 christos SRCDIR={- $config{sourcedir} -} 74 1.1 christos BLDDIR={- $config{builddir} -} 75 1.1 christos FIPSKEY={- $config{FIPSKEY} -} 76 1.1 christos 77 1.1 christos VERSION={- "$config{full_version}" -} 78 1.1 christos VERSION_NUMBER={- "$config{version}" -} 79 1.1.1.2 christos RELEASE_DATE={- my $t = localtime; 80 1.1.1.2 christos if ($config{"release_date"}) { 81 1.1.1.2 christos # Provide the user with a more meaningful error message 82 1.1.1.2 christos # than the default internal parsing error from 83 1.1.1.2 christos # `Time::Piece->strptime(..)`. 84 1.1.1.2 christos eval { $t = Time::Piece->strptime($config{"release_date"}, "%d %b %Y"); } || 85 1.1.1.2 christos die "Parsing \$config{release_date} ('$config{release_date}') failed: $@"; 86 1.1.1.2 christos } 87 1.1.1.2 christos $t->strftime("%Y-%m-%d") -} 88 1.1 christos MAJOR={- $config{major} -} 89 1.1 christos MINOR={- $config{minor} -} 90 1.1 christos SHLIB_VERSION_NUMBER={- $config{shlib_version} -} 91 1.1 christos SHLIB_TARGET={- $target{shared_target} -} 92 1.1 christos 93 1.1 christos LIBS={- join(" \\\n" . ' ' x 5, 94 1.1 christos fill_lines(" ", $COLUMNS - 5, 95 1.1 christos map { platform->staticlib($_) // () } 96 1.1 christos @{$unified_info{libraries}})) -} 97 1.1 christos SHLIBS={- join(" \\\n" . ' ' x 7, 98 1.1 christos fill_lines(" ", $COLUMNS - 7, 99 1.1 christos map { platform->sharedlib($_) // () } 100 1.1 christos @{$unified_info{libraries}})) -} 101 1.1 christos SHLIB_INFO={- join(" \\\n" . ' ' x 11, 102 1.1 christos fill_lines(" ", $COLUMNS - 11, 103 1.1 christos map { my $x = platform->sharedlib($_); 104 1.1 christos my $y = platform->sharedlib_simple($_) // ''; 105 1.1 christos my $z = platform->sharedlib_import($_) // ''; 106 1.1 christos $x ? "\"$x;$y;$z\"" : () } 107 1.1 christos @{$unified_info{libraries}})) -} 108 1.1 christos MODULES={- join(" \\\n" . ' ' x 8, 109 1.1 christos fill_lines(" ", $COLUMNS - 8, 110 1.1 christos map { platform->dso($_) } 111 1.1 christos # Drop all modules that are dependencies, they will 112 1.1 christos # be processed through their dependents 113 1.1 christos grep { my $x = $_; 114 1.1 christos !grep { grep { $_ eq $x } @$_ } 115 1.1 christos values %{$unified_info{depends}} } 116 1.1 christos @{$unified_info{modules}})) -} 117 1.1 christos FIPSMODULE={- # We do some extra checking here, as there should be only one 118 1.1 christos use File::Basename; 119 1.1 christos our @fipsmodules = 120 1.1 christos grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} 121 1.1 christos && $unified_info{attributes}->{modules}->{$_}->{fips} } 122 1.1 christos @{$unified_info{modules}}; 123 1.1 christos die "More that one FIPS module" if scalar @fipsmodules > 1; 124 1.1 christos join(" ", map { platform->dso($_) } @fipsmodules) -} 125 1.1 christos FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1; 126 1.1 christos join(" ", map { basename(platform->dso($_)) } @fipsmodules) -} 127 1.1 christos 128 1.1 christos PROGRAMS={- join(" \\\n" . ' ' x 9, 129 1.1 christos fill_lines(" ", $COLUMNS - 9, 130 1.1 christos map { platform->bin($_) } 131 1.1 christos @{$unified_info{programs}})) -} 132 1.1 christos SCRIPTS={- join(" \\\n" . ' ' x 8, 133 1.1 christos fill_lines(" ", $COLUMNS - 8, @{$unified_info{scripts}})) -} 134 1.1 christos {- output_off() if $disabled{makedepend}; "" -} 135 1.1 christos DEPS={- join(" \\\n" . ' ' x 5, 136 1.1 christos fill_lines(" ", $COLUMNS - 5, 137 1.1 christos map { platform->isobj($_) ? platform->dep($_) : () } 138 1.1 christos grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } 139 1.1 christos keys %{$unified_info{sources}})); -} 140 1.1 christos {- output_on() if $disabled{makedepend}; "" -} 141 1.1 christos GENERATED_MANDATORY={- join(" \\\n" . ' ' x 20, 142 1.1 christos fill_lines(" ", $COLUMNS - 20, 143 1.1 christos @{$unified_info{depends}->{""}})) -} 144 1.1 christos GENERATED_PODS={- # common0.tmpl provides @generated 145 1.1 christos join(" \\\n" . ' ' x 15, 146 1.1 christos fill_lines(" ", $COLUMNS - 15, 147 1.1 christos map { my $x = $_; 148 1.1 christos ( 149 1.1 christos grep { 150 1.1 christos $unified_info{attributes}->{depends} 151 1.1 christos ->{$x}->{$_}->{pod} // 0 152 1.1 christos } 153 1.1 christos keys %{$unified_info{attributes}->{depends}->{$x}} 154 1.1 christos ) ? $x : (); 155 1.1 christos } 156 1.1 christos @generated)) -} 157 1.1 christos GENERATED={- # common0.tmpl provides @generated 158 1.1 christos join(" \\\n" . ' ' x 5, 159 1.1 christos fill_lines(" ", $COLUMNS - 5, 160 1.1 christos map { platform->convertext($_) } @generated )) -} 161 1.1 christos 162 1.1 christos INSTALL_LIBS={- 163 1.1 christos join(" \\\n" . ' ' x 13, 164 1.1 christos fill_lines(" ", $COLUMNS - 13, 165 1.1 christos map { platform->staticlib($_) // () } 166 1.1 christos grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } 167 1.1 christos @{$unified_info{libraries}})) 168 1.1 christos -} 169 1.1 christos INSTALL_SHLIBS={- 170 1.1 christos join(" \\\n" . ' ' x 15, 171 1.1 christos fill_lines(" ", $COLUMNS - 15, 172 1.1 christos map { platform->sharedlib($_) // () } 173 1.1 christos grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } 174 1.1 christos @{$unified_info{libraries}})) 175 1.1 christos -} 176 1.1 christos INSTALL_SHLIB_INFO={- 177 1.1 christos join(" \\\n" . ' ' x 19, 178 1.1 christos fill_lines(" ", $COLUMNS - 19, 179 1.1 christos map { my $x = platform->sharedlib($_); 180 1.1 christos my $y = platform->sharedlib_simple($_) // ''; 181 1.1 christos my $z = platform->sharedlib_import($_) // ''; 182 1.1 christos $x ? "\"$x;$y;$z\"" : () } 183 1.1 christos grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } 184 1.1 christos @{$unified_info{libraries}})) 185 1.1 christos -} 186 1.1 christos INSTALL_ENGINES={- 187 1.1 christos join(" \\\n" . ' ' x 16, 188 1.1 christos fill_lines(" ", $COLUMNS - 16, 189 1.1 christos map { platform->dso($_) } 190 1.1 christos grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} 191 1.1 christos && $unified_info{attributes}->{modules}->{$_}->{engine} } 192 1.1 christos @{$unified_info{modules}})) 193 1.1 christos -} 194 1.1 christos INSTALL_MODULES={- 195 1.1 christos join(" \\\n" . ' ' x 16, 196 1.1 christos fill_lines(" ", $COLUMNS - 16, 197 1.1 christos map { platform->dso($_) } 198 1.1 christos grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} 199 1.1 christos && !$unified_info{attributes}->{modules}->{$_}->{engine} 200 1.1 christos && !$unified_info{attributes}->{modules}->{$_}->{fips} } 201 1.1 christos @{$unified_info{modules}})) 202 1.1 christos -} 203 1.1 christos INSTALL_FIPSMODULE={- 204 1.1 christos join(" \\\n" . ' ' x 16, 205 1.1 christos fill_lines(" ", $COLUMNS - 16, 206 1.1 christos map { platform->dso($_) } 207 1.1 christos grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} 208 1.1 christos && $unified_info{attributes}->{modules}->{$_}->{fips} } 209 1.1 christos @{$unified_info{modules}})) 210 1.1 christos -} 211 1.1 christos INSTALL_FIPSMODULECONF=providers/fipsmodule.cnf 212 1.1 christos INSTALL_PROGRAMS={- 213 1.1 christos join(" \\\n" . ' ' x 16, 214 1.1 christos fill_lines(" ", $COLUMNS - 16, map { platform->bin($_) } 215 1.1 christos grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } 216 1.1 christos @{$unified_info{programs}})) 217 1.1 christos -} 218 1.1 christos INSTALL_EXPORTERS_PKGCONFIG={- 219 1.1 christos join(" \\\n" . ' ' x 28, 220 1.1 christos fill_lines(" ", $COLUMNS - 28, 221 1.1 christos grep { $unified_info{attributes}->{generate}->{$_}->{exporter} eq 'pkg-config'} 222 1.1 christos sort keys %{$unified_info{generate}})) 223 1.1 christos -} 224 1.1 christos INSTALL_EXPORTERS_CMAKE={- 225 1.1 christos join(" \\\n" . ' ' x 24, 226 1.1 christos fill_lines(" ", $COLUMNS - 24, 227 1.1 christos grep { $unified_info{attributes}->{generate}->{$_}->{exporter} eq 'cmake'} 228 1.1 christos sort keys %{$unified_info{generate}})) 229 1.1 christos -} 230 1.1 christos BIN_SCRIPTS={- 231 1.1 christos join(" \\\n" . ' ' x 12, 232 1.1 christos fill_lines(" ", $COLUMNS - 12, 233 1.1 christos map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname}; 234 1.1 christos $x ? "$_:$x" : $_ } 235 1.1 christos grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} 236 1.1 christos && !$unified_info{attributes}->{scripts}->{$_}->{misc} } 237 1.1 christos @{$unified_info{scripts}})) 238 1.1 christos -} 239 1.1 christos MISC_SCRIPTS={- 240 1.1 christos join(" \\\n" . ' ' x 13, 241 1.1 christos fill_lines(" ", $COLUMNS - 13, 242 1.1 christos map { my $x = $unified_info{attributes}->{scripts}->{$_}->{linkname}; 243 1.1 christos $x ? "$_:$x" : $_ } 244 1.1 christos grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} 245 1.1 christos && $unified_info{attributes}->{scripts}->{$_}->{misc} } 246 1.1 christos @{$unified_info{scripts}})) 247 1.1 christos -} 248 1.1 christos IMAGEDOCS1={- 249 1.1 christos join(" \\\n" . ' ' x 10, 250 1.1 christos fill_lines(" ", $COLUMNS - 10, 251 1.1 christos @{$unified_info{imagedocs}->{man1}})) -} 252 1.1 christos IMAGEDOCS3={- 253 1.1 christos join(" \\\n" . ' ' x 10, 254 1.1 christos fill_lines(" ", $COLUMNS - 10, 255 1.1 christos @{$unified_info{imagedocs}->{man3}})) -} 256 1.1 christos IMAGEDOCS5={- 257 1.1 christos join(" \\\n" . ' ' x 10, 258 1.1 christos fill_lines(" ", $COLUMNS - 10, 259 1.1 christos @{$unified_info{imagedocs}->{man5}})) -} 260 1.1 christos IMAGEDOCS7={- 261 1.1 christos join(" \\\n" . ' ' x 10, 262 1.1 christos fill_lines(" ", $COLUMNS - 10, 263 1.1 christos @{$unified_info{imagedocs}->{man7}})) -} 264 1.1 christos HTMLDOCS1={- 265 1.1 christos join(" \\\n" . ' ' x 10, 266 1.1 christos fill_lines(" ", $COLUMNS - 10, 267 1.1 christos @{$unified_info{htmldocs}->{man1}})) -} 268 1.1 christos HTMLDOCS3={- 269 1.1 christos join(" \\\n" . ' ' x 10, 270 1.1 christos fill_lines(" ", $COLUMNS - 10, 271 1.1 christos @{$unified_info{htmldocs}->{man3}})) -} 272 1.1 christos HTMLDOCS5={- 273 1.1 christos join(" \\\n" . ' ' x 10, 274 1.1 christos fill_lines(" ", $COLUMNS - 10, 275 1.1 christos @{$unified_info{htmldocs}->{man5}})) -} 276 1.1 christos HTMLDOCS7={- 277 1.1 christos join(" \\\n" . ' ' x 10, 278 1.1 christos fill_lines(" ", $COLUMNS - 10, 279 1.1 christos @{$unified_info{htmldocs}->{man7}})) -} 280 1.1 christos MANDOCS1={- 281 1.1 christos join(" \\\n" . ' ' x 9, 282 1.1 christos fill_lines(" ", $COLUMNS - 9, 283 1.1 christos @{$unified_info{mandocs}->{man1}})) -} 284 1.1 christos MANDOCS3={- 285 1.1 christos join(" \\\n" . ' ' x 9, 286 1.1 christos fill_lines(" ", $COLUMNS - 9, 287 1.1 christos @{$unified_info{mandocs}->{man3}})) -} 288 1.1 christos MANDOCS5={- 289 1.1 christos join(" \\\n" . ' ' x 9, 290 1.1 christos fill_lines(" ", $COLUMNS - 9, 291 1.1 christos @{$unified_info{mandocs}->{man5}})) -} 292 1.1 christos MANDOCS7={- 293 1.1 christos join(" \\\n" . ' ' x 9, 294 1.1 christos fill_lines(" ", $COLUMNS - 9, 295 1.1 christos @{$unified_info{mandocs}->{man7}})) -} 296 1.1 christos 297 1.1 christos APPS_OPENSSL="{- use File::Spec::Functions; 298 1.1 christos catfile("apps","openssl") -}" 299 1.1 christos 300 1.1 christos # DESTDIR is for package builders so that they can configure for, say, 301 1.1 christos # /usr/ and yet have everything installed to /tmp/somedir/usr/. 302 1.1 christos # Normally it is left empty. 303 1.1 christos DESTDIR= 304 1.1 christos 305 1.1 christos # Do not edit these manually. Use Configure with --prefix or --openssldir 306 1.1 christos # to change this! Short explanation in the top comment in Configure 307 1.1 christos INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet 308 1.1 christos # 309 1.1 christos our $prefix = $config{prefix} || "/usr/local"; 310 1.1 christos $prefix -} 311 1.1 christos OPENSSLDIR={- # 312 1.1 christos # The logic here is that if no --openssldir was given, 313 1.1 christos # OPENSSLDIR will get the value from $prefix plus "/ssl". 314 1.1 christos # If --openssldir was given and the value is an absolute 315 1.1 christos # path, OPENSSLDIR will get its value without change. 316 1.1 christos # If the value from --openssldir is a relative path, 317 1.1 christos # OPENSSLDIR will get $prefix with the --openssldir 318 1.1 christos # value appended as a subdirectory. 319 1.1 christos # 320 1.1 christos use File::Spec::Functions; 321 1.1 christos our $openssldir = 322 1.1 christos $config{openssldir} ? 323 1.1 christos (file_name_is_absolute($config{openssldir}) ? 324 1.1 christos $config{openssldir} 325 1.1 christos : catdir($prefix, $config{openssldir})) 326 1.1 christos : catdir($prefix, "ssl"); 327 1.1 christos $openssldir -} 328 1.1 christos LIBDIR={- our $libdir = $config{libdir}; 329 1.1 christos unless ($libdir) { 330 1.1 christos $libdir = "lib$target{multilib}"; 331 1.1 christos } 332 1.1 christos file_name_is_absolute($libdir) ? "" : $libdir -} 333 1.1 christos # $(libdir) is chosen to be compatible with the GNU coding standards 334 1.1 christos libdir={- file_name_is_absolute($libdir) 335 1.1 christos ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -} 336 1.1 christos ENGINESDIR=$(libdir)/engines-{- $sover_dirname -} 337 1.1 christos MODULESDIR=$(libdir)/ossl-modules 338 1.1 christos 339 1.1 christos # Convenience variable for those who want to set the rpath in shared 340 1.1 christos # libraries and applications 341 1.1 christos LIBRPATH=$(libdir) 342 1.1 christos 343 1.1 christos BINDIR={- our $bindir = $config{bindir}; 344 1.1 christos unless ($bindir) { 345 1.1 christos $bindir = "bin$target{multibin}"; 346 1.1 christos } 347 1.1 christos file_name_is_absolute($bindir) ? "" : $bindir -} 348 1.1 christos bindir={- file_name_is_absolute($bindir) 349 1.1 christos ? $bindir : '$(INSTALLTOP)/$(BINDIR)' -} 350 1.1 christos 351 1.1 christos PKGCONFIGDIR=$(libdir)/pkgconfig 352 1.1 christos CMAKECONFIGDIR=$(libdir)/cmake/OpenSSL 353 1.1 christos 354 1.1 christos MANDIR=$(INSTALLTOP)/share/man 355 1.1 christos DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) 356 1.1 christos HTMLDIR=$(DOCDIR)/html 357 1.1 christos 358 1.1 christos # MANSUFFIX is for the benefit of anyone who may want to have a suffix 359 1.1 christos # appended after the manpage file section number. "ssl" is popular, 360 1.1 christos # resulting in files such as config.5ssl rather than config.5. 361 1.1 christos MANSUFFIX=ossl 362 1.1 christos HTMLSUFFIX=html 363 1.1 christos 364 1.1 christos # For "optional" echo messages, to get "real" silence 365 1.1 christos ECHO = echo 366 1.1 christos 367 1.1 christos ##### User defined commands and flags ################################ 368 1.1 christos 369 1.1 christos # We let the C compiler driver to take care of .s files. This is done in 370 1.1 christos # order to be excused from maintaining a separate set of architecture 371 1.1 christos # dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC 372 1.1 christos # gcc, then the driver will automatically translate it to -xarch=v8plus 373 1.1 christos # and pass it down to assembler. In any case, we do not define AS or 374 1.1 christos # ASFLAGS for this reason. 375 1.1 christos 376 1.1 christos CROSS_COMPILE={- $config{CROSS_COMPILE} -} 377 1.1 christos CC=$(CROSS_COMPILE){- $config{CC} -} 378 1.1 christos CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -} 379 1.1 christos CPPFLAGS={- our $cppflags1 = join(" ", 380 1.1 christos (map { "-D".$_} @{$config{CPPDEFINES}}), 381 1.1 christos (map { "-I".$_} @{$config{CPPINCLUDES}}), 382 1.1 christos @{$config{CPPFLAGS}}) -} 383 1.1 christos CFLAGS={- join(' ', @{$config{CFLAGS}}) -} 384 1.1 christos CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -} 385 1.1 christos LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -} 386 1.1 christos EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -} 387 1.1 christos OBJCOPY={- $config{OBJCOPY} -} 388 1.1 christos 389 1.1 christos MAKEDEPEND={- $config{makedepcmd} -} 390 1.1 christos 391 1.1 christos PERL={- $config{PERL} -} 392 1.1 christos 393 1.1 christos AR=$(CROSS_COMPILE){- $config{AR} -} 394 1.1 christos ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -} 395 1.1 christos RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -} 396 1.1 christos RC= $(CROSS_COMPILE){- $config{RC} -} 397 1.1 christos RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -} 398 1.1 christos 399 1.1 christos RM= rm -f 400 1.1 christos RMDIR= rmdir 401 1.1 christos TAR= {- $target{TAR} || "tar" -} 402 1.1 christos TARFLAGS= {- $target{TARFLAGS} -} 403 1.1 christos 404 1.1 christos BASENAME= openssl 405 1.1 christos NAME= $(BASENAME)-$(VERSION) 406 1.1 christos # Relative to $(SRCDIR) 407 1.1 christos TARFILE= ../$(NAME).tar 408 1.1 christos 409 1.1 christos ##### Project flags ################################################## 410 1.1 christos 411 1.1 christos # Variables starting with CNF_ are common variables for all product types 412 1.1 christos 413 1.1 christos CNF_CPPFLAGS={- our $cppflags2 = 414 1.1 christos join(' ', $target{cppflags} || (), 415 1.1 christos (map { "-D".$_} @{$target{defines}}, 416 1.1 christos @{$config{defines}}), 417 1.1 christos (map { "-I".$_} @{$target{includes}}, 418 1.1 christos @{$config{includes}}), 419 1.1 christos @{$config{cppflags}}) -} 420 1.1 christos CNF_CFLAGS={- join(' ', $target{cflags} || (), 421 1.1 christos @{$config{cflags}}) -} 422 1.1 christos CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (), 423 1.1 christos @{$config{cxxflags}}) -} 424 1.1 christos CNF_LDFLAGS={- join(' ', $target{lflags} || (), 425 1.1 christos @{$config{lflags}}) -} 426 1.1 christos CNF_EX_LIBS={- join(' ', $target{ex_libs} || (), 427 1.1 christos @{$config{ex_libs}}) -} 428 1.1 christos 429 1.1 christos # Variables starting with LIB_ are used to build library object files 430 1.1 christos # and shared libraries. 431 1.1 christos # Variables starting with DSO_ are used to build DSOs and their object files. 432 1.1 christos # Variables starting with BIN_ are used to build programs and their object 433 1.1 christos # files. 434 1.1 christos 435 1.1 christos LIB_CPPFLAGS={- our $lib_cppflags = 436 1.1 christos join(' ', $target{lib_cppflags} || (), 437 1.1 christos $target{shared_cppflag} || (), 438 1.1 christos (map { '-D'.$_ } 439 1.1 christos @{$target{lib_defines} || ()}, 440 1.1 christos @{$target{shared_defines} || ()}, 441 1.1 christos @{$config{lib_defines} || ()}, 442 1.1 christos @{$config{shared_defines} || ()}), 443 1.1 christos (map { '-I'.quotify1($_) } 444 1.1 christos @{$target{lib_includes}}, 445 1.1 christos @{$target{shared_includes}}, 446 1.1 christos @{$config{lib_includes}}, 447 1.1 christos @{$config{shared_includes}}), 448 1.1 christos @{$config{lib_cppflags}}, 449 1.1 christos @{$config{shared_cppflag}}); 450 1.1 christos join(' ', $lib_cppflags, 451 1.1 christos (map { '-D'.$_ } 452 1.1 christos 'OPENSSLDIR="\"$(OPENSSLDIR)\""', 453 1.1 christos 'ENGINESDIR="\"$(ENGINESDIR)\""', 454 1.1 christos 'MODULESDIR="\"$(MODULESDIR)\""'), 455 1.1 christos '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 456 1.1 christos LIB_CFLAGS={- join(' ', $target{lib_cflags} || (), 457 1.1 christos $target{shared_cflag} || (), 458 1.1 christos @{$config{lib_cflags}}, 459 1.1 christos @{$config{shared_cflag}}, 460 1.1 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 461 1.1 christos LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (), 462 1.1 christos $target{shared_cxxflag} || (), 463 1.1 christos @{$config{lib_cxxflags}}, 464 1.1 christos @{$config{shared_cxxflag}}, 465 1.1 christos '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} 466 1.1 christos LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (), 467 1.1 christos $config{shared_ldflag} || (), 468 1.1 christos '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 469 1.1 christos LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 470 1.1 christos DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (), 471 1.1 christos $target{module_cppflags} || (), 472 1.1 christos (map { '-D'.$_ } 473 1.1 christos @{$target{dso_defines}}, 474 1.1 christos @{$target{module_defines}}, 475 1.1 christos @{$config{dso_defines} || ()}, 476 1.1 christos @{$config{module_defines} || ()}), 477 1.1 christos (map { '-I'.quotify1($_) } 478 1.1 christos @{$target{dso_includes}}, 479 1.1 christos @{$target{module_includes}}, 480 1.1 christos @{$config{dso_includes}}, 481 1.1 christos @{$config{module_includes}}), 482 1.1 christos @{$config{dso_cppflags}}, 483 1.1 christos @{$config{module_cppflags}}, 484 1.1 christos '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 485 1.1 christos DSO_CFLAGS={- join(' ', $target{dso_cflags} || (), 486 1.1 christos $target{module_cflags} || (), 487 1.1 christos @{$config{dso_cflags}}, 488 1.1 christos @{$config{module_cflags}}, 489 1.1 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 490 1.1 christos DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (), 491 1.1 christos $target{module_cxxflags} || (), 492 1.1 christos @{$config{dso_cxxflags}}, 493 1.1 christos @{$config{module_cxxflag}}, 494 1.1 christos '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} 495 1.1 christos DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (), 496 1.1 christos $target{module_ldflags} || (), 497 1.1 christos @{$config{dso_ldflags}}, 498 1.1 christos @{$config{module_ldflags}}, 499 1.1 christos '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 500 1.1 christos DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 501 1.1 christos BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (), 502 1.1 christos (map { '-D'.$_ } @{$config{bin_defines} || ()}), 503 1.1 christos @{$config{bin_cppflags}}, 504 1.1 christos '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 505 1.1 christos BIN_CFLAGS={- join(' ', $target{bin_cflags} || (), 506 1.1 christos @{$config{bin_cflags}}, 507 1.1 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 508 1.1 christos BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (), 509 1.1 christos @{$config{bin_cxxflags}}, 510 1.1 christos '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} 511 1.1 christos BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (), 512 1.1 christos @{$config{bin_lflags}}, 513 1.1 christos '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 514 1.1 christos BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 515 1.1 christos 516 1.1 christos # CPPFLAGS_Q is used for one thing only: to build up buildinf.h 517 1.1 christos CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g; 518 1.1 christos $cppflags2 =~ s|([\\"])|\\$1|g; 519 1.1 christos $lib_cppflags =~ s|([\\"])|\\$1|g; 520 1.1 christos join(' ', $lib_cppflags || (), $cppflags2 || (), 521 1.1 christos $cppflags1 || ()) -} 522 1.1 christos 523 1.1 christos PERLASM_SCHEME= {- $target{perlasm_scheme} -} 524 1.1 christos 525 1.1 christos # For x86 assembler: Set PROCESSOR to 386 if you want to support 526 1.1 christos # the 80386. 527 1.1 christos PROCESSOR= {- $config{processor} -} 528 1.1 christos 529 1.1 christos # We want error [and other] messages in English. Trouble is that make(1) 530 1.1 christos # doesn't pass macros down as environment variables unless there already 531 1.1 christos # was corresponding variable originally set. In other words we can only 532 1.1 christos # reassign environment variables, but not set new ones, not in portable 533 1.1 christos # manner that is. That's why we reassign several, just to be sure... 534 1.1 christos LC_ALL=C 535 1.1 christos LC_MESSAGES=C 536 1.1 christos LANG=C 537 1.1 christos 538 1.1 christos # The main targets ################################################### 539 1.1 christos 540 1.1 christos ##@ Software 541 1.1 christos 542 1.1 christos {- dependmagic('build_sw', 'Build all the software (default target)'); -}: build_libs_nodep build_modules_nodep build_programs_nodep link-utils 543 1.1 christos {- dependmagic('build_libs', 'Build the libraries libssl and libcrypto'); -}: build_libs_nodep 544 1.1 christos {- dependmagic('build_modules', 'Build the modules (i.e. providers and engines)'); -}: build_modules_nodep 545 1.1 christos {- dependmagic('build_programs', 'Build the openssl executables and scripts'); -}: build_programs_nodep 546 1.1 christos 547 1.1 christos all: build_sw {- "build_docs" if !$disabled{docs}; -} ## Build software and documentation 548 1.1 christos debuginfo: $(SHLIBS) 549 1.1 christos @set -e; for i in $(SHLIBS); do \ 550 1.1 christos $(OBJCOPY) --only-keep-debug $$i $$i.debug; \ 551 1.1 christos $(OBJCOPY) --strip-debug --add-gnu-debuglink=$$i.debug $$i; \ 552 1.1 christos done; 553 1.1 christos 554 1.1 christos ##@ Documentation 555 1.1 christos build_generated_pods: $(GENERATED_PODS) 556 1.1 christos build_docs: build_man_docs build_html_docs ## Create documentation 557 1.1 christos build_man_docs: $(MANDOCS1) $(MANDOCS3) $(MANDOCS5) $(MANDOCS7) ## Create manpages 558 1.1 christos build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) ## Create HTML documentation 559 1.1 christos 560 1.1 christos build_generated: $(GENERATED_MANDATORY) 561 1.1 christos build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_simple($_) // platform->sharedlib_import($_) // platform->sharedlib($_) // () } @{$unified_info{libraries}}) -} 562 1.1 christos build_modules_nodep: $(MODULES) 563 1.1 christos build_programs_nodep: $(PROGRAMS) $(SCRIPTS) 564 1.1 christos 565 1.1 christos # Kept around for backward compatibility 566 1.1 christos build_apps build_tests: build_programs 567 1.1 christos 568 1.1 christos # Convenience target to prebuild all generated files, not just the mandatory 569 1.1 christos # ones 570 1.1 christos build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs 571 1.1 christos @ : {- output_off() if $disabled{makedepend}; "" -} 572 1.1 christos @echo "Warning: consider configuring with no-makedepend, because if" 573 1.1 christos @echo " target system doesn't have $(PERL)," 574 1.1 christos @echo " then make will fail..." 575 1.1 christos @ : {- output_on() if $disabled{makedepend}; "" -} 576 1.1 christos 577 1.1 christos ##@ Help 578 1.1 christos .PHONY: help 579 1.1 christos help: ## Show this help screen 580 1.1 christos @$(PERL) $(SRCDIR)/util/help.pl $(BLDDIR)/Makefile 581 1.1 christos 582 1.1 christos ##@ Testing 583 1.1 christos test: tests ## Run tests (alias of "tests") 584 1.1 christos {- dependmagic('tests', 'Run tests'); -}: build_programs_nodep build_modules_nodep link-utils 585 1.1 christos "$(MAKE)" run_tests 586 1.1 christos run_tests: FORCE 587 1.1 christos @ : {- output_off() if $disabled{tests}; "" -} 588 1.1 christos ( SRCTOP=$(SRCDIR) \ 589 1.1 christos BLDTOP=$(BLDDIR) \ 590 1.1 christos PERL="$(PERL)" \ 591 1.1 christos FIPSKEY="$(FIPSKEY)" \ 592 1.1 christos EXE_EXT={- platform->binext() -} \ 593 1.1 christos $(PERL) $(SRCDIR)/test/run_tests.pl $(TESTS) ) 594 1.1 christos @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} 595 1.1 christos @echo "Tests are not supported with your chosen Configure options" 596 1.1 christos @ : {- output_on() if !$disabled{tests}; "" -} 597 1.1 christos 598 1.1 christos list-tests: ## List available tests that can be invoked via "make test TESTS=<name>" 599 1.1 christos @ : {- output_off() if $disabled{tests}; "" -} 600 1.1 christos "$(MAKE)" run_tests TESTS=list 601 1.1 christos @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} 602 1.1 christos @echo "Tests are not supported with your chosen Configure options" 603 1.1 christos @ : {- output_on() if !$disabled{tests}; "" -} 604 1.1 christos 605 1.1 christos ##@ Workspace cleaning 606 1.1 christos 607 1.1 christos libclean: 608 1.1 christos @set -e; for s in $(SHLIB_INFO); do \ 609 1.1 christos if [ "$$s" = ";" ]; then continue; fi; \ 610 1.1 christos s1=`echo "$$s" | cut -f1 -d";"`; \ 611 1.1 christos s2=`echo "$$s" | cut -f2 -d";"`; \ 612 1.1 christos s3=`echo "$$s" | cut -f3 -d";"`; \ 613 1.1 christos $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\ 614 1.1 christos $(RM) apps/$$s1; \ 615 1.1 christos $(RM) test/$$s1; \ 616 1.1 christos $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\ 617 1.1 christos $(RM) $$s1; \ 618 1.1 christos if [ "$$s2" != "" ]; then \ 619 1.1 christos $(ECHO) $(RM) $$s2; \ 620 1.1 christos $(RM) $$s2; \ 621 1.1 christos fi; \ 622 1.1 christos if [ "$$s3" != "" ]; then \ 623 1.1 christos $(ECHO) $(RM) $$s3; \ 624 1.1 christos $(RM) $$s3; \ 625 1.1 christos fi; \ 626 1.1 christos done 627 1.1 christos $(RM) $(LIBS) 628 1.1 christos $(RM) *{- platform->defext() -} 629 1.1 christos 630 1.1 christos clean: libclean ## Clean the workspace, keep the configuration 631 1.1 christos $(RM) $(HTMLDOCS1) 632 1.1 christos $(RM) $(HTMLDOCS3) 633 1.1 christos $(RM) $(HTMLDOCS5) 634 1.1 christos $(RM) $(HTMLDOCS7) 635 1.1 christos $(RM) $(MANDOCS1) 636 1.1 christos $(RM) $(MANDOCS3) 637 1.1 christos $(RM) $(MANDOCS5) 638 1.1 christos $(RM) $(MANDOCS7) 639 1.1 christos $(RM) $(PROGRAMS) $(TESTPROGS) $(MODULES) $(FIPSMODULE) $(SCRIPTS) 640 1.1 christos $(RM) $(GENERATED_MANDATORY) $(GENERATED) 641 1.1 christos -find . -name '*{- platform->depext() -}' \! -name '.*' \! -type d -exec $(RM) {} \; 642 1.1 christos -find . -name '*{- platform->objext() -}' \! -name '.*' \! -type d -exec $(RM) {} \; 643 1.1 christos $(RM) core 644 1.1 christos $(RM) tags TAGS doc-nits md-nits 645 1.1 christos $(RM) -r test/test-runs 646 1.1 christos $(RM) providers/fips*.new 647 1.1 christos -find . -type l \! -name '.*' -exec $(RM) {} \; 648 1.1 christos 649 1.1 christos distclean: clean ## Clean and remove the configuration 650 1.1 christos $(RM) include/openssl/configuration.h 651 1.1 christos $(RM) configdata.pm 652 1.1 christos $(RM) Makefile 653 1.1 christos 654 1.1 christos # We check if any depfile is newer than Makefile and decide to 655 1.1 christos # concatenate only if that is true. 656 1.1 christos depend: Makefile 657 1.1 christos @: {- output_off() if $disabled{makedepend}; "" -} 658 1.1 christos @$(PERL) $(SRCDIR)/util/add-depends.pl "{- $makedep_scheme -}" 659 1.1 christos @: {- output_on() if $disabled{makedepend}; "" -} 660 1.1 christos 661 1.1 christos # Install helper targets ############################################# 662 1.1 christos ##@ Installation 663 1.1 christos 664 1.1 christos install: install_sw install_ssldirs {- "install_docs" if !$disabled{docs}; -} {- $disabled{fips} ? "" : "install_fips" -} ## Install software and documentation, create OpenSSL directories 665 1.1 christos 666 1.1 christos uninstall: {- "uninstall_docs" if !$disabled{docs}; -} uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -} ## Uninstall software and documentation 667 1.1 christos 668 1.1 christos install_sw: install_dev install_engines install_modules install_runtime ## Install just the software and libraries 669 1.1 christos 670 1.1 christos uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev ## Uninstall the software and libraries 671 1.1 christos 672 1.1 christos install_docs: install_man_docs install_html_docs ## Install manpages and HTML documentation 673 1.1 christos 674 1.1 christos uninstall_docs: uninstall_man_docs uninstall_html_docs ## Uninstall manpages and HTML documentation 675 1.1 christos $(RM) -r "$(DESTDIR)$(DOCDIR)" 676 1.1 christos 677 1.1 christos {- output_off() if $disabled{fips}; "" -} 678 1.1 christos install_fips: build_sw $(INSTALL_FIPSMODULECONF) 679 1.1 christos @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 680 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)" 681 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)" 682 1.1 christos @$(ECHO) "*** Installing FIPS module" 683 1.1 christos @$(ECHO) "install $(INSTALL_FIPSMODULE) -> $(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)" 684 1.1 christos @cp "$(INSTALL_FIPSMODULE)" "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new" 685 1.1 christos @chmod 755 "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new" 686 1.1 christos @mv -f "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME).new" \ 687 1.1 christos "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)" 688 1.1 christos @$(ECHO) "*** Installing FIPS module configuration" 689 1.1 christos @$(ECHO) "install $(INSTALL_FIPSMODULECONF) -> $(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf" 690 1.1 christos @cp $(INSTALL_FIPSMODULECONF) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf" 691 1.1 christos 692 1.1 christos uninstall_fips: 693 1.1 christos @$(ECHO) "*** Uninstalling FIPS module configuration" 694 1.1 christos $(RM) "$(DESTDIR)$(OPENSSLDIR)/fipsmodule.cnf" 695 1.1 christos @$(ECHO) "*** Uninstalling FIPS module" 696 1.1 christos $(RM) "$(DESTDIR)$(MODULESDIR)/$(FIPSMODULENAME)" 697 1.1 christos {- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -} 698 1.1 christos install_fips: 699 1.1 christos @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option" 700 1.1 christos 701 1.1 christos uninstall_fips: 702 1.1 christos @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option" 703 1.1 christos {- output_on() if !$disabled{fips}; "" -} 704 1.1 christos 705 1.1 christos 706 1.1 christos install_ssldirs: 707 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/certs" 708 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/private" 709 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/misc" 710 1.1 christos @set -e; for x in dummy $(MISC_SCRIPTS); do \ 711 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 712 1.1 christos x1=`echo "$$x" | cut -f1 -d:`; \ 713 1.1 christos x2=`echo "$$x" | cut -f2 -d:`; \ 714 1.1 christos fn=`basename $$x1`; \ 715 1.1 christos $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 716 1.1 christos cp $$x1 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \ 717 1.1 christos chmod 755 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \ 718 1.1 christos mv -f "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new" \ 719 1.1 christos "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 720 1.1 christos if [ "$$x1" != "$$x2" ]; then \ 721 1.1 christos ln=`basename "$$x2"`; \ 722 1.1 christos : {- output_off() unless windowsdll(); "" -}; \ 723 1.1 christos $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 724 1.1 christos cp "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn" "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \ 725 1.1 christos : {- output_on() unless windowsdll(); 726 1.1 christos output_off() if windowsdll(); "" -}; \ 727 1.1 christos $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 728 1.1 christos ln -sf $$fn "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \ 729 1.1 christos : {- output_on() if windowsdll(); "" -}; \ 730 1.1 christos fi; \ 731 1.1 christos done 732 1.1 christos @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" 733 1.1 christos @cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" 734 1.1 christos @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" 735 1.1 christos @mv -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" 736 1.1 christos @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ 737 1.1 christos $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ 738 1.1 christos cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ 739 1.1 christos chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ 740 1.1 christos fi 741 1.1 christos @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" 742 1.1 christos @cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" 743 1.1 christos @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" 744 1.1 christos @mv -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" 745 1.1 christos @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \ 746 1.1 christos $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ 747 1.1 christos cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ 748 1.1 christos chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ 749 1.1 christos fi 750 1.1 christos 751 1.1 christos install_dev: install_runtime_libs 752 1.1 christos @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 753 1.1 christos @$(ECHO) "*** Installing development files" 754 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/include/openssl" 755 1.1 christos @ : {- output_off() if $disabled{uplink}; "" -} 756 1.1 christos @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 757 1.1 christos @cp $(SRCDIR)/ms/applink.c "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 758 1.1 christos @chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 759 1.1 christos @ : {- output_on() if $disabled{uplink}; "" -} 760 1.1 christos @set -e; for i in $(SRCDIR)/include/openssl/*.h \ 761 1.1 christos $(BLDDIR)/include/openssl/*.h; do \ 762 1.1 christos fn=`basename $$i`; \ 763 1.1 christos $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 764 1.1 christos cp $$i "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 765 1.1 christos chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 766 1.1 christos done 767 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" 768 1.1 christos @set -e; for l in $(INSTALL_LIBS); do \ 769 1.1 christos fn=`basename $$l`; \ 770 1.1 christos $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \ 771 1.1 christos cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \ 772 1.1 christos $(RANLIB) "$(DESTDIR)$(libdir)/$$fn.new"; \ 773 1.1 christos chmod 644 "$(DESTDIR)$(libdir)/$$fn.new"; \ 774 1.1 christos mv -f "$(DESTDIR)$(libdir)/$$fn.new" \ 775 1.1 christos "$(DESTDIR)$(libdir)/$$fn"; \ 776 1.1 christos done 777 1.1 christos @ : {- output_off() if $disabled{shared}; "" -} 778 1.1 christos @set -e; for s in $(INSTALL_SHLIB_INFO); do \ 779 1.1 christos s1=`echo "$$s" | cut -f1 -d";"`; \ 780 1.1 christos s2=`echo "$$s" | cut -f2 -d";"`; \ 781 1.1 christos s3=`echo "$$s" | cut -f3 -d";"`; \ 782 1.1 christos fn1=`basename "$$s1"`; \ 783 1.1 christos fn2=`basename "$$s2"`; \ 784 1.1 christos fn3=`basename "$$s3"`; \ 785 1.1 christos : {- output_off(); output_on() unless windowsdll() or sharedaix() or sharedaix_solib(); "" -}; \ 786 1.1 christos if [ "$$fn2" != "" ]; then \ 787 1.1 christos $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \ 788 1.1 christos ln -sf $$fn1 "$(DESTDIR)$(libdir)/$$fn2"; \ 789 1.1 christos fi; \ 790 1.1 christos : {- output_off() unless windowsdll() or sharedaix() or sharedaix_solib(); output_on() if windowsdll() or sharedaix_solib(); "" -}; \ 791 1.1 christos if [ "$$fn3" != "" ]; then \ 792 1.1 christos $(ECHO) "install $$s3 -> $(DESTDIR)$(libdir)/$$fn3"; \ 793 1.1 christos cp $$s3 "$(DESTDIR)$(libdir)/$$fn3.new"; \ 794 1.1 christos chmod 755 "$(DESTDIR)$(libdir)/$$fn3.new"; \ 795 1.1 christos mv -f "$(DESTDIR)$(libdir)/$$fn3.new" \ 796 1.1 christos "$(DESTDIR)$(libdir)/$$fn3"; \ 797 1.1 christos fi; \ 798 1.1 christos : {- output_off() if windowsdll() or sharedaix_solib(); output_on() if sharedaix(); "" -}; \ 799 1.1 christos a="$(DESTDIR)$(libdir)/$$fn2"; \ 800 1.1 christos $(ECHO) "install $$s1 -> $$a"; \ 801 1.1 christos if [ -f $$a ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \ 802 1.1 christos mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \ 803 1.1 christos cp -f $$a $$a.new; \ 804 1.1 christos for so in `$(AR) t $$a`; do \ 805 1.1 christos $(AR) x $$a $$so; \ 806 1.1 christos chmod u+w $$so; \ 807 1.1 christos strip -X32_64 -e $$so; \ 808 1.1 christos $(AR) r $$a.new $$so; \ 809 1.1 christos done; \ 810 1.1 christos )); fi; \ 811 1.1 christos $(AR) r $$a.new $$s1; \ 812 1.1 christos mv -f $$a.new $$a; \ 813 1.1 christos : {- output_off() if sharedaix(); output_on(); "" -}; \ 814 1.1 christos done 815 1.1 christos @ : {- output_on() if $disabled{shared}; "" -} 816 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(PKGCONFIGDIR)" 817 1.1 christos @for e in $(INSTALL_EXPORTERS_PKGCONFIG); do \ 818 1.1 christos fn=`basename $$e`; \ 819 1.1 christos $(ECHO) "install $$e -> $(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \ 820 1.1 christos cp $$e "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \ 821 1.1 christos chmod 644 "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \ 822 1.1 christos done 823 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(CMAKECONFIGDIR)" 824 1.1 christos @for e in $(INSTALL_EXPORTERS_CMAKE); do \ 825 1.1 christos fn=`basename $$e`; \ 826 1.1 christos $(ECHO) "install $$e -> $(DESTDIR)$(CMAKECONFIGDIR)/$$fn"; \ 827 1.1 christos cp $$e "$(DESTDIR)$(CMAKECONFIGDIR)/$$fn"; \ 828 1.1 christos chmod 644 "$(DESTDIR)$(CMAKECONFIGDIR)/$$fn"; \ 829 1.1 christos done 830 1.1 christos 831 1.1 christos uninstall_dev: uninstall_runtime_libs 832 1.1 christos @$(ECHO) "*** Uninstalling development files" 833 1.1 christos @ : {- output_off() if $disabled{uplink}; "" -} 834 1.1 christos @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 835 1.1 christos @$(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 836 1.1 christos @ : {- output_on() if $disabled{uplink}; "" -} 837 1.1 christos @set -e; for i in $(SRCDIR)/include/openssl/*.h \ 838 1.1 christos $(BLDDIR)/include/openssl/*.h; do \ 839 1.1 christos fn=`basename $$i`; \ 840 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 841 1.1 christos $(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 842 1.1 christos done 843 1.1 christos -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include/openssl" 844 1.1 christos -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include" 845 1.1 christos @set -e; for l in $(INSTALL_LIBS); do \ 846 1.1 christos fn=`basename $$l`; \ 847 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \ 848 1.1 christos $(RM) "$(DESTDIR)$(libdir)/$$fn"; \ 849 1.1 christos done 850 1.1 christos @ : {- output_off() if $disabled{shared}; "" -} 851 1.1 christos @set -e; for s in $(INSTALL_SHLIB_INFO); do \ 852 1.1 christos s1=`echo "$$s" | cut -f1 -d";"`; \ 853 1.1 christos s2=`echo "$$s" | cut -f2 -d";"`; \ 854 1.1 christos s3=`echo "$$s" | cut -f3 -d";"`; \ 855 1.1 christos fn1=`basename "$$s1"`; \ 856 1.1 christos fn2=`basename "$$s2"`; \ 857 1.1 christos fn3=`basename "$$s3"`; \ 858 1.1 christos : {- output_off() if windowsdll(); "" -}; \ 859 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \ 860 1.1 christos $(RM) "$(DESTDIR)$(libdir)/$$fn1"; \ 861 1.1 christos if [ -n "$$fn2" ]; then \ 862 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ 863 1.1 christos $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \ 864 1.1 christos fi; \ 865 1.1 christos : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ 866 1.1 christos if [ -n "$$fn3" ]; then \ 867 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn3"; \ 868 1.1 christos $(RM) "$(DESTDIR)$(libdir)/$$fn3"; \ 869 1.1 christos fi; \ 870 1.1 christos : {- output_on() unless windowsdll(); "" -}; \ 871 1.1 christos done 872 1.1 christos @ : {- output_on() if $disabled{shared}; "" -} 873 1.1 christos @for e in $(INSTALL_EXPORTERS_PKGCONFIG); do \ 874 1.1 christos fn=`basename "$$e"`; \ 875 1.1 christos $(RM) "$(DESTDIR)$(PKGCONFIGDIR)/$$fn"; \ 876 1.1 christos done 877 1.1 christos @for e in $(INSTALL_EXPORTERS_CMAKE); do \ 878 1.1 christos fn=`basename "$$e"`; \ 879 1.1 christos $(RM) "$(DESTDIR)$(CMAKECONFIGDIR)/$$fn"; \ 880 1.1 christos done 881 1.1 christos -$(RMDIR) "$(DESTDIR)$(PKGCONFIGDIR)" 882 1.1 christos -$(RMDIR) "$(DESTDIR)$(CMAKECONFIGDIR)" 883 1.1.1.2 christos -$(RMDIR) "$(DESTDIR)$(libdir)/cmake" 884 1.1 christos -$(RMDIR) "$(DESTDIR)$(libdir)" 885 1.1 christos 886 1.1 christos _install_modules_deps: install_runtime_libs build_modules 887 1.1 christos 888 1.1 christos install_engines: _install_modules_deps 889 1.1 christos @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 890 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/" 891 1.1 christos @$(ECHO) "*** Installing engines" 892 1.1 christos @set -e; for e in dummy $(INSTALL_ENGINES); do \ 893 1.1 christos if [ "$$e" = "dummy" ]; then continue; fi; \ 894 1.1 christos fn=`basename $$e`; \ 895 1.1 christos $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ 896 1.1 christos cp $$e "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \ 897 1.1 christos chmod 755 "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \ 898 1.1 christos mv -f "$(DESTDIR)$(ENGINESDIR)/$$fn.new" \ 899 1.1 christos "$(DESTDIR)$(ENGINESDIR)/$$fn"; \ 900 1.1 christos done 901 1.1 christos 902 1.1 christos uninstall_engines: 903 1.1 christos @$(ECHO) "*** Uninstalling engines" 904 1.1 christos @set -e; for e in dummy $(INSTALL_ENGINES); do \ 905 1.1 christos if [ "$$e" = "dummy" ]; then continue; fi; \ 906 1.1 christos fn=`basename $$e`; \ 907 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ 908 1.1 christos $(RM) "$(DESTDIR)$(ENGINESDIR)/$$fn"; \ 909 1.1 christos done 910 1.1 christos -$(RMDIR) "$(DESTDIR)$(ENGINESDIR)" 911 1.1 christos 912 1.1 christos install_modules: _install_modules_deps 913 1.1 christos @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 914 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)/" 915 1.1 christos @$(ECHO) "*** Installing modules" 916 1.1 christos @set -e; for e in dummy $(INSTALL_MODULES); do \ 917 1.1 christos if [ "$$e" = "dummy" ]; then continue; fi; \ 918 1.1 christos fn=`basename $$e`; \ 919 1.1 christos $(ECHO) "install $$e -> $(DESTDIR)$(MODULESDIR)/$$fn"; \ 920 1.1 christos cp $$e "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \ 921 1.1 christos chmod 755 "$(DESTDIR)$(MODULESDIR)/$$fn.new"; \ 922 1.1 christos mv -f "$(DESTDIR)$(MODULESDIR)/$$fn.new" \ 923 1.1 christos "$(DESTDIR)$(MODULESDIR)/$$fn"; \ 924 1.1 christos done 925 1.1 christos 926 1.1 christos uninstall_modules: 927 1.1 christos @$(ECHO) "*** Uninstalling modules" 928 1.1 christos @set -e; for e in dummy $(INSTALL_MODULES); do \ 929 1.1 christos if [ "$$e" = "dummy" ]; then continue; fi; \ 930 1.1 christos fn=`basename $$e`; \ 931 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(MODULESDIR)/$$fn"; \ 932 1.1 christos $(RM) "$(DESTDIR)$(MODULESDIR)/$$fn"; \ 933 1.1 christos done 934 1.1 christos -$(RMDIR) "$(DESTDIR)$(MODULESDIR)" 935 1.1 christos 936 1.1 christos install_runtime: install_programs 937 1.1 christos 938 1.1 christos install_runtime_libs: build_libs 939 1.1 christos @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 940 1.1 christos @ : {- output_off() if windowsdll(); "" -} 941 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" 942 1.1 christos @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -} 943 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)/" 944 1.1 christos @ : {- output_on() unless windowsdll(); "" -} 945 1.1 christos @$(ECHO) "*** Installing runtime libraries" 946 1.1 christos @set -e; for s in dummy $(INSTALL_SHLIBS); do \ 947 1.1 christos if [ "$$s" = "dummy" ]; then continue; fi; \ 948 1.1 christos fn=`basename $$s`; \ 949 1.1 christos : {- output_off() unless windowsdll(); "" -}; \ 950 1.1 christos $(ECHO) "install $$s -> $(DESTDIR)$(bindir)/$$fn"; \ 951 1.1 christos cp $$s "$(DESTDIR)$(bindir)/$$fn.new"; \ 952 1.1 christos chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \ 953 1.1 christos mv -f "$(DESTDIR)$(bindir)/$$fn.new" \ 954 1.1 christos "$(DESTDIR)$(bindir)/$$fn"; \ 955 1.1 christos : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ 956 1.1 christos $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \ 957 1.1 christos cp $$s "$(DESTDIR)$(libdir)/$$fn.new"; \ 958 1.1 christos chmod 755 "$(DESTDIR)$(libdir)/$$fn.new"; \ 959 1.1 christos mv -f "$(DESTDIR)$(libdir)/$$fn.new" \ 960 1.1 christos "$(DESTDIR)$(libdir)/$$fn"; \ 961 1.1 christos : {- output_on() if windowsdll(); "" -}; \ 962 1.1 christos done 963 1.1 christos 964 1.1 christos install_programs: install_runtime_libs build_programs 965 1.1 christos @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 966 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(bindir)" 967 1.1 christos @$(ECHO) "*** Installing runtime programs" 968 1.1 christos @set -e; for x in dummy $(INSTALL_PROGRAMS); do \ 969 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 970 1.1 christos fn=`basename $$x`; \ 971 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \ 972 1.1 christos cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \ 973 1.1 christos chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \ 974 1.1 christos mv -f "$(DESTDIR)$(bindir)/$$fn.new" \ 975 1.1 christos "$(DESTDIR)$(bindir)/$$fn"; \ 976 1.1 christos done 977 1.1 christos @set -e; for x in dummy $(BIN_SCRIPTS); do \ 978 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 979 1.1 christos fn=`basename $$x`; \ 980 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(bindir)/$$fn"; \ 981 1.1 christos cp $$x "$(DESTDIR)$(bindir)/$$fn.new"; \ 982 1.1 christos chmod 755 "$(DESTDIR)$(bindir)/$$fn.new"; \ 983 1.1 christos mv -f "$(DESTDIR)$(bindir)/$$fn.new" \ 984 1.1 christos "$(DESTDIR)$(bindir)/$$fn"; \ 985 1.1 christos done 986 1.1 christos 987 1.1 christos uninstall_runtime: uninstall_programs uninstall_runtime_libs 988 1.1 christos 989 1.1 christos uninstall_programs: 990 1.1 christos @$(ECHO) "*** Uninstalling runtime programs" 991 1.1 christos @set -e; for x in dummy $(INSTALL_PROGRAMS); \ 992 1.1 christos do \ 993 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 994 1.1 christos fn=`basename $$x`; \ 995 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \ 996 1.1 christos $(RM) "$(DESTDIR)$(bindir)/$$fn"; \ 997 1.1 christos done; 998 1.1 christos @set -e; for x in dummy $(BIN_SCRIPTS); \ 999 1.1 christos do \ 1000 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1001 1.1 christos fn=`basename $$x`; \ 1002 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \ 1003 1.1 christos $(RM) "$(DESTDIR)$(bindir)/$$fn"; \ 1004 1.1 christos done 1005 1.1 christos -$(RMDIR) "$(DESTDIR)$(bindir)" 1006 1.1 christos 1007 1.1 christos uninstall_runtime_libs: 1008 1.1 christos @$(ECHO) "*** Uninstalling runtime libraries" 1009 1.1 christos @ : {- output_off() unless windowsdll(); "" -} 1010 1.1 christos @set -e; for s in dummy $(INSTALL_SHLIBS); do \ 1011 1.1 christos if [ "$$s" = "dummy" ]; then continue; fi; \ 1012 1.1 christos fn=`basename $$s`; \ 1013 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(bindir)/$$fn"; \ 1014 1.1 christos $(RM) "$(DESTDIR)$(bindir)/$$fn"; \ 1015 1.1 christos done 1016 1.1 christos @ : {- output_on() unless windowsdll(); "" -} 1017 1.1 christos 1018 1.1 christos 1019 1.1 christos install_man_docs: build_man_docs 1020 1.1 christos @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 1021 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man1" 1022 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man3" 1023 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man5" 1024 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MANDIR)/man7" 1025 1.1 christos @$(ECHO) "*** Installing manpages" 1026 1.1 christos @set -e; for x in dummy $(MANDOCS1); do \ 1027 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1028 1.1 christos fn=`basename $$x`; \ 1029 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ 1030 1.1 christos cp $$x "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ 1031 1.1 christos chmod 644 "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ 1032 1.1 christos $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \ 1033 1.1 christos done 1034 1.1 christos @set -e; for x in dummy $(MANDOCS3); do \ 1035 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1036 1.1 christos fn=`basename $$x`; \ 1037 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ 1038 1.1 christos cp $$x "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ 1039 1.1 christos chmod 644 "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ 1040 1.1 christos $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \ 1041 1.1 christos done 1042 1.1 christos @set -e; for x in dummy $(MANDOCS5); do \ 1043 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1044 1.1 christos fn=`basename $$x`; \ 1045 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ 1046 1.1 christos cp $$x "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ 1047 1.1 christos chmod 644 "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ 1048 1.1 christos $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \ 1049 1.1 christos done 1050 1.1 christos @set -e; for x in dummy $(MANDOCS7); do \ 1051 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1052 1.1 christos fn=`basename $$x`; \ 1053 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ 1054 1.1 christos cp $$x "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ 1055 1.1 christos chmod 644 "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ 1056 1.1 christos $(PERL) $(SRCDIR)/util/write-man-symlinks install $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \ 1057 1.1 christos done 1058 1.1 christos 1059 1.1 christos uninstall_man_docs: build_man_docs 1060 1.1 christos @$(ECHO) "*** Uninstalling manpages" 1061 1.1 christos @set -e; for x in dummy $(MANDOCS1); do \ 1062 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1063 1.1 christos fn=`basename $$x`; \ 1064 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ 1065 1.1 christos $(RM) "$(DESTDIR)$(MANDIR)/man1/$${fn}$(MANSUFFIX)"; \ 1066 1.1 christos $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man1 $(BLDDIR)/doc/man1 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man1"; \ 1067 1.1 christos done 1068 1.1 christos @set -e; for x in dummy $(MANDOCS3); do \ 1069 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1070 1.1 christos fn=`basename $$x`; \ 1071 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ 1072 1.1 christos $(RM) "$(DESTDIR)$(MANDIR)/man3/$${fn}$(MANSUFFIX)"; \ 1073 1.1 christos $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man3 $(BLDDIR)/doc/man3 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man3"; \ 1074 1.1 christos done 1075 1.1 christos @set -e; for x in dummy $(MANDOCS5); do \ 1076 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1077 1.1 christos fn=`basename $$x`; \ 1078 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ 1079 1.1 christos $(RM) "$(DESTDIR)$(MANDIR)/man5/$${fn}$(MANSUFFIX)"; \ 1080 1.1 christos $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man5 $(BLDDIR)/doc/man5 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man5"; \ 1081 1.1 christos done 1082 1.1 christos @set -e; for x in dummy $(MANDOCS7); do \ 1083 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1084 1.1 christos fn=`basename $$x`; \ 1085 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ 1086 1.1 christos $(RM) "$(DESTDIR)$(MANDIR)/man7/$${fn}$(MANSUFFIX)"; \ 1087 1.1 christos $(PERL) $(SRCDIR)/util/write-man-symlinks uninstall $(SRCDIR)/doc/man7 $(BLDDIR)/doc/man7 $${fn}$(MANSUFFIX) "$(DESTDIR)$(MANDIR)/man7"; \ 1088 1.1 christos done 1089 1.1 christos 1090 1.1 christos install_html_docs: install_image_docs build_html_docs 1091 1.1 christos @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 1092 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man1" 1093 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man3" 1094 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man5" 1095 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7" 1096 1.1 christos @$(ECHO) "*** Installing HTML manpages" 1097 1.1 christos @set -e; for x in dummy $(HTMLDOCS1); do \ 1098 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1099 1.1 christos fn=`basename $$x`; \ 1100 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ 1101 1.1 christos cp $$x "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ 1102 1.1 christos chmod 644 "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ 1103 1.1 christos done 1104 1.1 christos @set -e; for x in dummy $(HTMLDOCS3); do \ 1105 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1106 1.1 christos fn=`basename $$x`; \ 1107 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ 1108 1.1 christos cp $$x "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ 1109 1.1 christos chmod 644 "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ 1110 1.1 christos done 1111 1.1 christos @set -e; for x in dummy $(HTMLDOCS5); do \ 1112 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1113 1.1 christos fn=`basename $$x`; \ 1114 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ 1115 1.1 christos cp $$x "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ 1116 1.1 christos chmod 644 "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ 1117 1.1 christos done 1118 1.1 christos @set -e; for x in dummy $(HTMLDOCS7); do \ 1119 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1120 1.1 christos fn=`basename $$x`; \ 1121 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ 1122 1.1 christos cp $$x "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ 1123 1.1 christos chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ 1124 1.1 christos done 1125 1.1 christos 1126 1.1 christos uninstall_html_docs: uninstall_image_docs 1127 1.1 christos @$(ECHO) "*** Uninstalling HTML manpages" 1128 1.1 christos @set -e; for x in dummy $(HTMLDOCS1); do \ 1129 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1130 1.1 christos fn=`basename $$x`; \ 1131 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ 1132 1.1 christos $(RM) "$(DESTDIR)$(HTMLDIR)/man1/$$fn"; \ 1133 1.1 christos done 1134 1.1 christos @set -e; for x in dummy $(HTMLDOCS3); do \ 1135 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1136 1.1 christos fn=`basename $$x`; \ 1137 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ 1138 1.1 christos $(RM) "$(DESTDIR)$(HTMLDIR)/man3/$$fn"; \ 1139 1.1 christos done 1140 1.1 christos @set -e; for x in dummy $(HTMLDOCS5); do \ 1141 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1142 1.1 christos fn=`basename $$x`; \ 1143 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ 1144 1.1 christos $(RM) "$(DESTDIR)$(HTMLDIR)/man5/$$fn"; \ 1145 1.1 christos done 1146 1.1 christos @set -e; for x in dummy $(HTMLDOCS7); do \ 1147 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1148 1.1 christos fn=`basename $$x`; \ 1149 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ 1150 1.1 christos $(RM) "$(DESTDIR)$(HTMLDIR)/man7/$$fn"; \ 1151 1.1 christos done 1152 1.1 christos 1153 1.1 christos install_image_docs: 1154 1.1 christos @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(HTMLDIR)/man7/img" 1155 1.1 christos @set -e; for x in dummy $(IMAGEDOCS7); do \ 1156 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1157 1.1 christos fn=`basename $$x`; \ 1158 1.1 christos $(ECHO) "install $$x -> $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \ 1159 1.1 christos cp $(SRCDIR)/$$x "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \ 1160 1.1 christos chmod 644 "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \ 1161 1.1 christos done 1162 1.1 christos 1163 1.1 christos uninstall_image_docs: 1164 1.1 christos @set -e; for x in dummy $(IMAGEDOCS7); do \ 1165 1.1 christos if [ "$$x" = "dummy" ]; then continue; fi; \ 1166 1.1 christos fn=`basename $$x`; \ 1167 1.1 christos $(ECHO) "$(RM) $(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \ 1168 1.1 christos $(RM) "$(DESTDIR)$(HTMLDIR)/man7/img/$$fn"; \ 1169 1.1 christos done 1170 1.1 christos 1171 1.1 christos # Developer targets (note: these are only available on Unix) ######### 1172 1.1 christos ##@ Code maintenance 1173 1.1 christos 1174 1.1 christos # It's important that generate_buildinfo comes after ordinals, as ordinals 1175 1.1 christos # is sensitive to build.info changes. 1176 1.1 christos update: generate errors ordinals generate_buildinfo ## Update errors, ordinals and build info 1177 1.1 christos 1178 1.1 christos .PHONY: generate generate_apps generate_crypto_bn generate_crypto_objects \ 1179 1.1 christos generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids 1180 1.1 christos generate: generate_apps generate_crypto_bn generate_crypto_objects \ 1181 1.1 christos generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids 1182 1.1 christos 1183 1.1 christos .PHONY: generate_buildinfo generate_doc_buildinfo 1184 1.1 christos generate_buildinfo: generate_doc_buildinfo 1185 1.1 christos 1186 1.1 christos .PHONY: doc-nits md-nits 1187 1.1 christos doc-nits: build_generated_pods ## Evaluate OpenSSL documentation 1188 1.1 christos $(PERL) $(SRCDIR)/util/find-doc-nits -c -n -l -e -i 1189 1.1 christos 1190 1.1 christos # This uses "mdl", the markdownlint application, which is written in ruby. 1191 1.1 christos # The source is at https://github.com/markdownlint/markdownlint 1192 1.1 christos # If you have ruby installed, "gem install mdl" should work. 1193 1.1 christos # Another option is at https://snapcraft.io/install/mdl/debian 1194 1.1 christos # Finally, there's a Node.js version, which we haven't tried, that 1195 1.1 christos # can be found at https://github.com/DavidAnson/markdownlint 1196 1.1 christos md-nits: ## Evaluate markdown files via "mdl" 1197 1.1 christos mdl -s $(SRCDIR)/util/markdownlint.rb . 1198 1.1 christos 1199 1.1 christos # Test coverage is a good idea for the future 1200 1.1 christos #coverage: $(PROGRAMS) $(TESTPROGRAMS) 1201 1.1 christos # ... 1202 1.1 christos 1203 1.1 christos .PHONY: lint 1204 1.1 christos lint: ## Evaluate C code via "splint" 1205 1.1 christos @( cd $(SRCDIR); \ 1206 1.1 christos echo splint -DLINT -posixlib -preproc -D__gnuc_va_list=void \ 1207 1.1 christos -I. -Iinclude -Iapps/include $(CRYPTOHEADERS) $(SSLHEADERS) $(SRCS) ) 1208 1.1 christos 1209 1.1.1.2 christos CLANG_FORMAT_DIFF = clang-format-diff 1210 1.1.1.2 christos 1211 1.1.1.2 christos .PHONY: check-format check-clang-format-diff-cmd 1212 1.1.1.2 christos check-clang-format-diff-cmd: 1213 1.1.1.2 christos @if ! command -v "$(CLANG_FORMAT_DIFF)" >/dev/null; then \ 1214 1.1.1.2 christos echo "Unable to find ${CLANG_FORMAT_DIFF}";\ 1215 1.1.1.2 christos echo "Please set the CLANG_FORMAT_DIFF variable to your clang-format-diff command";\ 1216 1.1.1.2 christos exit 1;\ 1217 1.1.1.2 christos fi 1218 1.1.1.2 christos 1219 1.1.1.2 christos check-format: check-clang-format-diff-cmd ## Evaluate C code according to OpenSSL coding standards 1220 1.1.1.2 christos ( cd $(SRCDIR); git diff -U0 --no-prefix --no-color | $(CLANG_FORMAT_DIFF) ) 1221 1.1 christos 1222 1.1 christos generate_apps: 1223 1.1 christos ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ 1224 1.1 christos < apps/openssl.cnf > apps/openssl-vms.cnf ) 1225 1.1 christos 1226 1.1 christos generate_crypto_bn: 1227 1.1 christos ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) 1228 1.1 christos 1229 1.1 christos generate_crypto_objects: 1230 1.1 christos ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \ 1231 1.1 christos crypto/objects/objects.txt \ 1232 1.1 christos crypto/objects/obj_mac.num \ 1233 1.1 christos > crypto/objects/obj_mac.new && \ 1234 1.1 christos mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num ) 1235 1.1 christos ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ 1236 1.1 christos crypto/objects/objects.txt \ 1237 1.1 christos crypto/objects/obj_mac.num \ 1238 1.1 christos > include/openssl/obj_mac.h ) 1239 1.1 christos ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ 1240 1.1 christos include/openssl/obj_mac.h \ 1241 1.1 christos > crypto/objects/obj_dat.h ) 1242 1.1 christos ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ 1243 1.1 christos crypto/objects/obj_mac.num \ 1244 1.1 christos crypto/objects/obj_xref.txt \ 1245 1.1 christos > crypto/objects/obj_xref.h ) 1246 1.1 christos ( cd $(SRCDIR); sed -e '1,8d' crypto/objects/obj_compat.h >> include/openssl/obj_mac.h ) 1247 1.1 christos 1248 1.1 christos generate_crypto_conf: 1249 1.1 christos ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ 1250 1.1 christos > crypto/conf/conf_def.h ) 1251 1.1 christos 1252 1.1 christos generate_crypto_asn1: 1253 1.1 christos ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ 1254 1.1 christos > crypto/asn1/charmap.h ) 1255 1.1 christos 1256 1.1 christos generate_fuzz_oids: 1257 1.1 christos ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \ 1258 1.1 christos crypto/objects/obj_dat.h \ 1259 1.1 christos > fuzz/oids.txt ) 1260 1.1 christos 1261 1.1 christos generate_doc_buildinfo: 1262 1.1 christos ( $(PERL) -I$(BLDDIR) -Mconfigdata \ 1263 1.1 christos $(SRCDIR)/util/dofile.pl -o Makefile \ 1264 1.1 christos $(SRCDIR)/doc/build.info.in \ 1265 1.1 christos > $(SRCDIR)/doc/build.info.new; \ 1266 1.1 christos if ( test -e $(SRCDIR)/doc/build.info \ 1267 1.1 christos && cmp $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info \ 1268 1.1 christos > /dev/null ); \ 1269 1.1 christos then \ 1270 1.1 christos rm $(SRCDIR)/doc/build.info.new; \ 1271 1.1 christos else \ 1272 1.1 christos mv $(SRCDIR)/doc/build.info.new $(SRCDIR)/doc/build.info; \ 1273 1.1 christos fi ) 1274 1.1 christos 1275 1.1 christos generate_fips_sources: providers/fips.module.sources.new 1276 1.1 christos providers/fips.module.sources.new: configdata.pm 1277 1.1 christos rm -rf sources-tmp 1278 1.1 christos mkdir sources-tmp 1279 1.1 christos ( \ 1280 1.1 christos srcdir=`cd $(SRCDIR); pwd`; \ 1281 1.1 christos cd sources-tmp \ 1282 1.1 christos && $$srcdir/Configure --banner=Configured enable-fips -O0 \ 1283 1.1 christos && ./configdata.pm --query 'get_sources("providers/fips")' > sources1 \ 1284 1.1 christos && "$(MAKE)" -sj 4 build_generated providers/fips.so \ 1285 1.1 christos && find . -name '*.d' | xargs cat > dep1 \ 1286 1.1 christos && "$(MAKE)" distclean \ 1287 1.1 christos && $$srcdir/Configure --banner=Configured enable-fips no-asm -O0 \ 1288 1.1 christos && ./configdata.pm --query 'get_sources("providers/fips")' > sources2 \ 1289 1.1 christos && "$(MAKE)" -sj 4 build_generated providers/fips.so \ 1290 1.1 christos && find . -name '*.d' | xargs cat > dep2 \ 1291 1.1 christos && cat sources1 sources2 \ 1292 1.1 christos | grep -v ' : \\$$' | grep -v util/providers.num \ 1293 1.1 christos | sed -e 's/^ *//' -e 's/ *\\$$//' \ 1294 1.1 christos | sort | uniq > sources \ 1295 1.1 christos && cat dep1 dep2 \ 1296 1.1 christos | $(PERL) -p -e 's/\\\n//' \ 1297 1.1 christos | sed -e 's/^.*: *//' -e 's/ */ /g' \ 1298 1.1 christos | fgrep -f sources \ 1299 1.1 christos | tr ' ' '\n' \ 1300 1.1 christos | sort | uniq > deps.raw \ 1301 1.1 christos && cat deps.raw \ 1302 1.1 christos | xargs ./configdata.pm --query 'get_sources(@ARGV)' \ 1303 1.1 christos | $(PERL) -p -e 's/\\\n//' \ 1304 1.1 christos | sed -e 's/\./\\\./g' -e 's/ : */:/' -e 's/^/s:/' -e 's/$$/:/' \ 1305 1.1 christos > deps.sed \ 1306 1.1 christos && cat deps.raw | sed -f deps.sed > deps \ 1307 1.1 christos ) 1308 1.1 christos ( \ 1309 1.1 christos cat sources-tmp/sources sources-tmp/deps \ 1310 1.1 christos | $(PERL) -p -e 's:^ *\Q../\E:: ;' \ 1311 1.1 christos -e 's:^\Q$(SRCDIR)/\E:: if "$(SRCDIR)" ne "." ;' \ 1312 1.1 christos -e 'my $$x; do { $$x = $$_; s:(^|/)((?!\Q../\E)[^/]*/)\Q..\E($$|/):$$1: } while ($$x ne $$_) ;' ; \ 1313 1.1 christos cd $(SRCDIR); \ 1314 1.1 christos for x in crypto/bn/asm/*.pl crypto/bn/asm/*.S \ 1315 1.1 christos crypto/aes/asm/*.pl crypto/aes/asm/*.S \ 1316 1.1 christos crypto/ec/asm/*.pl \ 1317 1.1 christos crypto/modes/asm/*.pl \ 1318 1.1 christos crypto/sha/asm/*.pl \ 1319 1.1 christos crypto/*cpuid.pl crypto/*cpuid.S \ 1320 1.1 christos crypto/*cap.c; do \ 1321 1.1 christos echo "$$x"; \ 1322 1.1 christos done \ 1323 1.1 christos ) | grep -v sm2p256 | sort | uniq > providers/fips.module.sources.new 1324 1.1 christos rm -rf sources-tmp 1325 1.1 christos 1326 1.1 christos # Set to -force to force a rebuild 1327 1.1 christos ERROR_REBUILD= 1328 1.1 christos errors: 1329 1.1 christos ( b=`pwd`; set -e; cd $(SRCDIR); \ 1330 1.1 christos $(PERL) util/ck_errf.pl -strict -internal; \ 1331 1.1 christos $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal ) 1332 1.1 christos ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \ 1333 1.1 christos for E in *.ec ; do \ 1334 1.1 christos $(PERL) ../util/ck_errf.pl -strict \ 1335 1.1 christos -conf $$E `basename $$E .ec`.c; \ 1336 1.1 christos $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \ 1337 1.1 christos -conf $$E `basename $$E .ec`.c ; \ 1338 1.1 christos done ) 1339 1.1 christos 1340 1.1 christos {- use File::Basename; 1341 1.1 christos 1342 1.1 christos my @sslheaders_tmpl = 1343 1.1 christos qw( include/openssl/ssl.h 1344 1.1 christos include/openssl/ssl2.h 1345 1.1 christos include/openssl/ssl3.h 1346 1.1 christos include/openssl/sslerr.h 1347 1.1 christos include/openssl/tls1.h 1348 1.1 christos include/openssl/dtls1.h 1349 1.1 christos include/openssl/srtp.h 1350 1.1 christos include/openssl/quic.h 1351 1.1 christos include/openssl/sslerr_legacy.h ); 1352 1.1 christos my @cryptoheaders_tmpl = 1353 1.1 christos qw( include/internal/dso.h 1354 1.1 christos include/internal/o_dir.h 1355 1.1 christos include/internal/err.h 1356 1.1 christos include/internal/evp.h 1357 1.1 christos include/internal/pem.h 1358 1.1 christos include/internal/asn1.h 1359 1.1 christos include/internal/sslconf.h ); 1360 1.1 christos my @cryptoskipheaders = ( @sslheaders_tmpl, 1361 1.1 christos qw( include/openssl/conf_api.h 1362 1.1 christos include/openssl/ebcdic.h 1363 1.1 christos include/openssl/opensslconf.h 1364 1.1 christos include/openssl/symhacks.h ) ); 1365 1.1 christos our %cryptoheaders = (); 1366 1.1 christos our %sslheaders = (); 1367 1.1 christos foreach my $d ( qw( include/openssl include/internal ) ) { 1368 1.1 christos my @header_patterns = 1369 1.1 christos map { catfile($config{sourcedir}, $d, $_) } ( '*.h', '*.h.in' ); 1370 1.1 christos foreach my $f ( map { glob($_) } @header_patterns ) { 1371 1.1 christos my $base = basename($f); 1372 1.1 christos my $base_in = basename($f, '.in'); 1373 1.1 christos my $dir = catfile($config{sourcedir}, $d); 1374 1.1 christos if ($base ne $base_in) { 1375 1.1 christos # We have a .h.in file, which means the header file is in the 1376 1.1 christos # build tree. 1377 1.1 christos $base = $base_in; 1378 1.1 christos $dir = catfile($config{builddir}, $d); 1379 1.1 christos } 1380 1.1 christos my $new_f = catfile($dir, $base); 1381 1.1 christos my $fn = "$d/$base"; 1382 1.1 christos # The logic to add files to @cryptoheaders is a bit complex. The 1383 1.1 christos # file to be added must be either in the public header directory 1384 1.1 christos # or one of the pre-declared internal headers, and must under no 1385 1.1 christos # circumstances be one of those that must be skipped. 1386 1.1 christos $cryptoheaders{$new_f} = 1 1387 1.1 christos if (($d eq 'include/openssl' 1388 1.1 christos || ( grep { $_ eq $fn } @cryptoheaders_tmpl )) 1389 1.1 christos && !( grep { $_ eq $fn } @cryptoskipheaders )); 1390 1.1 christos # The logic to add files to @sslheaders is much simpler... 1391 1.1 christos $sslheaders{$new_f} = 1 if grep { $_ eq $fn } @sslheaders_tmpl; 1392 1.1 christos } 1393 1.1 christos } 1394 1.1 christos ""; 1395 1.1 christos -} 1396 1.1 christos SRCS={- 1397 1.1 christos sub uniq { my %seen; grep !$seen{$_}++, @_; } 1398 1.1 christos sub flat(@) { return map { ref eq 'ARRAY' ? @$_ : $_ } @_; } 1399 1.1 christos join(" \\\n" . ' ' x 5, fill_lines(" ", $COLUMNS - 5, 1400 1.1 christos uniq(grep /\.(c|cc|cpp)$/, 1401 1.1 christos flat (map { $unified_info{sources}->{$_} } 1402 1.1 christos (sort keys %{$unified_info{sources}}))))) 1403 1.1 christos -} 1404 1.1 christos CRYPTOHEADERS={- join(" \\\n" . ' ' x 14, 1405 1.1 christos fill_lines(" ", $COLUMNS - 14, sort keys %cryptoheaders)) -} 1406 1.1 christos SSLHEADERS={- join(" \\\n" . ' ' x 11, 1407 1.1 christos fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -} 1408 1.1 christos 1409 1.1 christos renumber: build_generated 1410 1.1 christos $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \ 1411 1.1 christos --ordinals $(SRCDIR)/util/libcrypto.num \ 1412 1.1 christos --symhacks $(SRCDIR)/include/openssl/symhacks.h \ 1413 1.1 christos --renumber \ 1414 1.1 christos $(CRYPTOHEADERS) 1415 1.1 christos $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \ 1416 1.1 christos --ordinals $(SRCDIR)/util/libssl.num \ 1417 1.1 christos --symhacks $(SRCDIR)/include/openssl/symhacks.h \ 1418 1.1 christos --renumber \ 1419 1.1 christos $(SSLHEADERS) 1420 1.1 christos 1421 1.1 christos .PHONY: ordinals 1422 1.1 christos ordinals: build_generated 1423 1.1 christos $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \ 1424 1.1 christos --ordinals $(SRCDIR)/util/libcrypto.num \ 1425 1.1 christos --symhacks $(SRCDIR)/include/openssl/symhacks.h \ 1426 1.1 christos $(CRYPTOHEADERS) 1427 1.1 christos $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \ 1428 1.1 christos --ordinals $(SRCDIR)/util/libssl.num \ 1429 1.1 christos --symhacks $(SRCDIR)/include/openssl/symhacks.h \ 1430 1.1 christos $(SSLHEADERS) 1431 1.1 christos 1432 1.1 christos test_ordinals: 1433 1.1 christos "$(MAKE)" run_tests TESTS=test_ordinals 1434 1.1 christos 1435 1.1 christos tags TAGS: FORCE 1436 1.1 christos rm -f TAGS tags 1437 1.1 christos -( cd $(SRCDIR); util/ctags.sh ) 1438 1.1 christos -etags `find . -name '*.[ch]' -o -name '*.pm'` 1439 1.1 christos 1440 1.1 christos providers/fips.checksum.new: providers/fips.module.sources.new 1441 1.1 christos @which unifdef > /dev/null || \ 1442 1.1 christos ( echo >&2 "ERROR: unifdef not in your \$$PATH, FIPS checksums not calculated"; \ 1443 1.1 christos false ) 1444 1.1 christos ( sources=`pwd`/providers/fips.module.sources.new; \ 1445 1.1 christos cd $(SRCDIR) \ 1446 1.1 christos && cat $$sources \ 1447 1.1 christos | xargs ./util/fips-checksums.sh ) \ 1448 1.1 christos > providers/fips-sources.checksums.new \ 1449 1.1 christos && sha256sum providers/fips-sources.checksums.new \ 1450 1.1 christos | sed -e 's|\.new||' > providers/fips.checksum.new 1451 1.1 christos 1452 1.1 christos fips-checksums: providers/fips.checksum.new 1453 1.1 christos 1454 1.1 christos $(SRCDIR)/providers/fips.checksum: providers/fips.checksum.new 1455 1.1 christos cp -p providers/fips.module.sources.new $(SRCDIR)/providers/fips.module.sources 1456 1.1 christos cp -p providers/fips-sources.checksums.new $(SRCDIR)/providers/fips-sources.checksums 1457 1.1 christos cp -p providers/fips.checksum.new $(SRCDIR)/providers/fips.checksum 1458 1.1 christos 1459 1.1 christos update-fips-checksums: $(SRCDIR)/providers/fips.checksum 1460 1.1 christos 1461 1.1 christos diff-fips-checksums: fips-checksums 1462 1.1 christos diff -u $(SRCDIR)/providers/fips.module.sources providers/fips.module.sources.new 1463 1.1 christos diff -u $(SRCDIR)/providers/fips-sources.checksums providers/fips-sources.checksums.new 1464 1.1 christos diff -u $(SRCDIR)/providers/fips.checksum providers/fips.checksum.new 1465 1.1 christos 1466 1.1 christos # Release targets (note: only available on Unix) ##################### 1467 1.1 christos 1468 1.1 christos tar: 1469 1.1 christos (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)') 1470 1.1 christos 1471 1.1 christos # Helper targets ##################################################### 1472 1.1 christos 1473 1.1 christos link-utils: $(BLDDIR)/util/opensslwrap.sh $(BLDDIR)/apps/openssl.cnf 1474 1.1 christos 1475 1.1 christos $(BLDDIR)/util/opensslwrap.sh: Makefile 1476 1.1 christos @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ 1477 1.1 christos mkdir -p "$(BLDDIR)/util"; \ 1478 1.1 christos ln -sf "../$(SRCDIR)/util/`basename "$@"`" "$(BLDDIR)/util"; \ 1479 1.1 christos fi 1480 1.1 christos 1481 1.1 christos $(BLDDIR)/apps/openssl.cnf: Makefile 1482 1.1 christos @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ 1483 1.1 christos mkdir -p "$(BLDDIR)/apps"; \ 1484 1.1 christos ln -sf "../$(SRCDIR)/apps/`basename "$@"`" "$(BLDDIR)/apps"; \ 1485 1.1 christos fi 1486 1.1 christos 1487 1.1 christos FORCE: 1488 1.1 christos 1489 1.1 christos # Building targets ################################################### 1490 1.1 christos 1491 1.1 christos Makefile: configdata.pm \ 1492 1.1 christos {- join(" \\\n" . ' ' x 10, 1493 1.1 christos fill_lines(" ", $COLUMNS - 10, 1494 1.1 christos @{$config{build_file_templates}})) -} 1495 1.1 christos @echo "Detected changed: $?" 1496 1.1 christos $(PERL) configdata.pm 1497 1.1 christos @echo "**************************************************" 1498 1.1 christos @echo "*** ***" 1499 1.1 christos @echo "*** Please run the same make command again ***" 1500 1.1 christos @echo "*** ***" 1501 1.1 christos @echo "**************************************************" 1502 1.1 christos @false 1503 1.1 christos 1504 1.1 christos configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config \ 1505 1.1 christos {- join(" \\\n" . ' ' x 15, 1506 1.1 christos fill_lines(" ", $COLUMNS - 15, 1507 1.1 christos @{$config{build_infos}}, 1508 1.1 christos @{$config{conf_files}})) -} 1509 1.1 christos @echo "Detected changed: $?" 1510 1.1 christos $(PERL) configdata.pm -r 1511 1.1 christos @echo "**************************************************" 1512 1.1 christos @echo "*** ***" 1513 1.1 christos @echo "*** Please run the same make command again ***" 1514 1.1 christos @echo "*** ***" 1515 1.1 christos @echo "**************************************************" 1516 1.1 christos @false 1517 1.1 christos 1518 1.1 christos reconfigure reconf: 1519 1.1 christos $(PERL) configdata.pm -r 1520 1.1 christos 1521 1.1 christos {- 1522 1.1 christos use File::Basename; 1523 1.1 christos use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; 1524 1.1 christos 1525 1.1 christos # Helper function to convert dependencies in platform agnostic form to 1526 1.1 christos # dependencies in platform form. 1527 1.1 christos sub compute_platform_depends { 1528 1.1 christos map { my $x = $_; 1529 1.1 christos 1530 1.1 christos grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x) 1531 1.1 christos or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x) 1532 1.1 christos or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x) 1533 1.1 christos or platform->convertext($x); } @_; 1534 1.1 christos } 1535 1.1 christos 1536 1.1 christos # Helper function to figure out dependencies on libraries 1537 1.1 christos # It takes a list of library names and outputs a list of dependencies 1538 1.1 christos sub compute_lib_depends { 1539 1.1 christos # Depending on shared libraries: 1540 1.1 christos # On Windows POSIX layers, we depend on {libname}.dll.a 1541 1.1 christos # On Unix platforms, we depend on {shlibname}.so 1542 1.1 christos return map { platform->sharedlib_simple($_) 1543 1.1 christos // platform->sharedlib_import($_) 1544 1.1 christos // platform->sharedlib($_) 1545 1.1 christos // platform->staticlib($_) 1546 1.1 christos } @_; 1547 1.1 christos } 1548 1.1 christos 1549 1.1 christos sub generatetarget { 1550 1.1 christos my %args = @_; 1551 1.1 christos my $deps = join(" ", compute_platform_depends(@{$args{deps}})); 1552 1.1 christos return <<"EOF"; 1553 1.1 christos $args{target}: $deps 1554 1.1 christos EOF 1555 1.1 christos } 1556 1.1 christos 1557 1.1 christos sub generatesrc { 1558 1.1 christos my %args = @_; 1559 1.1 christos my $gen0 = $args{generator}->[0]; 1560 1.1 christos my $gen_args = join('', map { " $_" } 1561 1.1 christos @{$args{generator}}[1..$#{$args{generator}}]); 1562 1.1 christos my $gen_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); 1563 1.1 christos my $incs = join("", map { " -I".$_ } @{$args{incs}}); 1564 1.1 christos my $defs = join("", map { " -D".$_ } @{$args{defs}}); 1565 1.1 christos my $deps = join(" ", compute_platform_depends(@{$args{generator_deps}}, 1566 1.1 christos @{$args{deps}})); 1567 1.1 christos 1568 1.1 christos if ($args{src} =~ /\.html$/) { 1569 1.1 christos # 1570 1.1 christos # HTML generator 1571 1.1 christos # 1572 1.1 christos my $title = basename($args{src}, ".html"); 1573 1.1 christos my $pod = $gen0; 1574 1.1 christos return <<"EOF"; 1575 1.1 christos $args{src}: $pod 1576 1.1 christos \$(PERL) \$(SRCDIR)/util/mkpod2html.pl -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc" 1577 1.1 christos EOF 1578 1.1 christos } elsif ($args{src} =~ /\.(\d)$/) { 1579 1.1 christos # 1580 1.1 christos # Man-page generator 1581 1.1 christos # 1582 1.1 christos my $section = $1; 1583 1.1 christos my $name = uc basename($args{src}, ".$section"); 1584 1.1 christos my $pod = $gen0; 1585 1.1 christos return <<"EOF"; 1586 1.1 christos $args{src}: $pod 1587 1.1 christos pod2man --name=$name --section=$section\$(MANSUFFIX) --center=OpenSSL \\ 1588 1.1.1.2 christos --date=\$(RELEASE_DATE) --release=\$(VERSION) \\ 1589 1.1.1.2 christos $pod >\$\@ 1590 1.1 christos EOF 1591 1.1 christos } elsif (platform->isdef($args{src})) { 1592 1.1 christos # 1593 1.1 christos # Linker script-ish generator 1594 1.1 christos # 1595 1.1 christos my $target = platform->def($args{src}); 1596 1.1 christos (my $mkdef_os = $target{shared_target}) =~ s|-shared$||; 1597 1.1 christos my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : ''; 1598 1.1 christos my $ord_name = $args{generator}->[1] || $args{product}; 1599 1.1 christos return <<"EOF"; 1600 1.1 christos $target: $gen0 $deps \$(SRCDIR)/util/mkdef.pl 1601 1.1 christos \$(PERL) \$(SRCDIR)/util/mkdef.pl$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name --OS $mkdef_os > $target 1602 1.1 christos EOF 1603 1.1 christos } elsif (platform->isasm($args{src}) 1604 1.1 christos || platform->iscppasm($args{src})) { 1605 1.1 christos # 1606 1.1 christos # Assembler generator 1607 1.1 christos # 1608 1.1 christos my $cppflags = { 1609 1.1 christos shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 1610 1.1 christos lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 1611 1.1 christos dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', 1612 1.1 christos bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' 1613 1.1 christos } -> {$args{intent}}; 1614 1.1 christos 1615 1.1 christos my $generator; 1616 1.1 christos if ($gen0 =~ /\.pl$/) { 1617 1.1 christos $generator = 'CC="$(CC)" $(PERL)'.$gen_incs.' '.$gen0.$gen_args 1618 1.1 christos .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)'; 1619 1.1 christos } elsif ($gen0 =~ /\.m4$/) { 1620 1.1 christos $generator = 'm4 -B 8192'.$gen_incs.' '.$gen0.$gen_args.' >' 1621 1.1 christos } elsif ($gen0 =~ /\.S$/) { 1622 1.1 christos $generator = undef; 1623 1.1 christos } else { 1624 1.1 christos die "Generator type for $args{src} unknown: $gen0\n"; 1625 1.1 christos } 1626 1.1 christos 1627 1.1 christos if (defined($generator)) { 1628 1.1 christos return <<"EOF"; 1629 1.1 christos $args{src}: $gen0 $deps 1630 1.1 christos $generator \$@ 1631 1.1 christos EOF 1632 1.1 christos } 1633 1.1 christos return <<"EOF"; 1634 1.1 christos $args{src}: $gen0 $deps 1635 1.1 christos \$(CC) $incs $cppflags $defs -E $gen0 | \\ 1636 1.1 christos \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ 1637 1.1 christos EOF 1638 1.1 christos } elsif ($gen0 =~ m|^.*\.in$|) { 1639 1.1 christos # 1640 1.1 christos # "dofile" generator (file.in -> file) 1641 1.1 christos # 1642 1.1 christos my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, 1643 1.1 christos "util", "dofile.pl")), 1644 1.1 christos rel2abs($config{builddir})); 1645 1.1 christos my @perlmodules = (); 1646 1.1 christos my %perlmoduleincs = (); 1647 1.1 christos my %perlmoduledeps = (); 1648 1.1 christos foreach my $x (('configdata.pm', @{$args{deps}})) { 1649 1.1 christos # Compute (i)nclusion directory, (m)odule name and (d)ependency 1650 1.1 christos my $i, $m, $d; 1651 1.1 christos if ($x =~ /\|/) { 1652 1.1 christos $i = $`; 1653 1.1 christos $d = $'; 1654 1.1 christos 1655 1.1 christos # Massage the module part to become a real perl module spec 1656 1.1 christos $m = $d; 1657 1.1 christos $m =~ s|\.pm$||; 1658 1.1 christos # Directory specs are :: in perl package names 1659 1.1 christos $m =~ s|/|::|g; 1660 1.1 christos 1661 1.1 christos # Full file name of the dependency 1662 1.1 christos $d = catfile($i, $d) if $i; 1663 1.1 christos } elsif ($x =~ /\.pm$/) { 1664 1.1 christos $i = dirname($x); 1665 1.1 christos $m = basename($x, '.pm'); 1666 1.1 christos $d = $x; 1667 1.1 christos } else { 1668 1.1 christos # All other dependencies are simply collected 1669 1.1 christos $d = $x; 1670 1.1 christos } 1671 1.1 christos push @perlmodules, '"-M'.$m.'"' if $m; 1672 1.1 christos $perlmoduledeps{$d} = 1; 1673 1.1 christos $perlmoduleincs{'"-I'.$i.'"'} = 1 if $i; 1674 1.1 christos } 1675 1.1 christos 1676 1.1 christos # Because of the special treatment of dependencies, we need to 1677 1.1 christos # recompute $deps completely 1678 1.1 christos my $deps 1679 1.1 christos = join(" ", compute_platform_depends(@{$args{generator_deps}}, 1680 1.1 christos sort keys %perlmoduledeps)); 1681 1.1 christos my $perlmodules = join(' ', '', ( sort keys %perlmoduleincs ), @perlmodules); 1682 1.1 christos 1683 1.1 christos return <<"EOF"; 1684 1.1 christos $args{src}: $gen0 $deps 1685 1.1 christos \$(PERL)$perlmodules "$dofile" "-o$target{build_file}" $gen0$gen_args > \$@ 1686 1.1 christos EOF 1687 1.1 christos } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) { 1688 1.1 christos # 1689 1.1 christos # Generic generator using OpenSSL programs 1690 1.1 christos # 1691 1.1 christos 1692 1.1 christos # Redo $gen0, to ensure that we have the proper extension where 1693 1.1 christos # necessary. 1694 1.1 christos $gen0 = platform->bin($gen0); 1695 1.1 christos # Use $(PERL) to execute wrap.pl directly to avoid calling env 1696 1.1 christos return <<"EOF"; 1697 1.1 christos $args{src}: $gen0 $deps \$(BLDDIR)/util/wrap.pl 1698 1.1 christos \$(PERL) \$(BLDDIR)/util/wrap.pl $gen0$gen_args > \$@ 1699 1.1 christos EOF 1700 1.1 christos } else { 1701 1.1 christos # 1702 1.1 christos # Generic generator using Perl 1703 1.1 christos # 1704 1.1 christos return <<"EOF"; 1705 1.1 christos $args{src}: $gen0 $deps 1706 1.1 christos \$(PERL)$gen_incs $gen0$gen_args > \$@ 1707 1.1 christos EOF 1708 1.1 christos } 1709 1.1 christos } 1710 1.1 christos 1711 1.1 christos # Should one wonder about the end of the Perl snippet, it's because this 1712 1.1 christos # second regexp eats up line endings as well, if the removed path is the 1713 1.1 christos # last in the line. We may therefore need to put back a line ending. 1714 1.1 christos sub src2obj { 1715 1.1 christos my %args = @_; 1716 1.1 christos my $obj = platform->convertext($args{obj}); 1717 1.1 christos my $dep = platform->dep($args{obj}); 1718 1.1 christos my @srcs = @{$args{srcs}}; 1719 1.1 christos my $srcs = join(" ", @srcs); 1720 1.1 christos my $deps = join(" ", @srcs, @{$args{deps}}); 1721 1.1 christos my $incs = join("", map { " -I".$_ } @{$args{incs}}); 1722 1.1 christos my $defs = join("", map { " -D".$_ } @{$args{defs}}); 1723 1.1 christos my $cmd; 1724 1.1 christos my $cmdflags; 1725 1.1 christos my $cmdcompile; 1726 1.1 christos if (grep /\.rc$/, @srcs) { 1727 1.1 christos $cmd = '$(RC)'; 1728 1.1 christos $cmdflags = '$(RCFLAGS)'; 1729 1.1 christos $cmdcompile = ''; 1730 1.1 christos } elsif (grep /\.(cc|cpp)$/, @srcs) { 1731 1.1 christos $cmd = '$(CXX)'; 1732 1.1 christos $cmdcompile = ' -c'; 1733 1.1 christos $cmdflags = { 1734 1.1 christos shlib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', 1735 1.1 christos lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', 1736 1.1 christos dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)', 1737 1.1 christos bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)' 1738 1.1 christos } -> {$args{intent}}; 1739 1.1 christos } else { 1740 1.1 christos $cmd = '$(CC)'; 1741 1.1 christos $cmdcompile = ' -c'; 1742 1.1 christos $cmdflags = { 1743 1.1 christos shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 1744 1.1 christos lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 1745 1.1 christos dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', 1746 1.1 christos bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' 1747 1.1 christos } -> {$args{intent}}; 1748 1.1 christos } 1749 1.1 christos my $recipe; 1750 1.1 christos # extension-specific rules 1751 1.1 christos if (grep /\.s$/, @srcs) { 1752 1.1 christos $recipe .= <<"EOF"; 1753 1.1 christos $obj: $deps 1754 1.1 christos $cmd $cmdflags -c -o \$\@ $srcs 1755 1.1 christos EOF 1756 1.1 christos } elsif (grep /\.S$/, @srcs) { 1757 1.1 christos # Originally there was multi-step rule with $(CC) -E file.S 1758 1.1 christos # followed by $(CC) -c file.s. It compensated for one of 1759 1.1 christos # legacy platform compiler's inability to handle .S files. 1760 1.1 christos # The platform is long discontinued by vendor so there is 1761 1.1 christos # hardly a point to drag it along... 1762 1.1 christos $recipe .= <<"EOF"; 1763 1.1 christos $obj: $deps 1764 1.1 christos $cmd $incs $defs $cmdflags -c -o \$\@ $srcs 1765 1.1 christos EOF 1766 1.1 christos } elsif ($makedep_scheme eq 'gcc' && !grep /\.rc$/, @srcs) { 1767 1.1 christos $recipe .= <<"EOF"; 1768 1.1 christos $obj: $deps 1769 1.1 christos $cmd $incs $defs $cmdflags -MMD -MF $dep.tmp -c -o \$\@ $srcs 1770 1.1 christos \@touch $dep.tmp 1771 1.1 christos \@if cmp $dep.tmp $dep > /dev/null 2> /dev/null; then \\ 1772 1.1 christos rm -f $dep.tmp; \\ 1773 1.1 christos else \\ 1774 1.1 christos mv $dep.tmp $dep; \\ 1775 1.1 christos fi 1776 1.1 christos EOF 1777 1.1 christos } else { 1778 1.1 christos $recipe .= <<"EOF"; 1779 1.1 christos $obj: $deps 1780 1.1 christos $cmd $incs $defs $cmdflags $cmdcompile -o \$\@ $srcs 1781 1.1 christos EOF 1782 1.1 christos if ($makedep_scheme eq 'makedepend') { 1783 1.1 christos $recipe .= <<"EOF"; 1784 1.1 christos \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\ 1785 1.1 christos > $dep 1786 1.1 christos EOF 1787 1.1 christos } 1788 1.1 christos } 1789 1.1 christos return $recipe; 1790 1.1 christos } 1791 1.1 christos # We *know* this routine is only called when we've configure 'shared'. 1792 1.1 christos sub obj2shlib { 1793 1.1 christos my %args = @_; 1794 1.1 christos my @linkdirs = (); 1795 1.1 christos my @linklibs = (); 1796 1.1 christos foreach (@{$args{deps}}) { 1797 1.1 christos if (platform->isstaticlib($_)) { 1798 1.1 christos push @linklibs, platform->convertext($_); 1799 1.1 christos } else { 1800 1.1 christos my $d = "-L" . dirname($_); 1801 1.1 christos my $l = basename($_); 1802 1.1 christos $l =~ s/^lib//; 1803 1.1 christos $l = "-l" . $l; 1804 1.1 christos push @linklibs, $l; 1805 1.1 christos push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; 1806 1.1 christos } 1807 1.1 christos } 1808 1.1 christos my $linkflags = join("", map { $_." " } @linkdirs); 1809 1.1 christos my $linklibs = join("", map { $_." " } @linklibs); 1810 1.1 christos my @objs = map { platform->convertext($_) } 1811 1.1 christos grep { !platform->isdef($_) } 1812 1.1 christos @{$args{objs}}; 1813 1.1 christos my @defs = map { platform->def($_) } 1814 1.1 christos grep { platform->isdef($_) } 1815 1.1 christos @{$args{objs}}; 1816 1.1 christos my @deps = compute_lib_depends(@{$args{deps}}); 1817 1.1 christos die "More than one exported symbol map" if scalar @defs > 1; 1818 1.1 christos 1819 1.1 christos my $full = platform->sharedlib($args{lib}); 1820 1.1 christos # $import is for Windows and subsystems thereof, where static import 1821 1.1 christos # libraries for DLLs are a thing. On platforms that have this mechanism, 1822 1.1 christos # $import has the name of this import library. On platforms that don't 1823 1.1 christos # have this mechanism, $import will be |undef|. 1824 1.1 christos # It's also used on AIX in solib mode, which creates import libraries 1825 1.1 christos # for the shared libraries. 1826 1.1 christos my $import = platform->sharedlib_import($args{lib}); 1827 1.1 christos # $simple is for platforms where full shared library names include the 1828 1.1 christos # shared library version, and there's a simpler name that doesn't include 1829 1.1 christos # that version. On such platforms, $simple has the simpler name. On 1830 1.1 christos # other platforms, it will be |undef|. 1831 1.1 christos my $simple = platform->sharedlib_simple($args{lib}); 1832 1.1 christos 1833 1.1 christos my $argfile = defined $target{shared_argfileflag} ? $full.".args" : undef; 1834 1.1 christos my $shared_soname = ""; 1835 1.1 christos $shared_soname .= ' '.$target{shared_sonameflag}.basename($full) 1836 1.1 christos if defined $target{shared_sonameflag}; 1837 1.1 christos my $shared_imp = ""; 1838 1.1 christos $shared_imp .= ' '.$target{shared_impflag}.basename($import) 1839 1.1 christos if defined $target{shared_impflag} && defined $import; 1840 1.1 christos my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); 1841 1.1 christos 1842 1.1 christos # There is at least one platform where the compiler-as-linker needs to 1843 1.1 christos # have one object file directly on the command line. That won't hurt 1844 1.1 christos # any other platform, so we do that for everyone when there's an argfile 1845 1.1 christos # to be had. This depends heavily on splice, which removes elements from 1846 1.1 christos # the given array, and returns them so they can be captured. 1847 1.1 christos my @argfileobjs = $argfile 1848 1.1 christos ? splice(@objs, 1) 1849 1.1 christos : (); 1850 1.1 christos my $argfilecmds = $argfile 1851 1.1 christos ? join("\n\t", map { "echo $_ >> $argfile" } @argfileobjs) 1852 1.1 christos : undef; 1853 1.1 christos my $argfiledeps = $argfile 1854 1.1 christos ? join(" \\\n" . ' ' x (length($argfile) + 2), 1855 1.1 christos fill_lines(' ', $COLUMNS - length($full) - 2, @argfileobjs)) 1856 1.1 christos : undef; 1857 1.1 christos my @fulldeps = (@objs, ($argfile ? $argfile : ()), @defs, @deps); 1858 1.1 christos my @fullobjs = ( 1859 1.1 christos @objs, 1860 1.1 christos ($argfile ? $target{shared_argfileflag}.$argfile : ()) 1861 1.1 christos ); 1862 1.1 christos my $fulldeps = 1863 1.1 christos join(" \\\n" . ' ' x (length($full) + 2), 1864 1.1 christos fill_lines(' ', $COLUMNS - length($full) - 2, @fulldeps)); 1865 1.1 christos my $fullobjs = 1866 1.1 christos join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @fullobjs)); 1867 1.1 christos 1868 1.1 christos my $recipe = ''; 1869 1.1 christos 1870 1.1 christos if (defined $simple && $simple ne $full) { 1871 1.1 christos if (sharedaix()) { 1872 1.1 christos $recipe .= <<"EOF"; 1873 1.1 christos $simple: $full 1874 1.1 christos rm -f $simple && \\ 1875 1.1 christos \$(AR) r $simple $full 1876 1.1 christos EOF 1877 1.1 christos } else { 1878 1.1 christos $recipe .= <<"EOF"; 1879 1.1 christos $simple: $full 1880 1.1 christos rm -f $simple && \\ 1881 1.1 christos ln -s $full $simple 1882 1.1 christos EOF 1883 1.1 christos } 1884 1.1 christos } 1885 1.1 christos if (defined $import) { 1886 1.1 christos if (sharedaix_solib()) { 1887 1.1 christos $recipe .= <<"EOF"; 1888 1.1 christos $import: $full $defs[0] 1889 1.1 christos rm -f $import && \\ 1890 1.1 christos echo \\#!$full > $import && \\ 1891 1.1 christos cat $defs[0] >>$import 1892 1.1 christos EOF 1893 1.1 christos } else { 1894 1.1 christos $recipe .= <<"EOF"; 1895 1.1 christos $import: $full 1896 1.1 christos EOF 1897 1.1 christos } 1898 1.1 christos } 1899 1.1 christos $recipe .= <<"EOF"; 1900 1.1 christos $full: $fulldeps 1901 1.1 christos \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\ 1902 1.1 christos -o $full$shared_def \\ 1903 1.1 christos $fullobjs \\ 1904 1.1 christos $linklibs \$(LIB_EX_LIBS) 1905 1.1 christos EOF 1906 1.1 christos if (windowsdll()) { 1907 1.1 christos $recipe .= <<"EOF"; 1908 1.1 christos rm -f apps/$full 1909 1.1 christos rm -f fuzz/$full 1910 1.1 christos cp -p $full apps/ 1911 1.1 christos cp -p $full fuzz/ 1912 1.1 christos EOF 1913 1.1 christos if (!$disabled{tests}) { 1914 1.1 christos $recipe .= <<"EOF"; 1915 1.1 christos rm -f test/$full 1916 1.1 christos cp -p $full test/ 1917 1.1 christos EOF 1918 1.1 christos } 1919 1.1 christos } 1920 1.1 christos $recipe .= <<"EOF" if defined $argfile; 1921 1.1 christos $argfile: $argfiledeps 1922 1.1 christos \$(RM) $argfile 1923 1.1 christos $argfilecmds 1924 1.1 christos EOF 1925 1.1 christos return $recipe; 1926 1.1 christos } 1927 1.1 christos sub obj2dso { 1928 1.1 christos my %args = @_; 1929 1.1 christos my $dso = platform->dso($args{module}); 1930 1.1 christos my @linkdirs = (); 1931 1.1 christos my @linklibs = (); 1932 1.1 christos foreach (@{$args{deps}}) { 1933 1.1 christos next unless defined $_; 1934 1.1 christos if (platform->isstaticlib($_)) { 1935 1.1 christos push @linklibs, platform->convertext($_); 1936 1.1 christos } else { 1937 1.1 christos my $d = "-L" . dirname($_); 1938 1.1 christos my $l = basename($_); 1939 1.1 christos $l =~ s/^lib//; 1940 1.1 christos $l = "-l" . $l; 1941 1.1 christos push @linklibs, $l; 1942 1.1 christos push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; 1943 1.1 christos } 1944 1.1 christos } 1945 1.1 christos my $linkflags = join("", map { $_." " } @linkdirs); 1946 1.1 christos my $linklibs = join("", map { $_." " } @linklibs); 1947 1.1 christos my @objs = map { platform->convertext($_) } 1948 1.1 christos grep { !platform->isdef($_) } 1949 1.1 christos @{$args{objs}}; 1950 1.1 christos my @defs = map { platform->def($_) } 1951 1.1 christos grep { platform->isdef($_) } 1952 1.1 christos @{$args{objs}}; 1953 1.1 christos my @deps = compute_lib_depends(@{$args{deps}}); 1954 1.1 christos my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); 1955 1.1 christos # Next line needs to become "less magic" (see PR #11950) 1956 1.1 christos $shared_def .= ' '.$target{shared_fipsflag} if (defined $target{shared_fipsflag} && $shared_def =~ m/providers\/fips/); 1957 1.1 christos my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs)); 1958 1.1 christos my $deps = join(" \\\n" . ' ' x (length($dso) + 2), 1959 1.1 christos fill_lines(' ', $COLUMNS - length($dso) - 2, 1960 1.1 christos @objs, @defs, @deps)); 1961 1.1 christos 1962 1.1 christos return <<"EOF"; 1963 1.1 christos $dso: $deps 1964 1.1 christos \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\ 1965 1.1 christos -o $dso$shared_def \\ 1966 1.1 christos $objs \\ 1967 1.1 christos $linklibs\$(DSO_EX_LIBS) 1968 1.1 christos EOF 1969 1.1 christos } 1970 1.1 christos sub obj2lib { 1971 1.1 christos my %args = @_; 1972 1.1 christos my $lib = platform->staticlib($args{lib}); 1973 1.1 christos my @objs = map { platform->obj($_) } @{$args{objs}}; 1974 1.1 christos my $deps = join(" \\\n" . ' ' x (length($lib) + 2), 1975 1.1 christos fill_lines(' ', $COLUMNS - length($lib) - 2, @objs)); 1976 1.1 christos my $max_per_call = 500; 1977 1.1 christos my @objs_grouped; 1978 1.1 christos push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs; 1979 1.1 christos my $fill_lib = 1980 1.1 christos join("\n\t", (map { "\$(AR) \$(ARFLAGS) $lib $_" } @objs_grouped)); 1981 1.1 christos return <<"EOF"; 1982 1.1 christos $lib: $deps 1983 1.1 christos \$(RM) $lib 1984 1.1 christos $fill_lib 1985 1.1 christos \$(RANLIB) \$\@ || echo Never mind. 1986 1.1 christos EOF 1987 1.1 christos } 1988 1.1 christos sub obj2bin { 1989 1.1 christos my %args = @_; 1990 1.1 christos my $bin = platform->bin($args{bin}); 1991 1.1 christos my @objs = map { platform->obj($_) } @{$args{objs}}; 1992 1.1 christos my @deps = compute_lib_depends(@{$args{deps}}); 1993 1.1 christos my $objs = join(" \\\n" . ' ' x (length($bin) + 2), 1994 1.1 christos fill_lines(' ', $COLUMNS - length($bin) - 2, @objs)); 1995 1.1 christos my @linkdirs = (); 1996 1.1 christos my @linklibs = (); 1997 1.1 christos foreach (@{$args{deps}}) { 1998 1.1 christos next unless defined $_; 1999 1.1 christos if (platform->isstaticlib($_)) { 2000 1.1 christos push @linklibs, platform->convertext($_); 2001 1.1 christos } else { 2002 1.1 christos my $d = "-L" . dirname($_); 2003 1.1 christos my $l = basename($_); 2004 1.1 christos $l =~ s/^lib//; 2005 1.1 christos $l = "-l" . $l; 2006 1.1 christos push @linklibs, $l; 2007 1.1 christos push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; 2008 1.1 christos } 2009 1.1 christos } 2010 1.1 christos my $linkflags = join("", map { $_." " } @linkdirs); 2011 1.1 christos my $linklibs = join("", map { $_." " } @linklibs); 2012 1.1 christos my $cmd = '$(CC)'; 2013 1.1 christos my $cmdflags = '$(BIN_CFLAGS)'; 2014 1.1 christos if (grep /_cc\.o$/, @{$args{objs}}) { 2015 1.1 christos $cmd = '$(CXX)'; 2016 1.1 christos $cmdflags = '$(BIN_CXXFLAGS)'; 2017 1.1 christos } 2018 1.1 christos 2019 1.1 christos my $objs = join(" \\\n\t\t", fill_lines(' ', $COLUMNS - 16, @objs)); 2020 1.1 christos my $deps = join(" \\\n" . ' ' x (length($bin) + 2), 2021 1.1 christos fill_lines(' ', $COLUMNS - length($bin) - 2, 2022 1.1 christos @objs, @deps)); 2023 1.1 christos 2024 1.1 christos return <<"EOF"; 2025 1.1 christos $bin: $deps 2026 1.1 christos rm -f $bin 2027 1.1 christos \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\ 2028 1.1 christos -o $bin \\ 2029 1.1 christos $objs \\ 2030 1.1 christos $linklibs\$(BIN_EX_LIBS) 2031 1.1 christos EOF 2032 1.1 christos } 2033 1.1 christos sub in2script { 2034 1.1 christos my %args = @_; 2035 1.1 christos my $script = $args{script}; 2036 1.1 christos my $sources = join(" ", @{$args{sources}}); 2037 1.1 christos my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, 2038 1.1 christos "util", "dofile.pl")), 2039 1.1 christos rel2abs($config{builddir})); 2040 1.1 christos return <<"EOF"; 2041 1.1 christos $script: $sources configdata.pm 2042 1.1 christos \$(RM) "$script" 2043 1.1 christos \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ 2044 1.1 christos "-o$target{build_file}" $sources > "$script" 2045 1.1 christos chmod a+x $script 2046 1.1 christos EOF 2047 1.1 christos } 2048 1.1 christos sub generatedir { 2049 1.1 christos my %args = @_; 2050 1.1 christos my $dir = $args{dir}; 2051 1.1 christos my @deps = compute_platform_depends(@{$args{deps}}); 2052 1.1 christos my @comments = (); 2053 1.1 christos 2054 1.1 christos # We already have a 'test' target, and the top directory is just plain 2055 1.1 christos # silly 2056 1.1 christos return if $dir eq "test" || $dir eq "."; 2057 1.1 christos 2058 1.1 christos foreach my $type (("dso", "lib", "bin", "script")) { 2059 1.1 christos next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); 2060 1.1 christos # For lib object files, we could update the library. However, it 2061 1.1 christos # was decided that it's enough to build the directory local object 2062 1.1 christos # files, so we don't need to add any actions, and the dependencies 2063 1.1 christos # are already taken care of. 2064 1.1 christos if ($type ne "lib") { 2065 1.1 christos foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { 2066 1.1 christos if (dirname($prod) eq $dir) { 2067 1.1 christos push @deps, compute_platform_depends($prod); 2068 1.1 christos } else { 2069 1.1 christos push @comments, "# No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); 2070 1.1 christos } 2071 1.1 christos } 2072 1.1 christos } 2073 1.1 christos } 2074 1.1 christos 2075 1.1 christos my $target = "$dir $dir/"; 2076 1.1 christos my $deps = join(" \\\n\t", 2077 1.1 christos fill_lines(' ', $COLUMNS - 8, @deps)); 2078 1.1 christos my $comments = join("\n", "", @comments); 2079 1.1 christos return <<"EOF"; 2080 1.1 christos $target: \\ 2081 1.1 christos $deps$comments 2082 1.1 christos EOF 2083 1.1 christos } 2084 1.1 christos "" # Important! This becomes part of the template result. 2085 1.1 christos -} 2086