1## 2## Makefile for OpenSSL 3## 4## {- join("\n## ", @autowarntext) -} 5{- 6 our $objext = $target{obj_extension} || ".o"; 7 our $depext = $target{dep_extension} || ".d"; 8 our $exeext = $target{exe_extension} || ""; 9 our $libext = $target{lib_extension} || ".a"; 10 our $shlibext = $target{shared_extension} || ".so"; 11 our $shlibvariant = $target{shlib_variant} || ""; 12 our $shlibextsimple = $target{shared_extension_simple} || ".so"; 13 our $shlibextimport = $target{shared_import_extension} || ""; 14 our $dsoext = $target{dso_extension} || ".so"; 15 our $makedepprog = $disabled{makedepend} ? undef : $config{makedepprog}; 16 17 # $mingw_installroot and $mingw_commonroot is relevant for mingw only. 18 my $build_scheme = $target{build_scheme}; 19 my $install_flavour = $build_scheme->[$#$build_scheme]; # last element 20 my $mingw_installenv = $install_flavour eq "WOW" ? "ProgramFiles(x86)" 21 : "ProgramW6432"; 22 my $mingw_commonenv = $install_flavour eq "WOW" ? "CommonProgramFiles(x86)" 23 : "CommonProgramW6432"; 24 our $mingw_installroot = 25 defined($ENV{$mingw_installenv}) ? $mingw_installenv : 'ProgramFiles'; 26 our $mingw_commonroot = 27 defined($ENV{$mingw_commonenv}) ? $mingw_commonenv : 'CommonProgramFiles'; 28 my $mingw_installdflt = 29 $install_flavour eq "WOW" ? "C:/Program Files (x86)" 30 : "C:/Program Files"; 31 my $mingw_commondflt = "$mingw_installdflt/Common Files"; 32 33 # expand variables early 34 $mingw_installroot = $ENV{$mingw_installroot} // $mingw_installdflt; 35 $mingw_commonroot = $ENV{$mingw_commonroot} // $mingw_commondflt; 36 37 sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ } 38 39 # Shared AIX support is special. We put libcrypto[64].so.ver into 40 # libcrypto.a and use libcrypto_a.a as static one. 41 sub sharedaix { !$disabled{shared} && $config{target} =~ /^aix/ } 42 43 our $sover_dirname = $config{shlib_version_number}; 44 $sover_dirname =~ s|\.|_|g 45 if $config{target} =~ /^mingw/; 46 47 # shlib and shlib_simple both take a static library name and figure 48 # out what the shlib name should be. 49 # 50 # When OpenSSL is configured "no-shared", these functions will just 51 # return empty lists, making them suitable to join(). 52 # 53 # With Windows DLL producers, shlib($libname) will return the shared 54 # library name (which usually is different from the static library 55 # name) with the default shared extension appended to it, while 56 # shlib_simple($libname) will return the static library name with 57 # the shared extension followed by ".a" appended to it. The former 58 # result is used as the runtime shared library while the latter is 59 # used as the DLL import library. 60 # 61 # On all Unix systems, shlib($libname) will return the library name 62 # with the default shared extension, while shlib_simple($libname) 63 # will return the name from shlib($libname) with any SO version number 64 # removed. On some systems, they may therefore return the exact same 65 # string. 66 sub shlib { 67 my $lib = shift; 68 return () if $disabled{shared} || $lib =~ /\.a$/; 69 return $unified_info{sharednames}->{$lib}. $shlibvariant. '$(SHLIB_EXT)'; 70 } 71 sub shlib_simple { 72 my $lib = shift; 73 return () if $disabled{shared} || $lib =~ /\.a$/; 74 75 if (windowsdll()) { 76 return $lib . '$(SHLIB_EXT_IMPORT)'; 77 } 78 return $lib . '$(SHLIB_EXT_SIMPLE)'; 79 } 80 81 # Easy fixing of static library names 82 sub lib { 83 (my $lib = shift) =~ s/\.a$//; 84 return $lib . $libext; 85 } 86 87 # dso is a complement to shlib / shlib_simple that returns the 88 # given libname with the simple shared extension (possible SO version 89 # removed). This differs from shlib_simple() by being unconditional. 90 sub dso { 91 my $engine = shift; 92 93 return $engine . $dsoext; 94 } 95 # This makes sure things get built in the order they need 96 # to. You're welcome. 97 sub dependmagic { 98 my $target = shift; 99 100 return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target"; 101 } 102 ''; 103-} 104PLATFORM={- $config{target} -} 105OPTIONS={- $config{options} -} 106CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -}) 107SRCDIR={- $config{sourcedir} -} 108BLDDIR={- $config{builddir} -} 109 110VERSION={- $config{version} -} 111MAJOR={- $config{major} -} 112MINOR={- $config{minor} -} 113SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -} 114SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -} 115SHLIB_MAJOR={- $config{shlib_major} -} 116SHLIB_MINOR={- $config{shlib_minor} -} 117SHLIB_TARGET={- $target{shared_target} -} 118SHLIB_EXT={- $shlibext -} 119SHLIB_EXT_SIMPLE={- $shlibextsimple -} 120SHLIB_EXT_IMPORT={- $shlibextimport -} 121 122LIBS={- join(" ", map { lib($_) } @{$unified_info{libraries}}) -} 123SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -} 124SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -} 125ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -} 126PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{programs}}) -} 127SCRIPTS={- join(" ", @{$unified_info{scripts}}) -} 128{- output_off() if $disabled{makedepend}; "" -} 129DEPS={- join(" ", map { (my $x = $_) =~ s|\.o$|$depext|; $x; } 130 grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } 131 keys %{$unified_info{sources}}); -} 132{- output_on() if $disabled{makedepend}; "" -} 133GENERATED_MANDATORY={- join(" ", @{$unified_info{depends}->{""}}) -} 134GENERATED={- # common0.tmpl provides @generated 135 join(" ", @generated ) -} 136 137INSTALL_LIBS={- join(" ", map { lib($_) } @{$unified_info{install}->{libraries}}) -} 138INSTALL_SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{install}->{libraries}}) -} 139INSTALL_SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{install}->{libraries}}) -} 140INSTALL_ENGINES={- join(" ", map { dso($_) } @{$unified_info{install}->{engines}}) -} 141INSTALL_PROGRAMS={- join(" ", map { $_.$exeext } @{$unified_info{install}->{programs}}) -} 142{- output_off() if $disabled{apps}; "" -} 143BIN_SCRIPTS=$(BLDDIR)/tools/c_rehash 144MISC_SCRIPTS=$(BLDDIR)/apps/CA.pl $(BLDDIR)/apps/tsget.pl:tsget 145{- output_on() if $disabled{apps}; "" -} 146 147APPS_OPENSSL={- use File::Spec::Functions; 148 catfile("apps","openssl") -} 149 150# DESTDIR is for package builders so that they can configure for, say, 151# /usr/ and yet have everything installed to /tmp/somedir/usr/. 152# Normally it is left empty. 153DESTDIR= 154 155{- output_off() if $config{target} =~ /^mingw/; "" -} 156# Do not edit these manually. Use Configure with --prefix or --openssldir 157# to change this! Short explanation in the top comment in Configure 158INSTALLTOP={- # $prefix is used in the OPENSSLDIR perl snippet 159 # 160 our $prefix = $config{prefix} || "/usr/local"; 161 $prefix -} 162OPENSSLDIR={- # 163 # The logic here is that if no --openssldir was given, 164 # OPENSSLDIR will get the value from $prefix plus "/ssl". 165 # If --openssldir was given and the value is an absolute 166 # path, OPENSSLDIR will get its value without change. 167 # If the value from --openssldir is a relative path, 168 # OPENSSLDIR will get $prefix with the --openssldir 169 # value appended as a subdirectory. 170 # 171 use File::Spec::Functions; 172 our $openssldir = 173 $config{openssldir} ? 174 (file_name_is_absolute($config{openssldir}) ? 175 $config{openssldir} 176 : catdir($prefix, $config{openssldir})) 177 : catdir($prefix, "ssl"); 178 $openssldir -} 179LIBDIR={- our $libdir = $config{libdir}; 180 unless ($libdir) { 181 # 182 # if $prefix/lib$target{multilib} is not an existing 183 # directory, then assume that it's not searched by linker 184 # automatically, in which case adding $target{multilib} suffix 185 # causes more grief than we're ready to tolerate, so don't... 186 our $multilib = 187 -d "$prefix/lib$target{multilib}" ? $target{multilib} : ""; 188 $libdir = "lib$multilib"; 189 } 190 file_name_is_absolute($libdir) ? "" : $libdir -} 191# $(libdir) is chosen to be compatible with the GNU coding standards 192libdir={- file_name_is_absolute($libdir) 193 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -} 194ENGINESDIR=$(libdir)/engines-{- $sover_dirname -} 195 196# Convenience variable for those who want to set the rpath in shared 197# libraries and applications 198LIBRPATH=$(libdir) 199{- output_on() if $config{target} =~ /^mingw/; 200 output_off() if $config{target} !~ /^mingw/; 201 "" -} 202# Do not edit these manually. Use Configure with --prefix or --openssldir 203# to change this! Short explanation in the top comment in Configure 204INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet 205 # 206 use File::Spec::Win32; 207 my $prefix_default = "$mingw_installroot/OpenSSL"; 208 our $prefix = 209 File::Spec::Win32->canonpath($config{prefix} 210 || $prefix_default); 211 our ($prefix_dev, $prefix_dir, $prefix_file) = 212 File::Spec::Win32->splitpath($prefix, 1); 213 $prefix =~ s|\\|/|g; 214 $prefix_dir =~ s|\\|/|g; 215 $prefix_dev -} 216INSTALLTOP_dir={- my $x = File::Spec::Win32->canonpath($prefix_dir); 217 $x =~ s|\\|/|g; 218 $x -} 219OPENSSLDIR_dev={- # 220 # The logic here is that if no --openssldir was given, 221 # OPENSSLDIR will get the value "$mingw_commonroot/SSL". 222 # If --openssldir was given and the value is an absolute 223 # path, OPENSSLDIR will get its value without change. 224 # If the value from --openssldir is a relative path, 225 # OPENSSLDIR will get $prefix with the --openssldir 226 # value appended as a subdirectory. 227 # 228 use File::Spec::Win32; 229 our $openssldir = 230 $config{openssldir} ? 231 (File::Spec::Win32->file_name_is_absolute($config{openssldir}) ? 232 File::Spec::Win32->canonpath($config{openssldir}) 233 : File::Spec::Win32->catdir($prefix, $config{openssldir})) 234 : File::Spec::Win32->canonpath("$mingw_commonroot/SSL"); 235 our ($openssldir_dev, $openssldir_dir, $openssldir_file) = 236 File::Spec::Win32->splitpath($openssldir, 1); 237 $openssldir =~ s|\\|/|g; 238 $openssldir_dir =~ s|\\|/|g; 239 $openssldir_dev -} 240OPENSSLDIR_dir={- my $x = File::Spec::Win32->canonpath($openssldir_dir); 241 $x =~ s|\\|/|g; 242 $x -} 243LIBDIR={- our $libdir = $config{libdir} || "lib"; 244 File::Spec::Win32->file_name_is_absolute($libdir) ? "" : $libdir -} 245ENGINESDIR_dev={- use File::Spec::Win32; 246 our $enginesdir = 247 File::Spec::Win32->catdir($prefix,$libdir, 248 "engines-$sover_dirname"); 249 our ($enginesdir_dev, $enginesdir_dir, $enginesdir_file) = 250 File::Spec::Win32->splitpath($enginesdir, 1); 251 $enginesdir =~ s|\\|/|g; 252 $enginesdir_dir =~ s|\\|/|g; 253 $enginesdir_dev -} 254ENGINESDIR_dir={- my $x = File::Spec::Win32->canonpath($enginesdir_dir); 255 $x =~ s|\\|/|g; 256 $x -} 257# In a Windows environment, $(DESTDIR) is harder to contatenate with other 258# directory variables, because both may contain devices. What we do here is 259# to adapt INSTALLTOP, OPENSSLDIR and ENGINESDIR depending on if $(DESTDIR) 260# has a value or not, to ensure that concatenation will always work further 261# down. 262ifneq "$(DESTDIR)" "" 263INSTALLTOP=$(INSTALLTOP_dir) 264OPENSSLDIR=$(OPENSSLDIR_dir) 265ENGINESDIR=$(ENGINESDIR_dir) 266else 267INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir) 268OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir) 269ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir) 270endif 271 272# $(libdir) is chosen to be compatible with the GNU coding standards 273libdir={- File::Spec::Win32->file_name_is_absolute($libdir) 274 ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -} 275{- output_on() if $config{target} !~ /^mingw/; "" -} 276 277MANDIR=$(INSTALLTOP)/share/man 278DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME) 279HTMLDIR=$(DOCDIR)/html 280 281# MANSUFFIX is for the benefit of anyone who may want to have a suffix 282# appended after the manpage file section number. "ssl" is popular, 283# resulting in files such as config.5ssl rather than config.5. 284MANSUFFIX= 285HTMLSUFFIX=html 286 287# For "optional" echo messages, to get "real" silence 288ECHO = echo 289 290##### User defined commands and flags ################################ 291 292# We let the C compiler driver to take care of .s files. This is done in 293# order to be excused from maintaining a separate set of architecture 294# dependent assembler flags. E.g. if you throw -mcpu=ultrasparc at SPARC 295# gcc, then the driver will automatically translate it to -xarch=v8plus 296# and pass it down to assembler. In any case, we do not define AS or 297# ASFLAGS for this reason. 298 299CROSS_COMPILE={- $config{CROSS_COMPILE} -} 300CC=$(CROSS_COMPILE){- $config{CC} -} 301CXX={- $config{CXX} ? "\$(CROSS_COMPILE)$config{CXX}" : '' -} 302CPPFLAGS={- our $cppflags1 = join(" ", 303 (map { "-D".$_} @{$config{CPPDEFINES}}), 304 (map { "-I".$_} @{$config{CPPINCLUDES}}), 305 @{$config{CPPFLAGS}}) -} 306CFLAGS={- join(' ', @{$config{CFLAGS}}) -} 307CXXFLAGS={- join(' ', @{$config{CXXFLAGS}}) -} 308LDFLAGS= {- join(' ', @{$config{LDFLAGS}}) -} 309EX_LIBS= {- join(' ', @{$config{LDLIBS}}) -} 310 311MAKEDEPEND={- $config{makedepprog} -} 312 313PERL={- $config{PERL} -} 314 315AR=$(CROSS_COMPILE){- $config{AR} -} 316ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -} 317RANLIB={- $config{RANLIB} ? "\$(CROSS_COMPILE)$config{RANLIB}" : "true"; -} 318RC= $(CROSS_COMPILE){- $config{RC} -} 319RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} {- $target{shared_rcflag} -} 320 321RM= rm -f 322RMDIR= rmdir 323TAR= {- $target{TAR} || "tar" -} 324TARFLAGS= {- $target{TARFLAGS} -} 325 326BASENAME= openssl 327NAME= $(BASENAME)-$(VERSION) 328# Relative to $(SRCDIR) 329TARFILE= ../$(NAME).tar 330 331##### Project flags ################################################## 332 333# Variables starting with CNF_ are common variables for all product types 334 335CNF_CPPFLAGS={- our $cppflags2 = 336 join(' ', $target{cppflags} || (), 337 (map { "-D".$_} @{$target{defines}}, 338 @{$config{defines}}), 339 (map { "-I".$_} @{$target{includes}}, 340 @{$config{includes}}), 341 @{$config{cppflags}}) -} 342CNF_CFLAGS={- join(' ', $target{cflags} || (), 343 @{$config{cflags}}) -} 344CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (), 345 @{$config{cxxflags}}) -} 346CNF_LDFLAGS={- join(' ', $target{lflags} || (), 347 @{$config{lflags}}) -} 348CNF_EX_LIBS={- join(' ', $target{ex_libs} || (), 349 @{$config{ex_libs}}) -} 350 351# Variables starting with LIB_ are used to build library object files 352# and shared libraries. 353# Variables starting with DSO_ are used to build DSOs and their object files. 354# Variables starting with BIN_ are used to build programs and their object 355# files. 356 357LIB_CPPFLAGS={- our $lib_cppflags = 358 join(' ', $target{lib_cppflags} || (), 359 $target{shared_cppflag} || (), 360 (map { '-D'.$_ } 361 @{$config{lib_defines} || ()}, 362 @{$config{shared_defines} || ()}), 363 @{$config{lib_cppflags}}, 364 @{$config{shared_cppflag}}); 365 join(' ', $lib_cppflags, 366 (map { '-D'.$_ } 367 'OPENSSLDIR="\"$(OPENSSLDIR)\""', 368 'ENGINESDIR="\"$(ENGINESDIR)\""'), 369 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 370LIB_CFLAGS={- join(' ', $target{lib_cflags} || (), 371 $target{shared_cflag} || (), 372 @{$config{lib_cflags}}, 373 @{$config{shared_cflag}}, 374 '$(CNF_CFLAGS)', '$(CFLAGS)') -} 375LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (), 376 $target{shared_cxxflag} || (), 377 @{$config{lib_cxxflags}}, 378 @{$config{shared_cxxflag}}, 379 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} 380LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (), 381 $config{shared_ldflag} || (), 382 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 383LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 384DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (), 385 $target{module_cppflags} || (), 386 (map { '-D'.$_ } 387 @{$config{dso_defines} || ()}, 388 @{$config{module_defines} || ()}), 389 @{$config{dso_cppflags}}, 390 @{$config{module_cppflags}}, 391 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 392DSO_CFLAGS={- join(' ', $target{dso_cflags} || (), 393 $target{module_cflags} || (), 394 @{$config{dso_cflags}}, 395 @{$config{module_cflags}}, 396 '$(CNF_CFLAGS)', '$(CFLAGS)') -} 397DSO_CXXFLAGS={- join(' ', $target{dso_cxxflags} || (), 398 $target{module_cxxflags} || (), 399 @{$config{dso_cxxflags}}, 400 @{$config{module_cxxflag}}, 401 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} 402DSO_LDFLAGS={- join(' ', $target{dso_ldflags} || (), 403 $target{module_ldflags} || (), 404 @{$config{dso_ldflags}}, 405 @{$config{module_ldflags}}, 406 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 407DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 408BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (), 409 (map { '-D'.$_ } @{$config{bin_defines} || ()}), 410 @{$config{bin_cppflags}}, 411 '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 412BIN_CFLAGS={- join(' ', $target{bin_cflags} || (), 413 @{$config{bin_cflags}}, 414 '$(CNF_CFLAGS)', '$(CFLAGS)') -} 415BIN_CXXFLAGS={- join(' ', $target{bin_cxxflags} || (), 416 @{$config{bin_cxxflags}}, 417 '$(CNF_CXXFLAGS)', '$(CXXFLAGS)') -} 418BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (), 419 @{$config{bin_lflags}}, 420 '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 421BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 422 423# CPPFLAGS_Q is used for one thing only: to build up buildinf.h 424CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g; 425 $cppflags2 =~ s|([\\"])|\\$1|g; 426 $lib_cppflags =~ s|([\\"])|\\$1|g; 427 join(' ', $lib_cppflags || (), $cppflags2 || (), 428 $cppflags1 || ()) -} 429 430PERLASM_SCHEME= {- $target{perlasm_scheme} -} 431 432# For x86 assembler: Set PROCESSOR to 386 if you want to support 433# the 80386. 434PROCESSOR= {- $config{processor} -} 435 436# We want error [and other] messages in English. Trouble is that make(1) 437# doesn't pass macros down as environment variables unless there already 438# was corresponding variable originally set. In other words we can only 439# reassign environment variables, but not set new ones, not in portable 440# manner that is. That's why we reassign several, just to be sure... 441LC_ALL=C 442LC_MESSAGES=C 443LANG=C 444 445# The main targets ################################################### 446 447{- dependmagic('all'); -}: build_libs_nodep build_engines_nodep build_programs_nodep link-utils 448{- dependmagic('build_libs'); -}: build_libs_nodep 449{- dependmagic('build_engines'); -}: build_engines_nodep 450{- dependmagic('build_programs'); -}: build_programs_nodep 451 452build_generated: $(GENERATED_MANDATORY) 453build_libs_nodep: libcrypto.pc libssl.pc openssl.pc 454build_engines_nodep: $(ENGINES) 455build_programs_nodep: $(PROGRAMS) $(SCRIPTS) 456 457# Kept around for backward compatibility 458build_apps build_tests: build_programs 459 460# Convenience target to prebuild all generated files, not just the mandatory 461# ones 462build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) 463 @ : {- output_off() if $disabled{makedepend}; "" -} 464 @echo "Warning: consider configuring with no-makedepend, because if" 465 @echo " target system doesn't have $(PERL)," 466 @echo " then make will fail..." 467 @ : {- output_on() if $disabled{makedepend}; "" -} 468 469test: tests 470{- dependmagic('tests'); -}: build_programs_nodep build_engines_nodep link-utils 471 @ : {- output_off() if $disabled{tests}; "" -} 472 ( cd test; \ 473 mkdir -p test-runs; \ 474 SRCTOP=../$(SRCDIR) \ 475 BLDTOP=../$(BLDDIR) \ 476 RESULT_D=test-runs \ 477 PERL="$(PERL)" \ 478 EXE_EXT={- $exeext -} \ 479 OPENSSL_ENGINES=`cd ../$(BLDDIR)/engines 2>/dev/null && pwd` \ 480 OPENSSL_DEBUG_MEMORY=on \ 481 $(PERL) ../$(SRCDIR)/test/run_tests.pl $(TESTS) ) 482 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} 483 @echo "Tests are not supported with your chosen Configure options" 484 @ : {- output_on() if !$disabled{tests}; "" -} 485 486list-tests: 487 @ : {- output_off() if $disabled{tests}; "" -} 488 @SRCTOP="$(SRCDIR)" \ 489 $(PERL) $(SRCDIR)/test/run_tests.pl list 490 @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} 491 @echo "Tests are not supported with your chosen Configure options" 492 @ : {- output_on() if !$disabled{tests}; "" -} 493 494install: install_sw install_ssldirs install_docs 495 496uninstall: uninstall_docs uninstall_sw 497 498libclean: 499 @set -e; for s in $(SHLIB_INFO); do \ 500 if [ "$$s" = ";" ]; then continue; fi; \ 501 s1=`echo "$$s" | cut -f1 -d";"`; \ 502 s2=`echo "$$s" | cut -f2 -d";"`; \ 503 $(ECHO) $(RM) $$s1; {- output_off() unless windowsdll(); "" -}\ 504 $(RM) apps/$$s1; \ 505 $(RM) test/$$s1; \ 506 $(RM) fuzz/$$s1; {- output_on() unless windowsdll(); "" -}\ 507 $(RM) $$s1; \ 508 if [ "$$s1" != "$$s2" ]; then \ 509 $(ECHO) $(RM) $$s2; \ 510 $(RM) $$s2; \ 511 fi; \ 512 done 513 $(RM) $(LIBS) 514 $(RM) *.map 515 516clean: libclean 517 $(RM) $(PROGRAMS) $(TESTPROGS) $(ENGINES) $(SCRIPTS) 518 $(RM) $(GENERATED_MANDATORY) $(GENERATED) 519 -$(RM) `find . -name '*{- $depext -}' \! -name '.*' \! -type d -print` 520 -$(RM) `find . -name '*{- $objext -}' \! -name '.*' \! -type d -print` 521 $(RM) core 522 $(RM) tags TAGS doc-nits 523 $(RM) -r test/test-runs 524 $(RM) openssl.pc libcrypto.pc libssl.pc 525 -$(RM) `find . -type l \! -name '.*' -print` 526 527distclean: clean 528 $(RM) configdata.pm 529 $(RM) Makefile 530 531# We check if any depfile is newer than Makefile and decide to 532# concatenate only if that is true. 533depend: 534 @: {- output_off() if $disabled{makedepend}; "" -} 535 @$(PERL) $(SRCDIR)/util/add-depends.pl {- 536 defined $makedepprog && $makedepprog =~ /\/makedepend/ 537 ? 'makedepend' : 'gcc' -} 538 @: {- output_on() if $disabled{makedepend}; "" -} 539 540# Install helper targets ############################################# 541 542install_sw: install_dev install_engines install_runtime 543 544uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev 545 546install_docs: install_man_docs install_html_docs 547 548uninstall_docs: uninstall_man_docs uninstall_html_docs 549 $(RM) -r "$(DESTDIR)$(DOCDIR)" 550 551install_ssldirs: 552 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/certs" 553 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/private" 554 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/misc" 555 @set -e; for x in dummy $(MISC_SCRIPTS); do \ 556 if [ "$$x" = "dummy" ]; then continue; fi; \ 557 x1=`echo "$$x" | cut -f1 -d:`; \ 558 x2=`echo "$$x" | cut -f2 -d:`; \ 559 fn=`basename $$x1`; \ 560 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 561 cp $$x1 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \ 562 chmod 755 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \ 563 mv -f "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new" \ 564 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 565 if [ "$$x1" != "$$x2" ]; then \ 566 ln=`basename "$$x2"`; \ 567 : {- output_off() unless windowsdll(); "" -}; \ 568 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 569 cp "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn" "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \ 570 : {- output_on() unless windowsdll(); 571 output_off() if windowsdll(); "" -}; \ 572 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 573 ln -sf $$fn "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \ 574 : {- output_on() if windowsdll(); "" -}; \ 575 fi; \ 576 done 577 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" 578 @cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" 579 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" 580 @mv -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" 581 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ 582 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ 583 cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ 584 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ 585 fi 586 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" 587 @cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" 588 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" 589 @mv -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" 590 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \ 591 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ 592 cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ 593 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ 594 fi 595 596install_dev: install_runtime_libs 597 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 598 @$(ECHO) "*** Installing development files" 599 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/include/openssl" 600 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} 601 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 602 @cp $(SRCDIR)/ms/applink.c "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 603 @chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 604 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} 605 @set -e; for i in $(SRCDIR)/include/openssl/*.h \ 606 $(BLDDIR)/include/openssl/*.h; do \ 607 fn=`basename $$i`; \ 608 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 609 cp $$i "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 610 chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 611 done 612 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" 613 @set -e; for l in $(INSTALL_LIBS); do \ 614 fn=`basename $$l`; \ 615 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \ 616 cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \ 617 $(RANLIB) "$(DESTDIR)$(libdir)/$$fn.new"; \ 618 chmod 644 "$(DESTDIR)$(libdir)/$$fn.new"; \ 619 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \ 620 "$(DESTDIR)$(libdir)/$$fn"; \ 621 done 622 @ : {- output_off() if $disabled{shared}; "" -} 623 @set -e; for s in $(INSTALL_SHLIB_INFO); do \ 624 s1=`echo "$$s" | cut -f1 -d";"`; \ 625 s2=`echo "$$s" | cut -f2 -d";"`; \ 626 fn1=`basename $$s1`; \ 627 fn2=`basename $$s2`; \ 628 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \ 629 if [ "$$fn1" != "$$fn2" ]; then \ 630 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \ 631 ln -sf $$fn1 "$(DESTDIR)$(libdir)/$$fn2"; \ 632 fi; \ 633 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \ 634 $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \ 635 cp $$s2 "$(DESTDIR)$(libdir)/$$fn2.new"; \ 636 chmod 755 "$(DESTDIR)$(libdir)/$$fn2.new"; \ 637 mv -f "$(DESTDIR)$(libdir)/$$fn2.new" \ 638 "$(DESTDIR)$(libdir)/$$fn2"; \ 639 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \ 640 a="$(DESTDIR)$(libdir)/$$fn2"; \ 641 $(ECHO) "install $$s1 -> $$a"; \ 642 if [ -f "$$a" ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \ 643 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \ 644 cp -f "$$a" "$$a.new"; \ 645 for so in `$(AR) t "$$a"`; do \ 646 $(AR) x "$$a" "$$so"; \ 647 chmod u+w "$$so"; \ 648 strip -X32_64 -e "$$so"; \ 649 $(AR) r "$$a.new" "$$so"; \ 650 done; \ 651 )); fi; \ 652 $(AR) r "$$a.new" "$$s1"; \ 653 mv -f "$$a.new" "$$a"; \ 654 : {- output_off() if sharedaix(); output_on(); "" -}; \ 655 done 656 @ : {- output_on() if $disabled{shared}; "" -} 657 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)/pkgconfig" 658 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" 659 @cp libcrypto.pc "$(DESTDIR)$(libdir)/pkgconfig" 660 @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" 661 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc" 662 @cp libssl.pc "$(DESTDIR)$(libdir)/pkgconfig" 663 @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/libssl.pc" 664 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc" 665 @cp openssl.pc "$(DESTDIR)$(libdir)/pkgconfig" 666 @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/openssl.pc" 667 668uninstall_dev: uninstall_runtime_libs 669 @$(ECHO) "*** Uninstalling development files" 670 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} 671 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 672 @$(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 673 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} 674 @set -e; for i in $(SRCDIR)/include/openssl/*.h \ 675 $(BLDDIR)/include/openssl/*.h; do \ 676 fn=`basename $$i`; \ 677 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 678 $(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 679 done 680 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include/openssl" 681 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include" 682 @set -e; for l in $(INSTALL_LIBS); do \ 683 fn=`basename $$l`; \ 684 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \ 685 $(RM) "$(DESTDIR)$(libdir)/$$fn"; \ 686 done 687 @ : {- output_off() if $disabled{shared}; "" -} 688 @set -e; for s in $(INSTALL_SHLIB_INFO); do \ 689 s1=`echo "$$s" | cut -f1 -d";"`; \ 690 s2=`echo "$$s" | cut -f2 -d";"`; \ 691 fn1=`basename $$s1`; \ 692 fn2=`basename $$s2`; \ 693 : {- output_off() if windowsdll(); "" -}; \ 694 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ 695 $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \ 696 if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \ 697 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \ 698 $(RM) "$(DESTDIR)$(libdir)/$$fn1"; \ 699 fi; \ 700 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ 701 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ 702 $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \ 703 : {- output_on() unless windowsdll(); "" -}; \ 704 done 705 @ : {- output_on() if $disabled{shared}; "" -} 706 $(RM) "$(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" 707 $(RM) "$(DESTDIR)$(libdir)/pkgconfig/libssl.pc" 708 $(RM) "$(DESTDIR)$(libdir)/pkgconfig/openssl.pc" 709 -$(RMDIR) "$(DESTDIR)$(libdir)/pkgconfig" 710 -$(RMDIR) "$(DESTDIR)$(libdir)" 711 712install_engines: install_runtime_libs build_engines 713 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 714 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/" 715 @$(ECHO) "*** Installing engines" 716 @set -e; for e in dummy $(INSTALL_ENGINES); do \ 717 if [ "$$e" = "dummy" ]; then continue; fi; \ 718 fn=`basename $$e`; \ 719 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ 720 cp $$e "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \ 721 chmod 755 "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \ 722 mv -f "$(DESTDIR)$(ENGINESDIR)/$$fn.new" \ 723 "$(DESTDIR)$(ENGINESDIR)/$$fn"; \ 724 done 725 726uninstall_engines: 727 @$(ECHO) "*** Uninstalling engines" 728 @set -e; for e in dummy $(INSTALL_ENGINES); do \ 729 if [ "$$e" = "dummy" ]; then continue; fi; \ 730 fn=`basename $$e`; \ 731 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \ 732 continue; \ 733 fi; \ 734 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ 735 $(RM) "$(DESTDIR)$(ENGINESDIR)/$$fn"; \ 736 done 737 -$(RMDIR) "$(DESTDIR)$(ENGINESDIR)" 738 739install_runtime: install_programs 740 741install_runtime_libs: build_libs 742 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 743 @ : {- output_off() if windowsdll(); "" -} 744 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" 745 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -} 746 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/bin" 747 @ : {- output_on() unless windowsdll(); "" -} 748 @$(ECHO) "*** Installing runtime libraries" 749 @set -e; for s in dummy $(INSTALL_SHLIBS); do \ 750 if [ "$$s" = "dummy" ]; then continue; fi; \ 751 fn=`basename $$s`; \ 752 : {- output_off() unless windowsdll(); "" -}; \ 753 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 754 cp $$s "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 755 chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 756 mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \ 757 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 758 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ 759 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \ 760 cp $$s "$(DESTDIR)$(libdir)/$$fn.new"; \ 761 chmod 755 "$(DESTDIR)$(libdir)/$$fn.new"; \ 762 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \ 763 "$(DESTDIR)$(libdir)/$$fn"; \ 764 : {- output_on() if windowsdll(); "" -}; \ 765 done 766 767install_programs: install_runtime_libs build_programs 768 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 769 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/bin" 770 @$(ECHO) "*** Installing runtime programs" 771 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \ 772 if [ "$$x" = "dummy" ]; then continue; fi; \ 773 fn=`basename $$x`; \ 774 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 775 cp $$x "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 776 chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 777 mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \ 778 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 779 done 780 @set -e; for x in dummy $(BIN_SCRIPTS); do \ 781 if [ "$$x" = "dummy" ]; then continue; fi; \ 782 fn=`basename $$x`; \ 783 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 784 cp $$x "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 785 chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 786 mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \ 787 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 788 done 789 790uninstall_runtime: uninstall_programs uninstall_runtime_libs 791 792uninstall_programs: 793 @$(ECHO) "*** Uninstalling runtime programs" 794 @set -e; for x in dummy $(INSTALL_PROGRAMS); \ 795 do \ 796 if [ "$$x" = "dummy" ]; then continue; fi; \ 797 fn=`basename $$x`; \ 798 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 799 $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 800 done; 801 @set -e; for x in dummy $(BIN_SCRIPTS); \ 802 do \ 803 if [ "$$x" = "dummy" ]; then continue; fi; \ 804 fn=`basename $$x`; \ 805 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 806 $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 807 done 808 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/bin" 809 810uninstall_runtime_libs: 811 @$(ECHO) "*** Uninstalling runtime libraries" 812 @ : {- output_off() unless windowsdll(); "" -} 813 @set -e; for s in dummy $(INSTALL_SHLIBS); do \ 814 if [ "$$s" = "dummy" ]; then continue; fi; \ 815 fn=`basename $$s`; \ 816 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 817 $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 818 done 819 @ : {- output_on() unless windowsdll(); "" -} 820 821 822install_man_docs: 823 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 824 @$(ECHO) "*** Installing manpages" 825 $(PERL) $(SRCDIR)/util/process_docs.pl \ 826 "--destdir=$(DESTDIR)$(MANDIR)" --type=man --suffix=$(MANSUFFIX) 827 828uninstall_man_docs: 829 @$(ECHO) "*** Uninstalling manpages" 830 $(PERL) $(SRCDIR)/util/process_docs.pl \ 831 "--destdir=$(DESTDIR)$(MANDIR)" --type=man --suffix=$(MANSUFFIX) \ 832 --remove 833 834install_html_docs: 835 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 836 @$(ECHO) "*** Installing HTML manpages" 837 $(PERL) $(SRCDIR)/util/process_docs.pl \ 838 "--destdir=$(DESTDIR)$(HTMLDIR)" --type=html 839 840uninstall_html_docs: 841 @$(ECHO) "*** Uninstalling manpages" 842 $(PERL) $(SRCDIR)/util/process_docs.pl \ 843 "--destdir=$(DESTDIR)$(HTMLDIR)" --type=html --remove 844 845 846# Developer targets (note: these are only available on Unix) ######### 847 848update: generate errors ordinals 849 850generate: generate_apps generate_crypto_bn generate_crypto_objects \ 851 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids 852 853.PHONY: doc-nits 854doc-nits: 855 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits 856 @if [ -s doc-nits ] ; then cat doc-nits ; exit 1; \ 857 else echo 'doc-nits: no errors.'; rm doc-nits ; fi 858 859# Test coverage is a good idea for the future 860#coverage: $(PROGRAMS) $(TESTPROGRAMS) 861# ... 862 863lint: 864 lint -DLINT $(INCLUDES) $(SRCS) 865 866generate_apps: 867 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ 868 < apps/openssl.cnf > apps/openssl-vms.cnf ) 869 870generate_crypto_bn: 871 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) 872 873generate_crypto_objects: 874 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \ 875 crypto/objects/objects.txt \ 876 crypto/objects/obj_mac.num \ 877 > crypto/objects/obj_mac.new && \ 878 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num ) 879 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ 880 crypto/objects/objects.txt \ 881 crypto/objects/obj_mac.num \ 882 > include/openssl/obj_mac.h ) 883 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ 884 include/openssl/obj_mac.h \ 885 > crypto/objects/obj_dat.h ) 886 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ 887 crypto/objects/obj_mac.num \ 888 crypto/objects/obj_xref.txt \ 889 > crypto/objects/obj_xref.h ) 890 891generate_crypto_conf: 892 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ 893 > crypto/conf/conf_def.h ) 894 895generate_crypto_asn1: 896 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ 897 > crypto/asn1/charmap.h ) 898 899generate_fuzz_oids: 900 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \ 901 crypto/objects/obj_dat.h \ 902 > fuzz/oids.txt ) 903 904# Set to -force to force a rebuild 905ERROR_REBUILD= 906errors: 907 ( b=`pwd`; set -e; cd $(SRCDIR); \ 908 $(PERL) util/ck_errf.pl -strict -internal; \ 909 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal ) 910 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \ 911 for E in *.ec ; do \ 912 $(PERL) ../util/ck_errf.pl -strict \ 913 -conf $$E `basename $$E .ec`.c; \ 914 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \ 915 -conf $$E `basename $$E .ec`.c ; \ 916 done ) 917 918ordinals: 919 $(PERL) $(SRCDIR)/util/mkdef.pl crypto update 920 $(PERL) $(SRCDIR)/util/mkdef.pl ssl update 921 922test_ordinals: 923 ( cd test; \ 924 SRCTOP=../$(SRCDIR) \ 925 BLDTOP=../$(BLDDIR) \ 926 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals ) 927 928tags TAGS: FORCE 929 rm -f TAGS tags 930 -ctags -R . 931 -etags `find . -name '*.[ch]' -o -name '*.pm'` 932 933# Release targets (note: only available on Unix) ##################### 934 935tar: 936 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)') 937 938# Helper targets ##################################################### 939 940link-utils: $(BLDDIR)/util/opensslwrap.sh 941 942$(BLDDIR)/util/opensslwrap.sh: configdata.pm 943 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ 944 mkdir -p "$(BLDDIR)/util"; \ 945 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \ 946 fi 947 948FORCE: 949 950# Building targets ################################################### 951 952libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -} 953libcrypto.pc: 954 @ ( echo 'prefix=$(INSTALLTOP)'; \ 955 echo 'exec_prefix=$${prefix}'; \ 956 if [ -n "$(LIBDIR)" ]; then \ 957 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ 958 else \ 959 echo 'libdir=$(libdir)'; \ 960 fi; \ 961 echo 'includedir=$${prefix}/include'; \ 962 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \ 963 echo ''; \ 964 echo 'Name: OpenSSL-libcrypto'; \ 965 echo 'Description: OpenSSL cryptography library'; \ 966 echo 'Version: '$(VERSION); \ 967 echo 'Libs: -L$${libdir} -lcrypto'; \ 968 echo 'Libs.private: $(LIB_EX_LIBS)'; \ 969 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc 970 971libssl.pc: 972 @ ( echo 'prefix=$(INSTALLTOP)'; \ 973 echo 'exec_prefix=$${prefix}'; \ 974 if [ -n "$(LIBDIR)" ]; then \ 975 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ 976 else \ 977 echo 'libdir=$(libdir)'; \ 978 fi; \ 979 echo 'includedir=$${prefix}/include'; \ 980 echo ''; \ 981 echo 'Name: OpenSSL-libssl'; \ 982 echo 'Description: Secure Sockets Layer and cryptography libraries'; \ 983 echo 'Version: '$(VERSION); \ 984 echo 'Requires.private: libcrypto'; \ 985 echo 'Libs: -L$${libdir} -lssl'; \ 986 echo 'Cflags: -I$${includedir}' ) > libssl.pc 987 988openssl.pc: 989 @ ( echo 'prefix=$(INSTALLTOP)'; \ 990 echo 'exec_prefix=$${prefix}'; \ 991 if [ -n "$(LIBDIR)" ]; then \ 992 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ 993 else \ 994 echo 'libdir=$(libdir)'; \ 995 fi; \ 996 echo 'includedir=$${prefix}/include'; \ 997 echo ''; \ 998 echo 'Name: OpenSSL'; \ 999 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ 1000 echo 'Version: '$(VERSION); \ 1001 echo 'Requires: libssl libcrypto' ) > openssl.pc 1002 1003configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} 1004 @echo "Detected changed: $?" 1005 $(PERL) configdata.pm -r 1006 @echo "**************************************************" 1007 @echo "*** ***" 1008 @echo "*** Please run the same make command again ***" 1009 @echo "*** ***" 1010 @echo "**************************************************" 1011 @false 1012 1013reconfigure reconf: 1014 $(PERL) configdata.pm -r 1015 1016{- 1017 use File::Basename; 1018 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; 1019 1020 # Helper function to figure out dependencies on libraries 1021 # It takes a list of library names and outputs a list of dependencies 1022 sub compute_lib_depends { 1023 if ($disabled{shared}) { 1024 return map { lib($_) } @_; 1025 } 1026 1027 # Depending on shared libraries: 1028 # On Windows POSIX layers, we depend on {libname}.dll.a 1029 # On Unix platforms, we depend on {shlibname}.so 1030 return map { $_ =~ /\.a$/ ? $`.$libext : shlib_simple($_) } @_; 1031 } 1032 1033 sub generatesrc { 1034 my %args = @_; 1035 my $generator = join(" ", @{$args{generator}}); 1036 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); 1037 my $incs = join("", map { " -I".$_ } @{$args{incs}}); 1038 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}}); 1039 1040 if ($args{src} !~ /\.[sS]$/) { 1041 if ($args{generator}->[0] =~ m|^.*\.in$|) { 1042 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, 1043 "util", "dofile.pl")), 1044 rel2abs($config{builddir})); 1045 return <<"EOF"; 1046$args{src}: $args{generator}->[0] $deps 1047 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ 1048 "-o$target{build_file}" $generator > \$@ 1049EOF 1050 } else { 1051 return <<"EOF"; 1052$args{src}: $args{generator}->[0] $deps 1053 \$(PERL)$generator_incs $generator > \$@ 1054EOF 1055 } 1056 } else { 1057 if ($args{generator}->[0] =~ /\.pl$/) { 1058 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator; 1059 } elsif ($args{generator}->[0] =~ /\.m4$/) { 1060 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >' 1061 } elsif ($args{generator}->[0] =~ /\.S$/) { 1062 $generator = undef; 1063 } else { 1064 die "Generator type for $args{src} unknown: $generator\n"; 1065 } 1066 1067 my $cppflags = { 1068 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 1069 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', 1070 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' 1071 } -> {$args{intent}}; 1072 if (defined($generator)) { 1073 return <<"EOF"; 1074$args{src}: $args{generator}->[0] $deps 1075 $generator \$@ 1076EOF 1077 } 1078 return <<"EOF"; 1079$args{src}: $args{generator}->[0] $deps 1080 \$(CC) $incs $cppflags -E $args{generator}->[0] | \\ 1081 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ 1082EOF 1083 } 1084 } 1085 1086 # Should one wonder about the end of the Perl snippet, it's because this 1087 # second regexp eats up line endings as well, if the removed path is the 1088 # last in the line. We may therefore need to put back a line ending. 1089 sub src2obj { 1090 my %args = @_; 1091 (my $obj = $args{obj}) =~ s|\.o$||; 1092 my @srcs = @{$args{srcs}}; 1093 my $srcs = join(" ", @srcs); 1094 my $deps = join(" ", @srcs, @{$args{deps}}); 1095 my $incs = join("", map { " -I".$_ } @{$args{incs}}); 1096 my $cmd; 1097 my $cmdflags; 1098 my $cmdcompile; 1099 if (grep /\.rc$/, @srcs) { 1100 $cmd = '$(RC)'; 1101 $cmdflags = '$(RCFLAGS)'; 1102 $cmdcompile = ''; 1103 } elsif (grep /\.(cc|cpp)$/, @srcs) { 1104 $cmd = '$(CXX)'; 1105 $cmdcompile = ' -c'; 1106 $cmdflags = { 1107 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', 1108 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)', 1109 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)' 1110 } -> {$args{intent}}; 1111 } else { 1112 $cmd = '$(CC)'; 1113 $cmdcompile = ' -c'; 1114 $cmdflags = { 1115 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 1116 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', 1117 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' 1118 } -> {$args{intent}}; 1119 } 1120 my $recipe; 1121 # extension-specific rules 1122 if (grep /\.s$/, @srcs) { 1123 $recipe .= <<"EOF"; 1124$obj$objext: $deps 1125 $cmd $cmdflags -c -o \$\@ $srcs 1126EOF 1127 } elsif (grep /\.S$/, @srcs) { 1128 # Originally there was mutli-step rule with $(CC) -E file.S 1129 # followed by $(CC) -c file.s. It compensated for one of 1130 # legacy platform compiler's inability to handle .S files. 1131 # The platform is long discontinued by vendor so there is 1132 # hardly a point to drag it along... 1133 $recipe .= <<"EOF"; 1134$obj$objext: $deps 1135 $cmd $incs $cmdflags -c -o \$\@ $srcs 1136EOF 1137 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/ 1138 && !grep /\.rc$/, @srcs) { 1139 $recipe .= <<"EOF"; 1140$obj$objext: $deps 1141 $cmd $incs $cmdflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs 1142 \@touch $obj$depext.tmp 1143 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\ 1144 rm -f $obj$depext.tmp; \\ 1145 else \\ 1146 mv $obj$depext.tmp $obj$depext; \\ 1147 fi 1148EOF 1149 } else { 1150 $recipe .= <<"EOF"; 1151$obj$objext: $deps 1152 $cmd $incs $cmdflags $cmdcompile -o \$\@ $srcs 1153EOF 1154 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) { 1155 $recipe .= <<"EOF"; 1156 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\ 1157 > $obj$depext 1158EOF 1159 } 1160 } 1161 return $recipe; 1162 } 1163 # We *know* this routine is only called when we've configure 'shared'. 1164 sub libobj2shlib { 1165 my %args = @_; 1166 my $lib = $args{lib}; 1167 my $shlib = $args{shlib}; 1168 my $libd = dirname($lib); 1169 my $libn = basename($lib); 1170 (my $libname = $libn) =~ s/^lib//; 1171 my @linkdirs = (); 1172 foreach (@{args{deps}}) { 1173 my $d = dirname($_); 1174 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; 1175 } 1176 my $linkflags = join("", map { "-L$_ " } @linkdirs); 1177 my $linklibs = join("", map { my $f = basename($_); 1178 (my $l = $f) =~ s/^lib//; 1179 " -l$l" } @{$args{deps}}); 1180 my @objs = map { (my $x = $_) =~ s|\.o$||; "$x$objext" } 1181 grep { $_ !~ m/\.(?:def|map)$/ } 1182 @{$args{objs}}; 1183 my @defs = grep { $_ =~ /\.(?:def|map)$/ } @{$args{objs}}; 1184 my @deps = compute_lib_depends(@{$args{deps}}); 1185 die "More than one exported symbol map" if scalar @defs > 1; 1186 my $objs = join(" ", @objs); 1187 my $deps = join(" ", @objs, @defs, @deps); 1188 my $simple = shlib_simple($lib); 1189 my $full = shlib($lib); 1190 my $target = "$simple $full"; 1191 my $shared_soname = ""; 1192 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full) 1193 if defined $target{shared_sonameflag}; 1194 my $shared_imp = ""; 1195 $shared_imp .= ' '.$target{shared_impflag}.basename($simple) 1196 if defined $target{shared_impflag}; 1197 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); 1198 my $recipe = <<"EOF"; 1199$target: $deps 1200 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\ 1201 -o $full$shared_def $objs \\ 1202 $linklibs \$(LIB_EX_LIBS) 1203EOF 1204 if (windowsdll()) { 1205 $recipe .= <<"EOF"; 1206 rm -f apps/$shlib'\$(SHLIB_EXT)' 1207 rm -f test/$shlib'\$(SHLIB_EXT)' 1208 rm -f fuzz/$shlib'\$(SHLIB_EXT)' 1209 cp -p $shlib'\$(SHLIB_EXT)' apps/ 1210 cp -p $shlib'\$(SHLIB_EXT)' test/ 1211 cp -p $shlib'\$(SHLIB_EXT)' fuzz/ 1212EOF 1213 } elsif (sharedaix()) { 1214 $recipe .= <<"EOF"; 1215 rm -f $simple && \\ 1216 \$(AR) r $simple $full 1217EOF 1218 } else { 1219 $recipe .= <<"EOF"; 1220 if [ '$simple' != '$full' ]; then \\ 1221 rm -f $simple; \\ 1222 ln -s $full $simple; \\ 1223 fi 1224EOF 1225 } 1226 } 1227 sub obj2dso { 1228 my %args = @_; 1229 my $dso = $args{lib}; 1230 my $dsod = dirname($dso); 1231 my $dson = basename($dso); 1232 my @linkdirs = (); 1233 foreach (@{args{deps}}) { 1234 my $d = dirname($_); 1235 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; 1236 } 1237 my $linkflags = join("", map { "-L$_ " } @linkdirs); 1238 my $linklibs = join("", map { my $f = basename($_); 1239 (my $l = $f) =~ s/^lib//; 1240 " -l$l" } @{$args{deps}}); 1241 my @objs = map { (my $x = $_) =~ s|\.o$||; "$x$objext" } 1242 grep { $_ !~ m/\.(?:def|map)$/ } 1243 @{$args{objs}}; 1244 my @deps = compute_lib_depends(@{$args{deps}}); 1245 my $objs = join(" ", @objs); 1246 my $deps = join(" ", @deps); 1247 my $target = dso($dso); 1248 return <<"EOF"; 1249$target: $objs $deps 1250 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\ 1251 -o $target $objs \\ 1252 $linklibs \$(DSO_EX_LIBS) 1253EOF 1254 } 1255 sub obj2lib { 1256 my %args = @_; 1257 (my $lib = $args{lib}) =~ s/\.a$//; 1258 my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}}; 1259 my $objs = join(" ", @objs); 1260 return <<"EOF"; 1261$lib$libext: $objs 1262 \$(AR) \$(ARFLAGS) \$\@ \$\? 1263 \$(RANLIB) \$\@ || echo Never mind. 1264EOF 1265 } 1266 sub obj2bin { 1267 my %args = @_; 1268 my $bin = $args{bin}; 1269 my $bind = dirname($bin); 1270 my $binn = basename($bin); 1271 my $objs = join(" ", map { (my $x = $_) =~ s|\.o$||; "$x$objext" } 1272 @{$args{objs}}); 1273 my $deps = join(" ",compute_lib_depends(@{$args{deps}})); 1274 my @linkdirs = (); 1275 foreach (@{args{deps}}) { 1276 next if $_ =~ /\.a$/; 1277 my $d = dirname($_); 1278 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; 1279 } 1280 my $linkflags = join("", map { "-L$_ " } @linkdirs); 1281 my $linklibs = join("", map { if ($_ =~ s/\.a$//) { 1282 " $_$libext"; 1283 } else { 1284 my $f = basename($_); 1285 (my $l = $f) =~ s/^lib//; 1286 " -l$l" 1287 } 1288 } @{$args{deps}}); 1289 my $cmd = '$(CC)'; 1290 my $cmdflags = '$(BIN_CFLAGS)'; 1291 if (grep /_cc\.o$/, @{$args{objs}}) { 1292 $cmd = '$(CXX)'; 1293 $cmdflags = '$(BIN_CXXFLAGS)'; 1294 } 1295 return <<"EOF"; 1296$bin$exeext: $objs $deps 1297 rm -f $bin$exeext 1298 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\ 1299 -o $bin$exeext $objs \\ 1300 $linklibs \$(BIN_EX_LIBS) 1301EOF 1302 } 1303 sub in2script { 1304 my %args = @_; 1305 my $script = $args{script}; 1306 my $sources = join(" ", @{$args{sources}}); 1307 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, 1308 "util", "dofile.pl")), 1309 rel2abs($config{builddir})); 1310 return <<"EOF"; 1311$script: $sources 1312 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ 1313 "-o$target{build_file}" $sources > "$script" 1314 chmod a+x $script 1315EOF 1316 } 1317 sub generatedir { 1318 my %args = @_; 1319 my $dir = $args{dir}; 1320 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}}; 1321 my @actions = (); 1322 my %extinfo = ( dso => $dsoext, 1323 lib => $libext, 1324 bin => $exeext ); 1325 1326 # We already have a 'test' target, and the top directory is just plain 1327 # silly 1328 return if $dir eq "test" || $dir eq "."; 1329 1330 foreach my $type (("dso", "lib", "bin", "script")) { 1331 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); 1332 # For lib object files, we could update the library. However, it 1333 # was decided that it's enough to build the directory local object 1334 # files, so we don't need to add any actions, and the dependencies 1335 # are already taken care of. 1336 if ($type ne "lib") { 1337 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { 1338 if (dirname($prod) eq $dir) { 1339 push @deps, $prod.$extinfo{$type}; 1340 } else { 1341 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); 1342 } 1343 } 1344 } 1345 } 1346 1347 my $deps = join(" ", @deps); 1348 my $actions = join("\n", "", @actions); 1349 return <<"EOF"; 1350$dir $dir/: $deps$actions 1351EOF 1352 } 1353 "" # Important! This becomes part of the template result. 1354-} 1355