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 $(RM) $(TARFILE) 527 528distclean: clean 529 $(RM) configdata.pm 530 $(RM) Makefile 531 532# We check if any depfile is newer than Makefile and decide to 533# concatenate only if that is true. 534depend: 535 @: {- output_off() if $disabled{makedepend}; "" -} 536 @$(PERL) $(SRCDIR)/util/add-depends.pl {- 537 defined $makedepprog && $makedepprog =~ /\/makedepend/ 538 ? 'makedepend' : 'gcc' -} 539 @: {- output_on() if $disabled{makedepend}; "" -} 540 541# Install helper targets ############################################# 542 543install_sw: install_dev install_engines install_runtime 544 545uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev 546 547install_docs: install_man_docs install_html_docs 548 549uninstall_docs: uninstall_man_docs uninstall_html_docs 550 $(RM) -r "$(DESTDIR)$(DOCDIR)" 551 552install_ssldirs: 553 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/certs" 554 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/private" 555 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(OPENSSLDIR)/misc" 556 @set -e; for x in dummy $(MISC_SCRIPTS); do \ 557 if [ "$$x" = "dummy" ]; then continue; fi; \ 558 x1=`echo "$$x" | cut -f1 -d:`; \ 559 x2=`echo "$$x" | cut -f2 -d:`; \ 560 fn=`basename $$x1`; \ 561 $(ECHO) "install $$x1 -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 562 cp $$x1 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \ 563 chmod 755 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new"; \ 564 mv -f "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn.new" \ 565 "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 566 if [ "$$x1" != "$$x2" ]; then \ 567 ln=`basename "$$x2"`; \ 568 : {- output_off() unless windowsdll(); "" -}; \ 569 $(ECHO) "copy $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 570 cp "$(DESTDIR)$(OPENSSLDIR)/misc/$$fn" "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \ 571 : {- output_on() unless windowsdll(); 572 output_off() if windowsdll(); "" -}; \ 573 $(ECHO) "link $(DESTDIR)$(OPENSSLDIR)/misc/$$ln -> $(DESTDIR)$(OPENSSLDIR)/misc/$$fn"; \ 574 ln -sf $$fn "$(DESTDIR)$(OPENSSLDIR)/misc/$$ln"; \ 575 : {- output_on() if windowsdll(); "" -}; \ 576 fi; \ 577 done 578 @$(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" 579 @cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" 580 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" 581 @mv -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf.dist" 582 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf" ]; then \ 583 $(ECHO) "install $(SRCDIR)/apps/openssl.cnf -> $(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ 584 cp $(SRCDIR)/apps/openssl.cnf "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ 585 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/openssl.cnf"; \ 586 fi 587 @$(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" 588 @cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" 589 @chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" 590 @mv -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.new" "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf.dist" 591 @if [ ! -f "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf" ]; then \ 592 $(ECHO) "install $(SRCDIR)/apps/ct_log_list.cnf -> $(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ 593 cp $(SRCDIR)/apps/ct_log_list.cnf "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ 594 chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \ 595 fi 596 597install_dev: install_runtime_libs 598 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 599 @$(ECHO) "*** Installing development files" 600 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/include/openssl" 601 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} 602 @$(ECHO) "install $(SRCDIR)/ms/applink.c -> $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 603 @cp $(SRCDIR)/ms/applink.c "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 604 @chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 605 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} 606 @set -e; for i in $(SRCDIR)/include/openssl/*.h \ 607 $(BLDDIR)/include/openssl/*.h; do \ 608 fn=`basename $$i`; \ 609 $(ECHO) "install $$i -> $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 610 cp $$i "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 611 chmod 644 "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 612 done 613 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" 614 @set -e; for l in $(INSTALL_LIBS); do \ 615 fn=`basename $$l`; \ 616 $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \ 617 cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \ 618 $(RANLIB) "$(DESTDIR)$(libdir)/$$fn.new"; \ 619 chmod 644 "$(DESTDIR)$(libdir)/$$fn.new"; \ 620 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \ 621 "$(DESTDIR)$(libdir)/$$fn"; \ 622 done 623 @ : {- output_off() if $disabled{shared}; "" -} 624 @set -e; for s in $(INSTALL_SHLIB_INFO); do \ 625 s1=`echo "$$s" | cut -f1 -d";"`; \ 626 s2=`echo "$$s" | cut -f2 -d";"`; \ 627 fn1=`basename $$s1`; \ 628 fn2=`basename $$s2`; \ 629 : {- output_off(); output_on() unless windowsdll() or sharedaix(); "" -}; \ 630 if [ "$$fn1" != "$$fn2" ]; then \ 631 $(ECHO) "link $(DESTDIR)$(libdir)/$$fn2 -> $(DESTDIR)$(libdir)/$$fn1"; \ 632 ln -sf $$fn1 "$(DESTDIR)$(libdir)/$$fn2"; \ 633 fi; \ 634 : {- output_off() unless windowsdll() or sharedaix(); output_on() if windowsdll(); "" -}; \ 635 $(ECHO) "install $$s2 -> $(DESTDIR)$(libdir)/$$fn2"; \ 636 cp $$s2 "$(DESTDIR)$(libdir)/$$fn2.new"; \ 637 chmod 755 "$(DESTDIR)$(libdir)/$$fn2.new"; \ 638 mv -f "$(DESTDIR)$(libdir)/$$fn2.new" \ 639 "$(DESTDIR)$(libdir)/$$fn2"; \ 640 : {- output_off() if windowsdll(); output_on() if sharedaix(); "" -}; \ 641 a="$(DESTDIR)$(libdir)/$$fn2"; \ 642 $(ECHO) "install $$s1 -> $$a"; \ 643 if [ -f "$$a" ]; then ( trap "rm -rf /tmp/ar.$$$$" INT 0; \ 644 mkdir /tmp/ar.$$$$; ( cd /tmp/ar.$$$$; \ 645 cp -f "$$a" "$$a.new"; \ 646 for so in `$(AR) t "$$a"`; do \ 647 $(AR) x "$$a" "$$so"; \ 648 chmod u+w "$$so"; \ 649 strip -X32_64 -e "$$so"; \ 650 $(AR) r "$$a.new" "$$so"; \ 651 done; \ 652 )); fi; \ 653 $(AR) r "$$a.new" "$$s1"; \ 654 mv -f "$$a.new" "$$a"; \ 655 : {- output_off() if sharedaix(); output_on(); "" -}; \ 656 done 657 @ : {- output_on() if $disabled{shared}; "" -} 658 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)/pkgconfig" 659 @$(ECHO) "install libcrypto.pc -> $(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" 660 @cp libcrypto.pc "$(DESTDIR)$(libdir)/pkgconfig" 661 @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" 662 @$(ECHO) "install libssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/libssl.pc" 663 @cp libssl.pc "$(DESTDIR)$(libdir)/pkgconfig" 664 @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/libssl.pc" 665 @$(ECHO) "install openssl.pc -> $(DESTDIR)$(libdir)/pkgconfig/openssl.pc" 666 @cp openssl.pc "$(DESTDIR)$(libdir)/pkgconfig" 667 @chmod 644 "$(DESTDIR)$(libdir)/pkgconfig/openssl.pc" 668 669uninstall_dev: uninstall_runtime_libs 670 @$(ECHO) "*** Uninstalling development files" 671 @ : {- output_off() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} 672 @$(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 673 @$(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/applink.c" 674 @ : {- output_on() unless grep { $_ eq "OPENSSL_USE_APPLINK" } (@{$target{defines}}, @{$config{defines}}); "" -} 675 @set -e; for i in $(SRCDIR)/include/openssl/*.h \ 676 $(BLDDIR)/include/openssl/*.h; do \ 677 fn=`basename $$i`; \ 678 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 679 $(RM) "$(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \ 680 done 681 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include/openssl" 682 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/include" 683 @set -e; for l in $(INSTALL_LIBS); do \ 684 fn=`basename $$l`; \ 685 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn"; \ 686 $(RM) "$(DESTDIR)$(libdir)/$$fn"; \ 687 done 688 @ : {- output_off() if $disabled{shared}; "" -} 689 @set -e; for s in $(INSTALL_SHLIB_INFO); do \ 690 s1=`echo "$$s" | cut -f1 -d";"`; \ 691 s2=`echo "$$s" | cut -f2 -d";"`; \ 692 fn1=`basename $$s1`; \ 693 fn2=`basename $$s2`; \ 694 : {- output_off() if windowsdll(); "" -}; \ 695 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ 696 $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \ 697 if [ "$$fn1" != "$$fn2" -a -f "$(DESTDIR)$(libdir)/$$fn1" ]; then \ 698 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn1"; \ 699 $(RM) "$(DESTDIR)$(libdir)/$$fn1"; \ 700 fi; \ 701 : {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \ 702 $(ECHO) "$(RM) $(DESTDIR)$(libdir)/$$fn2"; \ 703 $(RM) "$(DESTDIR)$(libdir)/$$fn2"; \ 704 : {- output_on() unless windowsdll(); "" -}; \ 705 done 706 @ : {- output_on() if $disabled{shared}; "" -} 707 $(RM) "$(DESTDIR)$(libdir)/pkgconfig/libcrypto.pc" 708 $(RM) "$(DESTDIR)$(libdir)/pkgconfig/libssl.pc" 709 $(RM) "$(DESTDIR)$(libdir)/pkgconfig/openssl.pc" 710 -$(RMDIR) "$(DESTDIR)$(libdir)/pkgconfig" 711 -$(RMDIR) "$(DESTDIR)$(libdir)" 712 713install_engines: install_runtime_libs build_engines 714 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 715 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/" 716 @$(ECHO) "*** Installing engines" 717 @set -e; for e in dummy $(INSTALL_ENGINES); do \ 718 if [ "$$e" = "dummy" ]; then continue; fi; \ 719 fn=`basename $$e`; \ 720 $(ECHO) "install $$e -> $(DESTDIR)$(ENGINESDIR)/$$fn"; \ 721 cp $$e "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \ 722 chmod 755 "$(DESTDIR)$(ENGINESDIR)/$$fn.new"; \ 723 mv -f "$(DESTDIR)$(ENGINESDIR)/$$fn.new" \ 724 "$(DESTDIR)$(ENGINESDIR)/$$fn"; \ 725 done 726 727uninstall_engines: 728 @$(ECHO) "*** Uninstalling engines" 729 @set -e; for e in dummy $(INSTALL_ENGINES); do \ 730 if [ "$$e" = "dummy" ]; then continue; fi; \ 731 fn=`basename $$e`; \ 732 if [ "$$fn" = '{- dso("ossltest") -}' ]; then \ 733 continue; \ 734 fi; \ 735 $(ECHO) "$(RM) $(DESTDIR)$(ENGINESDIR)/$$fn"; \ 736 $(RM) "$(DESTDIR)$(ENGINESDIR)/$$fn"; \ 737 done 738 -$(RMDIR) "$(DESTDIR)$(ENGINESDIR)" 739 740install_runtime: install_programs 741 742install_runtime_libs: build_libs 743 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 744 @ : {- output_off() if windowsdll(); "" -} 745 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)" 746 @ : {- output_on() if windowsdll(); output_off() unless windowsdll(); "" -} 747 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/bin" 748 @ : {- output_on() unless windowsdll(); "" -} 749 @$(ECHO) "*** Installing runtime libraries" 750 @set -e; for s in dummy $(INSTALL_SHLIBS); do \ 751 if [ "$$s" = "dummy" ]; then continue; fi; \ 752 fn=`basename $$s`; \ 753 : {- output_off() unless windowsdll(); "" -}; \ 754 $(ECHO) "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 755 cp $$s "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 756 chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 757 mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \ 758 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 759 : {- output_on() unless windowsdll(); "" -}{- output_off() if windowsdll(); "" -}; \ 760 $(ECHO) "install $$s -> $(DESTDIR)$(libdir)/$$fn"; \ 761 cp $$s "$(DESTDIR)$(libdir)/$$fn.new"; \ 762 chmod 755 "$(DESTDIR)$(libdir)/$$fn.new"; \ 763 mv -f "$(DESTDIR)$(libdir)/$$fn.new" \ 764 "$(DESTDIR)$(libdir)/$$fn"; \ 765 : {- output_on() if windowsdll(); "" -}; \ 766 done 767 768install_programs: install_runtime_libs build_programs 769 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 770 @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(INSTALLTOP)/bin" 771 @$(ECHO) "*** Installing runtime programs" 772 @set -e; for x in dummy $(INSTALL_PROGRAMS); do \ 773 if [ "$$x" = "dummy" ]; then continue; fi; \ 774 fn=`basename $$x`; \ 775 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 776 cp $$x "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 777 chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 778 mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \ 779 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 780 done 781 @set -e; for x in dummy $(BIN_SCRIPTS); do \ 782 if [ "$$x" = "dummy" ]; then continue; fi; \ 783 fn=`basename $$x`; \ 784 $(ECHO) "install $$x -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 785 cp $$x "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 786 chmod 755 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new"; \ 787 mv -f "$(DESTDIR)$(INSTALLTOP)/bin/$$fn.new" \ 788 "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 789 done 790 791uninstall_runtime: uninstall_programs uninstall_runtime_libs 792 793uninstall_programs: 794 @$(ECHO) "*** Uninstalling runtime programs" 795 @set -e; for x in dummy $(INSTALL_PROGRAMS); \ 796 do \ 797 if [ "$$x" = "dummy" ]; then continue; fi; \ 798 fn=`basename $$x`; \ 799 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 800 $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 801 done; 802 @set -e; for x in dummy $(BIN_SCRIPTS); \ 803 do \ 804 if [ "$$x" = "dummy" ]; then continue; fi; \ 805 fn=`basename $$x`; \ 806 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 807 $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 808 done 809 -$(RMDIR) "$(DESTDIR)$(INSTALLTOP)/bin" 810 811uninstall_runtime_libs: 812 @$(ECHO) "*** Uninstalling runtime libraries" 813 @ : {- output_off() unless windowsdll(); "" -} 814 @set -e; for s in dummy $(INSTALL_SHLIBS); do \ 815 if [ "$$s" = "dummy" ]; then continue; fi; \ 816 fn=`basename $$s`; \ 817 $(ECHO) "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 818 $(RM) "$(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \ 819 done 820 @ : {- output_on() unless windowsdll(); "" -} 821 822 823install_man_docs: 824 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 825 @$(ECHO) "*** Installing manpages" 826 $(PERL) $(SRCDIR)/util/process_docs.pl \ 827 "--destdir=$(DESTDIR)$(MANDIR)" --type=man --suffix=$(MANSUFFIX) 828 829uninstall_man_docs: 830 @$(ECHO) "*** Uninstalling manpages" 831 $(PERL) $(SRCDIR)/util/process_docs.pl \ 832 "--destdir=$(DESTDIR)$(MANDIR)" --type=man --suffix=$(MANSUFFIX) \ 833 --remove 834 835install_html_docs: 836 @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 837 @$(ECHO) "*** Installing HTML manpages" 838 $(PERL) $(SRCDIR)/util/process_docs.pl \ 839 "--destdir=$(DESTDIR)$(HTMLDIR)" --type=html 840 841uninstall_html_docs: 842 @$(ECHO) "*** Uninstalling manpages" 843 $(PERL) $(SRCDIR)/util/process_docs.pl \ 844 "--destdir=$(DESTDIR)$(HTMLDIR)" --type=html --remove 845 846 847# Developer targets (note: these are only available on Unix) ######### 848 849update: generate errors ordinals 850 851generate: generate_apps generate_crypto_bn generate_crypto_objects \ 852 generate_crypto_conf generate_crypto_asn1 generate_fuzz_oids 853 854.PHONY: doc-nits 855doc-nits: 856 (cd $(SRCDIR); $(PERL) util/find-doc-nits -n -p ) >doc-nits 857 @if [ -s doc-nits ] ; then cat doc-nits ; exit 1; \ 858 else echo 'doc-nits: no errors.'; rm doc-nits ; fi 859 860# Test coverage is a good idea for the future 861#coverage: $(PROGRAMS) $(TESTPROGRAMS) 862# ... 863 864lint: 865 lint -DLINT $(INCLUDES) $(SRCS) 866 867generate_apps: 868 ( cd $(SRCDIR); $(PERL) VMS/VMSify-conf.pl \ 869 < apps/openssl.cnf > apps/openssl-vms.cnf ) 870 871generate_crypto_bn: 872 ( cd $(SRCDIR); $(PERL) crypto/bn/bn_prime.pl > crypto/bn/bn_prime.h ) 873 874generate_crypto_objects: 875 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl -n \ 876 crypto/objects/objects.txt \ 877 crypto/objects/obj_mac.num \ 878 > crypto/objects/obj_mac.new && \ 879 mv crypto/objects/obj_mac.new crypto/objects/obj_mac.num ) 880 ( cd $(SRCDIR); $(PERL) crypto/objects/objects.pl \ 881 crypto/objects/objects.txt \ 882 crypto/objects/obj_mac.num \ 883 > include/openssl/obj_mac.h ) 884 ( cd $(SRCDIR); $(PERL) crypto/objects/obj_dat.pl \ 885 include/openssl/obj_mac.h \ 886 > crypto/objects/obj_dat.h ) 887 ( cd $(SRCDIR); $(PERL) crypto/objects/objxref.pl \ 888 crypto/objects/obj_mac.num \ 889 crypto/objects/obj_xref.txt \ 890 > crypto/objects/obj_xref.h ) 891 892generate_crypto_conf: 893 ( cd $(SRCDIR); $(PERL) crypto/conf/keysets.pl \ 894 > crypto/conf/conf_def.h ) 895 896generate_crypto_asn1: 897 ( cd $(SRCDIR); $(PERL) crypto/asn1/charmap.pl \ 898 > crypto/asn1/charmap.h ) 899 900generate_fuzz_oids: 901 ( cd $(SRCDIR); $(PERL) fuzz/mkfuzzoids.pl \ 902 crypto/objects/obj_dat.h \ 903 > fuzz/oids.txt ) 904 905# Set to -force to force a rebuild 906ERROR_REBUILD= 907errors: 908 ( b=`pwd`; set -e; cd $(SRCDIR); \ 909 $(PERL) util/ck_errf.pl -strict -internal; \ 910 $(PERL) -I$$b util/mkerr.pl $(ERROR_REBUILD) -internal ) 911 ( b=`pwd`; set -e; cd $(SRCDIR)/engines; \ 912 for E in *.ec ; do \ 913 $(PERL) ../util/ck_errf.pl -strict \ 914 -conf $$E `basename $$E .ec`.c; \ 915 $(PERL) -I$$b ../util/mkerr.pl $(ERROR_REBUILD) -static \ 916 -conf $$E `basename $$E .ec`.c ; \ 917 done ) 918 919ordinals: 920 $(PERL) $(SRCDIR)/util/mkdef.pl crypto update 921 $(PERL) $(SRCDIR)/util/mkdef.pl ssl update 922 923test_ordinals: 924 ( cd test; \ 925 SRCTOP=../$(SRCDIR) \ 926 BLDTOP=../$(BLDDIR) \ 927 $(PERL) ../$(SRCDIR)/test/run_tests.pl test_ordinals ) 928 929tags TAGS: FORCE 930 rm -f TAGS tags 931 -ctags -R . 932 -etags `find . -name '*.[ch]' -o -name '*.pm'` 933 934# Release targets (note: only available on Unix) ##################### 935 936tar: 937 (cd $(SRCDIR); ./util/mktar.sh --name='$(NAME)' --tarfile='$(TARFILE)') 938 939# Helper targets ##################################################### 940 941link-utils: $(BLDDIR)/util/opensslwrap.sh 942 943$(BLDDIR)/util/opensslwrap.sh: configdata.pm 944 @if [ "$(SRCDIR)" != "$(BLDDIR)" ]; then \ 945 mkdir -p "$(BLDDIR)/util"; \ 946 ln -sf "../$(SRCDIR)/util/opensslwrap.sh" "$(BLDDIR)/util"; \ 947 fi 948 949FORCE: 950 951# Building targets ################################################### 952 953libcrypto.pc libssl.pc openssl.pc: configdata.pm $(LIBS) {- join(" ",map { shlib_simple($_) } @{$unified_info{libraries}}) -} 954libcrypto.pc: 955 @ ( echo 'prefix=$(INSTALLTOP)'; \ 956 echo 'exec_prefix=$${prefix}'; \ 957 if [ -n "$(LIBDIR)" ]; then \ 958 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ 959 else \ 960 echo 'libdir=$(libdir)'; \ 961 fi; \ 962 echo 'includedir=$${prefix}/include'; \ 963 echo 'enginesdir=$${libdir}/engines-{- $sover_dirname -}'; \ 964 echo ''; \ 965 echo 'Name: OpenSSL-libcrypto'; \ 966 echo 'Description: OpenSSL cryptography library'; \ 967 echo 'Version: '$(VERSION); \ 968 echo 'Libs: -L$${libdir} -lcrypto'; \ 969 echo 'Libs.private: $(LIB_EX_LIBS)'; \ 970 echo 'Cflags: -I$${includedir}' ) > libcrypto.pc 971 972libssl.pc: 973 @ ( echo 'prefix=$(INSTALLTOP)'; \ 974 echo 'exec_prefix=$${prefix}'; \ 975 if [ -n "$(LIBDIR)" ]; then \ 976 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ 977 else \ 978 echo 'libdir=$(libdir)'; \ 979 fi; \ 980 echo 'includedir=$${prefix}/include'; \ 981 echo ''; \ 982 echo 'Name: OpenSSL-libssl'; \ 983 echo 'Description: Secure Sockets Layer and cryptography libraries'; \ 984 echo 'Version: '$(VERSION); \ 985 echo 'Requires.private: libcrypto'; \ 986 echo 'Libs: -L$${libdir} -lssl'; \ 987 echo 'Cflags: -I$${includedir}' ) > libssl.pc 988 989openssl.pc: 990 @ ( echo 'prefix=$(INSTALLTOP)'; \ 991 echo 'exec_prefix=$${prefix}'; \ 992 if [ -n "$(LIBDIR)" ]; then \ 993 echo 'libdir=$${exec_prefix}/$(LIBDIR)'; \ 994 else \ 995 echo 'libdir=$(libdir)'; \ 996 fi; \ 997 echo 'includedir=$${prefix}/include'; \ 998 echo ''; \ 999 echo 'Name: OpenSSL'; \ 1000 echo 'Description: Secure Sockets Layer and cryptography libraries and tools'; \ 1001 echo 'Version: '$(VERSION); \ 1002 echo 'Requires: libssl libcrypto' ) > openssl.pc 1003 1004configdata.pm: $(SRCDIR)/Configure $(SRCDIR)/config {- join(" ", @{$config{build_file_templates}}, @{$config{build_infos}}, @{$config{conf_files}}) -} 1005 @echo "Detected changed: $?" 1006 $(PERL) configdata.pm -r 1007 @echo "**************************************************" 1008 @echo "*** ***" 1009 @echo "*** Please run the same make command again ***" 1010 @echo "*** ***" 1011 @echo "**************************************************" 1012 @false 1013 1014reconfigure reconf: 1015 $(PERL) configdata.pm -r 1016 1017{- 1018 use File::Basename; 1019 use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs/; 1020 1021 # Helper function to figure out dependencies on libraries 1022 # It takes a list of library names and outputs a list of dependencies 1023 sub compute_lib_depends { 1024 if ($disabled{shared}) { 1025 return map { lib($_) } @_; 1026 } 1027 1028 # Depending on shared libraries: 1029 # On Windows POSIX layers, we depend on {libname}.dll.a 1030 # On Unix platforms, we depend on {shlibname}.so 1031 return map { $_ =~ /\.a$/ ? $`.$libext : shlib_simple($_) } @_; 1032 } 1033 1034 sub generatesrc { 1035 my %args = @_; 1036 my $generator = join(" ", @{$args{generator}}); 1037 my $generator_incs = join("", map { " -I".$_ } @{$args{generator_incs}}); 1038 my $incs = join("", map { " -I".$_ } @{$args{incs}}); 1039 my $deps = join(" ", @{$args{generator_deps}}, @{$args{deps}}); 1040 1041 if ($args{src} !~ /\.[sS]$/) { 1042 if ($args{generator}->[0] =~ m|^.*\.in$|) { 1043 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, 1044 "util", "dofile.pl")), 1045 rel2abs($config{builddir})); 1046 return <<"EOF"; 1047$args{src}: $args{generator}->[0] $deps 1048 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ 1049 "-o$target{build_file}" $generator > \$@ 1050EOF 1051 } else { 1052 return <<"EOF"; 1053$args{src}: $args{generator}->[0] $deps 1054 \$(PERL)$generator_incs $generator > \$@ 1055EOF 1056 } 1057 } else { 1058 if ($args{generator}->[0] =~ /\.pl$/) { 1059 $generator = 'CC="$(CC)" $(PERL)'.$generator_incs.' '.$generator; 1060 } elsif ($args{generator}->[0] =~ /\.m4$/) { 1061 $generator = 'm4 -B 8192'.$generator_incs.' '.$generator.' >' 1062 } elsif ($args{generator}->[0] =~ /\.S$/) { 1063 $generator = undef; 1064 } else { 1065 die "Generator type for $args{src} unknown: $generator\n"; 1066 } 1067 1068 my $cppflags = { 1069 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 1070 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', 1071 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' 1072 } -> {$args{intent}}; 1073 if (defined($generator)) { 1074 return <<"EOF"; 1075$args{src}: $args{generator}->[0] $deps 1076 $generator \$@ 1077EOF 1078 } 1079 return <<"EOF"; 1080$args{src}: $args{generator}->[0] $deps 1081 \$(CC) $incs $cppflags -E $args{generator}->[0] | \\ 1082 \$(PERL) -ne '/^#(line)?\\s*[0-9]+/ or print' > \$@ 1083EOF 1084 } 1085 } 1086 1087 # Should one wonder about the end of the Perl snippet, it's because this 1088 # second regexp eats up line endings as well, if the removed path is the 1089 # last in the line. We may therefore need to put back a line ending. 1090 sub src2obj { 1091 my %args = @_; 1092 (my $obj = $args{obj}) =~ s|\.o$||; 1093 my @srcs = @{$args{srcs}}; 1094 my $srcs = join(" ", @srcs); 1095 my $deps = join(" ", @srcs, @{$args{deps}}); 1096 my $incs = join("", map { " -I".$_ } @{$args{incs}}); 1097 my $cmd; 1098 my $cmdflags; 1099 my $cmdcompile; 1100 if (grep /\.rc$/, @srcs) { 1101 $cmd = '$(RC)'; 1102 $cmdflags = '$(RCFLAGS)'; 1103 $cmdcompile = ''; 1104 } elsif (grep /\.(cc|cpp)$/, @srcs) { 1105 $cmd = '$(CXX)'; 1106 $cmdcompile = ' -c'; 1107 $cmdflags = { 1108 lib => '$(LIB_CXXFLAGS) $(LIB_CPPFLAGS)', 1109 dso => '$(DSO_CXXFLAGS) $(DSO_CPPFLAGS)', 1110 bin => '$(BIN_CXXFLAGS) $(BIN_CPPFLAGS)' 1111 } -> {$args{intent}}; 1112 } else { 1113 $cmd = '$(CC)'; 1114 $cmdcompile = ' -c'; 1115 $cmdflags = { 1116 lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 1117 dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', 1118 bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' 1119 } -> {$args{intent}}; 1120 } 1121 my $recipe; 1122 # extension-specific rules 1123 if (grep /\.s$/, @srcs) { 1124 $recipe .= <<"EOF"; 1125$obj$objext: $deps 1126 $cmd $cmdflags -c -o \$\@ $srcs 1127EOF 1128 } elsif (grep /\.S$/, @srcs) { 1129 # Originally there was mutli-step rule with $(CC) -E file.S 1130 # followed by $(CC) -c file.s. It compensated for one of 1131 # legacy platform compiler's inability to handle .S files. 1132 # The platform is long discontinued by vendor so there is 1133 # hardly a point to drag it along... 1134 $recipe .= <<"EOF"; 1135$obj$objext: $deps 1136 $cmd $incs $cmdflags -c -o \$\@ $srcs 1137EOF 1138 } elsif (defined $makedepprog && $makedepprog !~ /\/makedepend/ 1139 && !grep /\.rc$/, @srcs) { 1140 $recipe .= <<"EOF"; 1141$obj$objext: $deps 1142 $cmd $incs $cmdflags -MMD -MF $obj$depext.tmp -MT \$\@ -c -o \$\@ $srcs 1143 \@touch $obj$depext.tmp 1144 \@if cmp $obj$depext.tmp $obj$depext > /dev/null 2> /dev/null; then \\ 1145 rm -f $obj$depext.tmp; \\ 1146 else \\ 1147 mv $obj$depext.tmp $obj$depext; \\ 1148 fi 1149EOF 1150 } else { 1151 $recipe .= <<"EOF"; 1152$obj$objext: $deps 1153 $cmd $incs $cmdflags $cmdcompile -o \$\@ $srcs 1154EOF 1155 if (defined $makedepprog && $makedepprog =~ /\/makedepend/) { 1156 $recipe .= <<"EOF"; 1157 \$(MAKEDEPEND) -f- -Y -- $incs $cmdflags -- $srcs 2>/dev/null \\ 1158 > $obj$depext 1159EOF 1160 } 1161 } 1162 return $recipe; 1163 } 1164 # We *know* this routine is only called when we've configure 'shared'. 1165 sub libobj2shlib { 1166 my %args = @_; 1167 my $lib = $args{lib}; 1168 my $shlib = $args{shlib}; 1169 my $libd = dirname($lib); 1170 my $libn = basename($lib); 1171 (my $libname = $libn) =~ s/^lib//; 1172 my @linkdirs = (); 1173 foreach (@{args{deps}}) { 1174 my $d = dirname($_); 1175 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; 1176 } 1177 my $linkflags = join("", map { "-L$_ " } @linkdirs); 1178 my $linklibs = join("", map { my $f = basename($_); 1179 (my $l = $f) =~ s/^lib//; 1180 " -l$l" } @{$args{deps}}); 1181 my @objs = map { (my $x = $_) =~ s|\.o$||; "$x$objext" } 1182 grep { $_ !~ m/\.(?:def|map)$/ } 1183 @{$args{objs}}; 1184 my @defs = grep { $_ =~ /\.(?:def|map)$/ } @{$args{objs}}; 1185 my @deps = compute_lib_depends(@{$args{deps}}); 1186 die "More than one exported symbol map" if scalar @defs > 1; 1187 my $objs = join(" ", @objs); 1188 my $deps = join(" ", @objs, @defs, @deps); 1189 my $simple = shlib_simple($lib); 1190 my $full = shlib($lib); 1191 my $target = "$simple $full"; 1192 my $shared_soname = ""; 1193 $shared_soname .= ' '.$target{shared_sonameflag}.basename($full) 1194 if defined $target{shared_sonameflag}; 1195 my $shared_imp = ""; 1196 $shared_imp .= ' '.$target{shared_impflag}.basename($simple) 1197 if defined $target{shared_impflag}; 1198 my $shared_def = join("", map { ' '.$target{shared_defflag}.$_ } @defs); 1199 my $recipe = <<"EOF"; 1200$target: $deps 1201 \$(CC) \$(LIB_CFLAGS) $linkflags\$(LIB_LDFLAGS)$shared_soname$shared_imp \\ 1202 -o $full$shared_def $objs \\ 1203 $linklibs \$(LIB_EX_LIBS) 1204EOF 1205 if (windowsdll()) { 1206 $recipe .= <<"EOF"; 1207 rm -f apps/$shlib'\$(SHLIB_EXT)' 1208 rm -f test/$shlib'\$(SHLIB_EXT)' 1209 rm -f fuzz/$shlib'\$(SHLIB_EXT)' 1210 cp -p $shlib'\$(SHLIB_EXT)' apps/ 1211 cp -p $shlib'\$(SHLIB_EXT)' test/ 1212 cp -p $shlib'\$(SHLIB_EXT)' fuzz/ 1213EOF 1214 } elsif (sharedaix()) { 1215 $recipe .= <<"EOF"; 1216 rm -f $simple && \\ 1217 \$(AR) r $simple $full 1218EOF 1219 } else { 1220 $recipe .= <<"EOF"; 1221 if [ '$simple' != '$full' ]; then \\ 1222 rm -f $simple; \\ 1223 ln -s $full $simple; \\ 1224 fi 1225EOF 1226 } 1227 } 1228 sub obj2dso { 1229 my %args = @_; 1230 my $dso = $args{lib}; 1231 my $dsod = dirname($dso); 1232 my $dson = basename($dso); 1233 my @linkdirs = (); 1234 foreach (@{args{deps}}) { 1235 my $d = dirname($_); 1236 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; 1237 } 1238 my $linkflags = join("", map { "-L$_ " } @linkdirs); 1239 my $linklibs = join("", map { my $f = basename($_); 1240 (my $l = $f) =~ s/^lib//; 1241 " -l$l" } @{$args{deps}}); 1242 my @objs = map { (my $x = $_) =~ s|\.o$||; "$x$objext" } 1243 grep { $_ !~ m/\.(?:def|map)$/ } 1244 @{$args{objs}}; 1245 my @deps = compute_lib_depends(@{$args{deps}}); 1246 my $objs = join(" ", @objs); 1247 my $deps = join(" ", @deps); 1248 my $target = dso($dso); 1249 return <<"EOF"; 1250$target: $objs $deps 1251 \$(CC) \$(DSO_CFLAGS) $linkflags\$(DSO_LDFLAGS) \\ 1252 -o $target $objs \\ 1253 $linklibs \$(DSO_EX_LIBS) 1254EOF 1255 } 1256 sub obj2lib { 1257 my %args = @_; 1258 (my $lib = $args{lib}) =~ s/\.a$//; 1259 my @objs = map { (my $x = $_) =~ s|\.o$|$objext|; $x } @{$args{objs}}; 1260 my $objs = join(" ", @objs); 1261 return <<"EOF"; 1262$lib$libext: $objs 1263 \$(AR) \$(ARFLAGS) \$\@ \$\? 1264 \$(RANLIB) \$\@ || echo Never mind. 1265EOF 1266 } 1267 sub obj2bin { 1268 my %args = @_; 1269 my $bin = $args{bin}; 1270 my $bind = dirname($bin); 1271 my $binn = basename($bin); 1272 my $objs = join(" ", map { (my $x = $_) =~ s|\.o$||; "$x$objext" } 1273 @{$args{objs}}); 1274 my $deps = join(" ",compute_lib_depends(@{$args{deps}})); 1275 my @linkdirs = (); 1276 foreach (@{args{deps}}) { 1277 next if $_ =~ /\.a$/; 1278 my $d = dirname($_); 1279 push @linkdirs, $d unless grep { $d eq $_ } @linkdirs; 1280 } 1281 my $linkflags = join("", map { "-L$_ " } @linkdirs); 1282 my $linklibs = join("", map { if ($_ =~ s/\.a$//) { 1283 " $_$libext"; 1284 } else { 1285 my $f = basename($_); 1286 (my $l = $f) =~ s/^lib//; 1287 " -l$l" 1288 } 1289 } @{$args{deps}}); 1290 my $cmd = '$(CC)'; 1291 my $cmdflags = '$(BIN_CFLAGS)'; 1292 if (grep /_cc\.o$/, @{$args{objs}}) { 1293 $cmd = '$(CXX)'; 1294 $cmdflags = '$(BIN_CXXFLAGS)'; 1295 } 1296 return <<"EOF"; 1297$bin$exeext: $objs $deps 1298 rm -f $bin$exeext 1299 \$\${LDCMD:-$cmd} $cmdflags $linkflags\$(BIN_LDFLAGS) \\ 1300 -o $bin$exeext $objs \\ 1301 $linklibs \$(BIN_EX_LIBS) 1302EOF 1303 } 1304 sub in2script { 1305 my %args = @_; 1306 my $script = $args{script}; 1307 my $sources = join(" ", @{$args{sources}}); 1308 my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, 1309 "util", "dofile.pl")), 1310 rel2abs($config{builddir})); 1311 return <<"EOF"; 1312$script: $sources 1313 \$(PERL) "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ 1314 "-o$target{build_file}" $sources > "$script" 1315 chmod a+x $script 1316EOF 1317 } 1318 sub generatedir { 1319 my %args = @_; 1320 my $dir = $args{dir}; 1321 my @deps = map { s|\.o$|$objext|; $_ } @{$args{deps}}; 1322 my @actions = (); 1323 my %extinfo = ( dso => $dsoext, 1324 lib => $libext, 1325 bin => $exeext ); 1326 1327 # We already have a 'test' target, and the top directory is just plain 1328 # silly 1329 return if $dir eq "test" || $dir eq "."; 1330 1331 foreach my $type (("dso", "lib", "bin", "script")) { 1332 next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); 1333 # For lib object files, we could update the library. However, it 1334 # was decided that it's enough to build the directory local object 1335 # files, so we don't need to add any actions, and the dependencies 1336 # are already taken care of. 1337 if ($type ne "lib") { 1338 foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { 1339 if (dirname($prod) eq $dir) { 1340 push @deps, $prod.$extinfo{$type}; 1341 } else { 1342 push @actions, "\t@ : No support to produce $type ".join(", ", @{$unified_info{dirinfo}->{$dir}->{products}->{$type}}); 1343 } 1344 } 1345 } 1346 } 1347 1348 my $deps = join(" ", @deps); 1349 my $actions = join("\n", "", @actions); 1350 return <<"EOF"; 1351$dir $dir/: $deps$actions 1352EOF 1353 } 1354 "" # Important! This becomes part of the template result. 1355-} 1356