1 1.1 christos ## 2 1.1 christos ## Makefile for OpenSSL 3 1.1 christos ## 4 1.1 christos ## {- join("\n## ", @autowarntext) -} 5 1.1 christos {- 6 1.1.1.9 christos use File::Basename; 7 1.1.1.9 christos use OpenSSL::Util; 8 1.1 christos 9 1.1.1.9 christos our $sover_dirname = platform->shlib_version_as_filename(); 10 1.1 christos 11 1.1.1.4 christos my $build_scheme = $target{build_scheme}; 12 1.1.1.4 christos my $install_flavour = $build_scheme->[$#$build_scheme]; # last element 13 1.1 christos my $win_installenv = 14 1.1.1.4 christos $install_flavour eq "VC-WOW" ? "ProgramFiles(x86)" 15 1.1.1.4 christos : "ProgramW6432"; 16 1.1 christos my $win_commonenv = 17 1.1.1.4 christos $install_flavour eq "VC-WOW" ? "CommonProgramFiles(x86)" 18 1.1.1.4 christos : "CommonProgramW6432"; 19 1.1 christos our $win_installroot = 20 1.1.1.4 christos defined($ENV{$win_installenv}) ? $win_installenv : 'ProgramFiles'; 21 1.1 christos our $win_commonroot = 22 1.1.1.4 christos defined($ENV{$win_commonenv}) ? $win_commonenv : 'CommonProgramFiles'; 23 1.1 christos 24 1.1 christos # expand variables early 25 1.1 christos $win_installroot = $ENV{$win_installroot}; 26 1.1 christos $win_commonroot = $ENV{$win_commonroot}; 27 1.1 christos 28 1.1 christos # This makes sure things get built in the order they need 29 1.1 christos # to. You're welcome. 30 1.1 christos sub dependmagic { 31 1.1 christos my $target = shift; 32 1.1 christos 33 1.1.1.9 christos return "$target: build_generated\n\t\$(MAKE) /\$(MAKEFLAGS) depend\n\t\$(MAKE) /\$(MAKEFLAGS) _$target\n_$target"; 34 1.1 christos } 35 1.1 christos ''; 36 1.1 christos -} 37 1.1 christos 38 1.1 christos PLATFORM={- $config{target} -} 39 1.1 christos SRCDIR={- $config{sourcedir} -} 40 1.1 christos BLDDIR={- $config{builddir} -} 41 1.1.1.9 christos FIPSKEY={- $config{FIPSKEY} -} 42 1.1 christos 43 1.1.1.9 christos VERSION={- "$config{full_version}" -} 44 1.1.1.9 christos VERSION_NUMBER={- "$config{version}" -} 45 1.1 christos MAJOR={- $config{major} -} 46 1.1 christos MINOR={- $config{minor} -} 47 1.1 christos 48 1.1.1.9 christos SHLIB_VERSION_NUMBER={- $config{shlib_version} -} 49 1.1 christos 50 1.1.1.9 christos LIBS={- join(" ", map { ( platform->sharedlib_import($_), platform->staticlib($_) ) } @{$unified_info{libraries}}) -} 51 1.1.1.9 christos SHLIBS={- join(" ", map { platform->sharedlib($_) // () } @{$unified_info{libraries}}) -} 52 1.1.1.9 christos SHLIBPDBS={- join(" ", map { platform->sharedlibpdb($_) // () } @{$unified_info{libraries}}) -} 53 1.1.1.9 christos MODULES={- our @MODULES = map { platform->dso($_) } 54 1.1.1.9 christos # Drop all modules that are dependencies, they will 55 1.1.1.9 christos # be processed through their dependents 56 1.1.1.9 christos grep { my $x = $_; 57 1.1.1.9 christos !grep { grep { $_ eq $x } @$_ } 58 1.1.1.9 christos values %{$unified_info{depends}} } 59 1.1.1.9 christos @{$unified_info{modules}}; 60 1.1.1.9 christos join(" ", @MODULES) -} 61 1.1.1.9 christos MODULEPDBS={- join(" ", map { platform->dsopdb($_) } @{$unified_info{modules}}) -} 62 1.1.1.9 christos FIPSMODULE={- # We do some extra checking here, as there should be only one 63 1.1.1.9 christos use File::Basename; 64 1.1.1.9 christos our @fipsmodules = 65 1.1.1.9 christos grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} 66 1.1.1.9 christos && $unified_info{attributes}->{modules}->{$_}->{fips} } 67 1.1.1.9 christos @{$unified_info{modules}}; 68 1.1.1.9 christos die "More that one FIPS module" if scalar @fipsmodules > 1; 69 1.1.1.9 christos join(" ", map { platform->dso($_) } @fipsmodules) -} 70 1.1.1.9 christos FIPSMODULENAME={- die "More that one FIPS module" if scalar @fipsmodules > 1; 71 1.1.1.9 christos join(", ", map { basename(platform->dso($_)) } @fipsmodules) -} 72 1.1.1.9 christos PROGRAMS={- our @PROGRAMS = map { platform->bin($_) } @{$unified_info{programs}}; join(" ", @PROGRAMS) -} 73 1.1 christos PROGRAMPDBS={- join(" ", map { $_.".pdb" } @{$unified_info{programs}}) -} 74 1.1.1.9 christos SCRIPTS={- our @SCRIPTS = @{$unified_info{scripts}}; join(" ", @SCRIPTS) -} 75 1.1 christos {- output_off() if $disabled{makedepend}; "" -} 76 1.1.1.9 christos DEPS={- join(" ", map { platform->isobj($_) ? platform->dep($_) : () } 77 1.1 christos grep { $unified_info{sources}->{$_}->[0] =~ /\.c$/ } 78 1.1 christos keys %{$unified_info{sources}}); -} 79 1.1 christos {- output_on() if $disabled{makedepend}; "" -} 80 1.1.1.9 christos GENERATED_MANDATORY={- our @GENERATED_MANDATORY = @{$unified_info{depends}->{""}}; 81 1.1.1.9 christos join(" ", @GENERATED_MANDATORY) -} 82 1.1.1.4 christos GENERATED={- # common0.tmpl provides @generated 83 1.1.1.9 christos our @GENERATED = map { platform->convertext($_) } @generated; 84 1.1.1.9 christos join(" ", @GENERATED) -} 85 1.1 christos 86 1.1.1.9 christos INSTALL_LIBS={- 87 1.1.1.9 christos join(" ", map { quotify1(platform->sharedlib_import($_) 88 1.1.1.9 christos // platform->staticlib($_)) } 89 1.1.1.9 christos grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } 90 1.1.1.9 christos @{$unified_info{libraries}}) 91 1.1.1.9 christos -} 92 1.1.1.9 christos INSTALL_SHLIBS={- 93 1.1.1.9 christos join(" ", map { my $x = platform->sharedlib($_); 94 1.1.1.9 christos $x ? quotify_l($x) : () } 95 1.1.1.9 christos grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } 96 1.1.1.9 christos @{$unified_info{libraries}}) 97 1.1.1.9 christos -} 98 1.1.1.9 christos INSTALL_SHLIBPDBS={- 99 1.1.1.9 christos join(" ", map { my $x = platform->sharedlibpdb($_); 100 1.1.1.9 christos $x ? quotify_l($x) : () } 101 1.1.1.9 christos grep { !$unified_info{attributes}->{libraries}->{$_}->{noinst} } 102 1.1.1.9 christos @{$unified_info{libraries}}) 103 1.1.1.9 christos -} 104 1.1.1.9 christos INSTALL_ENGINES={- 105 1.1.1.9 christos join(" ", map { quotify1(platform->dso($_)) } 106 1.1.1.9 christos grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} 107 1.1.1.9 christos && $unified_info{attributes}->{modules}->{$_}->{engine} } 108 1.1.1.9 christos @{$unified_info{modules}}) 109 1.1.1.9 christos -} 110 1.1.1.9 christos INSTALL_ENGINEPDBS={- 111 1.1.1.9 christos join(" ", map { quotify1(platform->dsopdb($_)) } 112 1.1.1.9 christos grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} 113 1.1.1.9 christos && $unified_info{attributes}->{modules}->{$_}->{engine} } 114 1.1.1.9 christos @{$unified_info{modules}}) 115 1.1.1.9 christos -} 116 1.1.1.9 christos INSTALL_MODULES={- 117 1.1.1.9 christos join(" ", map { quotify1(platform->dso($_)) } 118 1.1.1.9 christos grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} 119 1.1.1.9 christos && !$unified_info{attributes}->{modules}->{$_}->{engine} 120 1.1.1.9 christos && !$unified_info{attributes}->{modules}->{$_}->{fips} } 121 1.1.1.9 christos @{$unified_info{modules}}) 122 1.1.1.9 christos -} 123 1.1.1.9 christos INSTALL_MODULEPDBS={- 124 1.1.1.9 christos join(" ", map { quotify1(platform->dsopdb($_)) } 125 1.1.1.9 christos grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} 126 1.1.1.9 christos && !$unified_info{attributes}->{modules}->{$_}->{engine} } 127 1.1.1.9 christos @{$unified_info{modules}}) 128 1.1.1.9 christos -} 129 1.1.1.9 christos INSTALL_FIPSMODULE={- 130 1.1.1.9 christos join(" ", map { quotify1(platform->dso($_)) } 131 1.1.1.9 christos grep { !$unified_info{attributes}->{modules}->{$_}->{noinst} 132 1.1.1.9 christos && $unified_info{attributes}->{modules}->{$_}->{fips} } 133 1.1.1.9 christos @{$unified_info{modules}}) 134 1.1.1.9 christos -} 135 1.1.1.9 christos INSTALL_FIPSMODULECONF=providers\fipsmodule.cnf 136 1.1.1.9 christos INSTALL_PROGRAMS={- 137 1.1.1.9 christos join(" ", map { quotify1(platform->bin($_)) } 138 1.1.1.9 christos grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } 139 1.1.1.9 christos @{$unified_info{programs}}) 140 1.1.1.9 christos -} 141 1.1.1.9 christos INSTALL_PROGRAMPDBS={- 142 1.1.1.9 christos join(" ", map { quotify1(platform->binpdb($_)) } 143 1.1.1.9 christos grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} } 144 1.1.1.9 christos @{$unified_info{programs}}) 145 1.1.1.9 christos -} 146 1.1.1.9 christos BIN_SCRIPTS={- 147 1.1.1.9 christos join(" ", map { quotify1($_) } 148 1.1.1.9 christos grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} 149 1.1.1.9 christos && !$unified_info{attributes}->{scripts}->{$_}->{misc} } 150 1.1.1.9 christos @{$unified_info{scripts}}) 151 1.1.1.9 christos -} 152 1.1.1.9 christos MISC_SCRIPTS={- 153 1.1.1.9 christos join(" ", map { quotify1($_) } 154 1.1.1.9 christos grep { !$unified_info{attributes}->{scripts}->{$_}->{noinst} 155 1.1.1.9 christos && $unified_info{attributes}->{scripts}->{$_}->{misc} } 156 1.1.1.9 christos @{$unified_info{scripts}}) 157 1.1.1.9 christos -} 158 1.1.1.9 christos IMAGEDOCS1={- our @IMAGEDOCS1 = @{$unified_info{imagedocs}->{man1}}; 159 1.1.1.9 christos join(" ", @IMAGEDOCS1) -} 160 1.1.1.9 christos IMAGEDOCS3={- our @IMAGEDOCS3 = @{$unified_info{imagedocs}->{man3}}; 161 1.1.1.9 christos join(" ", @IMAGEDOCS3) -} 162 1.1.1.9 christos IMAGEDOCS5={- our @IMAGEDOCS5 = @{$unified_info{imagedocs}->{man5}}; 163 1.1.1.9 christos join(" ", @IMAGEDOCS5) -} 164 1.1.1.9 christos IMAGEDOCS7={- our @IMAGEDOCS7 = @{$unified_info{imagedocs}->{man7}}; 165 1.1.1.9 christos join(" ", @IMAGEDOCS7) -} 166 1.1.1.9 christos HTMLDOCS1={- our @HTMLDOCS1 = @{$unified_info{htmldocs}->{man1}}; 167 1.1.1.9 christos join(" ", @HTMLDOCS1) -} 168 1.1.1.9 christos HTMLDOCS3={- our @HTMLDOCS3 = @{$unified_info{htmldocs}->{man3}}; 169 1.1.1.9 christos join(" ", @HTMLDOCS3) -} 170 1.1.1.9 christos HTMLDOCS5={- our @HTMLDOCS5 = @{$unified_info{htmldocs}->{man5}}; 171 1.1.1.9 christos join(" ", @HTMLDOCS5) -} 172 1.1.1.9 christos HTMLDOCS7={- our @HTMLDOCS7 = @{$unified_info{htmldocs}->{man7}}; 173 1.1.1.9 christos join(" ", @HTMLDOCS7) -} 174 1.1.1.9 christos HTMLDOCS1_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS1; 175 1.1.1.9 christos join(' ', sort keys %dirs) -} 176 1.1.1.9 christos HTMLDOCS3_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS3; 177 1.1.1.9 christos join(' ', sort keys %dirs) -} 178 1.1.1.9 christos HTMLDOCS5_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS5; 179 1.1.1.9 christos join(' ', sort keys %dirs) -} 180 1.1.1.9 christos HTMLDOCS7_BLDDIRS={- my %dirs = map { dirname($_) => 1 } @HTMLDOCS7; 181 1.1.1.9 christos join(' ', sort keys %dirs) -} 182 1.1 christos 183 1.1.1.9 christos APPS_OPENSSL="{- use File::Spec::Functions; 184 1.1.1.9 christos catfile("apps","openssl") -}" 185 1.1 christos 186 1.1 christos # Do not edit these manually. Use Configure with --prefix or --openssldir 187 1.1 christos # to change this! Short explanation in the top comment in Configure 188 1.1 christos INSTALLTOP_dev={- # $prefix is used in the OPENSSLDIR perl snippet 189 1.1 christos # 190 1.1 christos use File::Spec::Functions qw(:DEFAULT splitpath); 191 1.1 christos our $prefix = canonpath($config{prefix} 192 1.1 christos || "$win_installroot\\OpenSSL"); 193 1.1 christos our ($prefix_dev, $prefix_dir, $prefix_file) = 194 1.1 christos splitpath($prefix, 1); 195 1.1 christos $prefix_dev -} 196 1.1 christos INSTALLTOP_dir={- canonpath($prefix_dir) -} 197 1.1 christos OPENSSLDIR_dev={- # 198 1.1 christos # The logic here is that if no --openssldir was given, 199 1.1.1.4 christos # OPENSSLDIR will get the value "$win_commonroot\\SSL". 200 1.1 christos # If --openssldir was given and the value is an absolute 201 1.1 christos # path, OPENSSLDIR will get its value without change. 202 1.1 christos # If the value from --openssldir is a relative path, 203 1.1 christos # OPENSSLDIR will get $prefix with the --openssldir 204 1.1 christos # value appended as a subdirectory. 205 1.1 christos # 206 1.1 christos use File::Spec::Functions qw(:DEFAULT splitpath); 207 1.1 christos our $openssldir = 208 1.1 christos $config{openssldir} ? 209 1.1 christos (file_name_is_absolute($config{openssldir}) ? 210 1.1 christos canonpath($config{openssldir}) 211 1.1 christos : catdir($prefix, $config{openssldir})) 212 1.1 christos : canonpath("$win_commonroot\\SSL"); 213 1.1 christos our ($openssldir_dev, $openssldir_dir, $openssldir_file) = 214 1.1 christos splitpath($openssldir, 1); 215 1.1 christos $openssldir_dev -} 216 1.1 christos OPENSSLDIR_dir={- canonpath($openssldir_dir) -} 217 1.1 christos LIBDIR={- our $libdir = $config{libdir} || "lib"; 218 1.1.1.4 christos file_name_is_absolute($libdir) ? "" : $libdir -} 219 1.1.1.9 christos MODULESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath catpath); 220 1.1.1.9 christos our $modulesprefix = catdir($prefix,$libdir); 221 1.1.1.9 christos our ($modulesprefix_dev, $modulesprefix_dir, 222 1.1.1.9 christos $modulesprefix_file) = 223 1.1.1.9 christos splitpath($modulesprefix, 1); 224 1.1.1.9 christos our $modulesdir_dev = $modulesprefix_dev; 225 1.1.1.9 christos our $modulesdir_dir = 226 1.1.1.9 christos catdir($modulesprefix_dir, "ossl-modules"); 227 1.1.1.9 christos our $modulesdir = catpath($modulesdir_dev, $modulesdir_dir); 228 1.1.1.9 christos our $enginesdir_dev = $modulesprefix_dev; 229 1.1.1.9 christos our $enginesdir_dir = 230 1.1.1.9 christos catdir($modulesprefix_dir, "engines-$sover_dirname"); 231 1.1.1.9 christos our $enginesdir = catpath($enginesdir_dev, $enginesdir_dir); 232 1.1.1.9 christos $modulesdir_dev -} 233 1.1.1.9 christos MODULESDIR_dir={- canonpath($modulesdir_dir) -} 234 1.1.1.9 christos ENGINESDIR_dev={- $enginesdir_dev -} 235 1.1 christos ENGINESDIR_dir={- canonpath($enginesdir_dir) -} 236 1.1 christos !IF "$(DESTDIR)" != "" 237 1.1 christos INSTALLTOP=$(DESTDIR)$(INSTALLTOP_dir) 238 1.1 christos OPENSSLDIR=$(DESTDIR)$(OPENSSLDIR_dir) 239 1.1 christos ENGINESDIR=$(DESTDIR)$(ENGINESDIR_dir) 240 1.1.1.9 christos MODULESDIR=$(DESTDIR)$(MODULESDIR_dir) 241 1.1 christos !ELSE 242 1.1 christos INSTALLTOP=$(INSTALLTOP_dev)$(INSTALLTOP_dir) 243 1.1 christos OPENSSLDIR=$(OPENSSLDIR_dev)$(OPENSSLDIR_dir) 244 1.1 christos ENGINESDIR=$(ENGINESDIR_dev)$(ENGINESDIR_dir) 245 1.1.1.9 christos MODULESDIR=$(MODULESDIR_dev)$(MODULESDIR_dir) 246 1.1 christos !ENDIF 247 1.1 christos 248 1.1.1.4 christos # $(libdir) is chosen to be compatible with the GNU coding standards 249 1.1.1.4 christos libdir={- file_name_is_absolute($libdir) 250 1.1.1.4 christos ? $libdir : '$(INSTALLTOP)\$(LIBDIR)' -} 251 1.1.1.4 christos 252 1.1.1.4 christos ##### User defined commands and flags ################################ 253 1.1.1.4 christos 254 1.1.1.9 christos CC="{- $config{CC} -}" 255 1.1.1.4 christos CPP={- $config{CPP} -} 256 1.1.1.4 christos CPPFLAGS={- our $cppflags1 = join(" ", 257 1.1.1.4 christos (map { "-D".$_} @{$config{CPPDEFINES}}), 258 1.1.1.9 christos (map { " -I".$_} @{$config{CPPINCLUDES}}), 259 1.1.1.4 christos @{$config{CPPFLAGS}}) -} 260 1.1.1.4 christos CFLAGS={- join(' ', @{$config{CFLAGS}}) -} 261 1.1.1.9 christos LD="{- $config{LD} -}" 262 1.1.1.4 christos LDFLAGS={- join(' ', @{$config{LDFLAGS}}) -} 263 1.1.1.4 christos EX_LIBS={- join(' ', @{$config{LDLIBS}}) -} 264 1.1.1.4 christos 265 1.1.1.4 christos PERL={- $config{PERL} -} 266 1.1.1.4 christos 267 1.1.1.9 christos AR="{- $config{AR} -}" 268 1.1.1.4 christos ARFLAGS= {- join(' ', @{$config{ARFLAGS}}) -} 269 1.1 christos 270 1.1.1.9 christos MT="{- $config{MT} -}" 271 1.1.1.4 christos MTFLAGS= {- join(' ', @{$config{MTFLAGS}}) -} 272 1.1.1.4 christos 273 1.1.1.9 christos AS="{- $config{AS} -}" 274 1.1.1.4 christos ASFLAGS={- join(' ', @{$config{ASFLAGS}}) -} 275 1.1.1.4 christos 276 1.1.1.9 christos RC="{- $config{RC} -}" 277 1.1.1.6 christos RCFLAGS={- join(' ', @{$config{RCFLAGS}}) -} 278 1.1.1.3 christos 279 1.1.1.3 christos ECHO="$(PERL)" "$(SRCDIR)\util\echo.pl" 280 1.1.1.3 christos 281 1.1.1.4 christos ##### Special command flags ########################################## 282 1.1.1.4 christos 283 1.1.1.4 christos COUTFLAG={- $target{coutflag} -}$(OSSL_EMPTY) 284 1.1.1.4 christos LDOUTFLAG={- $target{ldoutflag} -}$(OSSL_EMPTY) 285 1.1.1.4 christos AROUTFLAG={- $target{aroutflag} -}$(OSSL_EMPTY) 286 1.1.1.4 christos MTINFLAG={- $target{mtinflag} -}$(OSSL_EMPTY) 287 1.1.1.4 christos MTOUTFLAG={- $target{mtoutflag} -}$(OSSL_EMPTY) 288 1.1.1.4 christos ASOUTFLAG={- $target{asoutflag} -}$(OSSL_EMPTY) 289 1.1.1.4 christos RCOUTFLAG={- $target{rcoutflag} -}$(OSSL_EMPTY) 290 1.1.1.4 christos 291 1.1.1.4 christos ##### Project flags ################################################## 292 1.1.1.4 christos 293 1.1.1.4 christos # Variables starting with CNF_ are common variables for all product types 294 1.1.1.4 christos 295 1.1.1.4 christos CNF_ASFLAGS={- join(' ', $target{asflags} || (), 296 1.1.1.4 christos @{$config{asflags}}) -} 297 1.1.1.11 christos CNF_CPPFLAGS={- our $cppflags2 = 298 1.1.1.4 christos join(' ', $target{cppflags} || (), 299 1.1.1.4 christos (map { '-D'.quotify1($_) } @{$target{defines}}, 300 1.1.1.4 christos @{$config{defines}}), 301 1.1.1.7 christos (map { '-I'.'"'.$_.'"' } @{$target{includes}}, 302 1.1.1.7 christos @{$config{includes}}), 303 1.1.1.4 christos @{$config{cppflags}}) -} 304 1.1.1.4 christos CNF_CFLAGS={- join(' ', $target{cflags} || (), 305 1.1.1.4 christos @{$config{cflags}}) -} 306 1.1.1.4 christos CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (), 307 1.1.1.4 christos @{$config{cxxflags}}) -} 308 1.1.1.4 christos CNF_LDFLAGS={- join(' ', $target{lflags} || (), 309 1.1.1.4 christos @{$config{lflags}}) -} 310 1.1.1.4 christos CNF_EX_LIBS={- join(' ', $target{ex_libs} || (), 311 1.1.1.4 christos @{$config{ex_libs}}) -} 312 1.1.1.4 christos 313 1.1.1.4 christos # Variables starting with LIB_ are used to build library object files 314 1.1.1.4 christos # and shared libraries. 315 1.1.1.4 christos # Variables starting with DSO_ are used to build DSOs and their object files. 316 1.1.1.4 christos # Variables starting with BIN_ are used to build programs and their object 317 1.1.1.4 christos # files. 318 1.1.1.4 christos 319 1.1.1.4 christos LIB_ASFLAGS={- join(' ', $target{lib_asflags} || (), 320 1.1.1.4 christos @{$config{lib_asflags}}, 321 1.1.1.4 christos '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} 322 1.1.1.4 christos LIB_CPPFLAGS={- our $lib_cppflags = 323 1.1.1.4 christos join(' ', $target{lib_cppflags} || (), 324 1.1.1.4 christos $target{shared_cppflag} || (), 325 1.1.1.4 christos (map { '-D'.quotify1($_) } 326 1.1.1.4 christos @{$target{lib_defines}}, 327 1.1.1.4 christos @{$target{shared_defines}}, 328 1.1.1.4 christos @{$config{lib_defines}}, 329 1.1.1.4 christos @{$config{shared_defines}}), 330 1.1.1.4 christos (map { '-I'.quotify1($_) } 331 1.1.1.4 christos @{$target{lib_includes}}, 332 1.1.1.4 christos @{$target{shared_includes}}, 333 1.1.1.4 christos @{$config{lib_includes}}, 334 1.1.1.4 christos @{$config{shared_includes}}), 335 1.1.1.4 christos @{$config{lib_cppflags}}, 336 1.1.1.4 christos @{$config{shared_cppflag}}); 337 1.1.1.4 christos join(' ', $lib_cppflags, 338 1.1.1.4 christos (map { '-D'.quotify1($_) } 339 1.1.1.4 christos "OPENSSLDIR=\"$openssldir\"", 340 1.1.1.9 christos "ENGINESDIR=\"$enginesdir\"", 341 1.1.1.9 christos "MODULESDIR=\"$modulesdir\""), 342 1.1.1.4 christos '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 343 1.1.1.4 christos LIB_CFLAGS={- join(' ', $target{lib_cflags} || (), 344 1.1.1.4 christos $target{shared_cflag} || (), 345 1.1.1.4 christos @{$config{lib_cflags}}, 346 1.1.1.4 christos @{$config{shared_cflag}}, 347 1.1.1.4 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 348 1.1.1.4 christos LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (), 349 1.1.1.4 christos $config{shared_ldflag} || (), 350 1.1.1.4 christos '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 351 1.1.1.4 christos LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 352 1.1.1.4 christos DSO_ASFLAGS={- join(' ', $target{dso_asflags} || (), 353 1.1.1.4 christos $target{module_asflags} || (), 354 1.1.1.4 christos @{$config{dso_asflags}}, 355 1.1.1.4 christos @{$config{module_asflags}}, 356 1.1.1.4 christos '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} 357 1.1.1.4 christos DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (), 358 1.1.1.9 christos $target{module_cppflag} || (), 359 1.1.1.9 christos (map { '-D'.quotify1($_) } 360 1.1.1.9 christos @{$target{dso_defines}}, 361 1.1.1.9 christos @{$target{module_defines}}, 362 1.1.1.9 christos @{$config{dso_defines}}, 363 1.1.1.9 christos @{$config{module_defines}}), 364 1.1.1.9 christos (map { '-I'.quotify1($_) } 365 1.1.1.9 christos @{$target{dso_includes}}, 366 1.1.1.9 christos @{$target{module_includes}}, 367 1.1.1.9 christos @{$config{dso_includes}}, 368 1.1.1.9 christos @{$config{module_includes}}), 369 1.1.1.4 christos @{$config{dso_cppflags}}, 370 1.1.1.4 christos @{$config{module_cppflags}}, 371 1.1.1.4 christos '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 372 1.1.1.4 christos DSO_CFLAGS={- join(' ', $target{dso_cflags} || (), 373 1.1.1.4 christos $target{module_cflags} || (), 374 1.1.1.4 christos @{$config{dso_cflags}}, 375 1.1.1.4 christos @{$config{module_cflags}}, 376 1.1.1.4 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 377 1.1.1.4 christos DSO_LDFLAGS={- join(' ', $target{dso_lflags} || (), 378 1.1.1.4 christos $target{module_ldflags} || (), 379 1.1.1.4 christos @{$config{dso_lflags}}, 380 1.1.1.4 christos @{$config{module_ldflags}}, 381 1.1.1.4 christos '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 382 1.1.1.4 christos DSO_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 383 1.1.1.4 christos BIN_ASFLAGS={- join(' ', $target{bin_asflags} || (), 384 1.1.1.4 christos @{$config{bin_asflags}}, 385 1.1.1.4 christos '$(CNF_ASFLAGS)', '$(ASFLAGS)') -} 386 1.1.1.4 christos BIN_CPPFLAGS={- join(' ', $target{bin_cppflags} || (), 387 1.1.1.9 christos (map { '-D'.$_ } @{$config{bin_defines} || ()}), 388 1.1.1.4 christos @{$config{bin_cppflags}}, 389 1.1.1.4 christos '$(CNF_CPPFLAGS)', '$(CPPFLAGS)') -} 390 1.1.1.4 christos BIN_CFLAGS={- join(' ', $target{bin_cflags} || (), 391 1.1.1.4 christos @{$config{bin_cflags}}, 392 1.1.1.4 christos '$(CNF_CFLAGS)', '$(CFLAGS)') -} 393 1.1.1.4 christos BIN_LDFLAGS={- join(' ', $target{bin_lflags} || (), 394 1.1.1.4 christos @{$config{bin_lflags}}, 395 1.1.1.4 christos '$(CNF_LDFLAGS)', '$(LDFLAGS)') -} 396 1.1.1.4 christos BIN_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS) 397 1.1.1.4 christos 398 1.1.1.4 christos # CPPFLAGS_Q is used for one thing only: to build up buildinf.h 399 1.1.1.4 christos CPPFLAGS_Q={- $cppflags1 =~ s|([\\"])|\\$1|g; 400 1.1.1.4 christos $cppflags2 =~ s|([\\"])|\\$1|g; 401 1.1.1.4 christos join(' ', $lib_cppflags || (), $cppflags2 || (), 402 1.1.1.4 christos $cppflags1 || ()) -} 403 1.1.1.4 christos 404 1.1 christos PERLASM_SCHEME= {- $target{perlasm_scheme} -} 405 1.1 christos 406 1.1 christos PROCESSOR= {- $config{processor} -} 407 1.1 christos 408 1.1 christos # The main targets ################################################### 409 1.1 christos 410 1.1.1.9 christos {- dependmagic('build_sw'); -}: build_libs_nodep build_modules_nodep build_programs_nodep copy-utils 411 1.1 christos {- dependmagic('build_libs'); -}: build_libs_nodep 412 1.1.1.9 christos {- dependmagic('build_modules'); -}: build_modules_nodep 413 1.1 christos {- dependmagic('build_programs'); -}: build_programs_nodep 414 1.1 christos 415 1.1.1.9 christos build_docs: build_html_docs 416 1.1.1.9 christos build_html_docs: $(HTMLDOCS1) $(HTMLDOCS3) $(HTMLDOCS5) $(HTMLDOCS7) 417 1.1.1.9 christos @ 418 1.1 christos build_generated: $(GENERATED_MANDATORY) 419 1.1.1.9 christos @ 420 1.1.1.9 christos build_libs_nodep: $(LIBS) {- join(" ",map { platform->sharedlib_import($_) // () } @{$unified_info{libraries}}) -} 421 1.1.1.9 christos @ 422 1.1.1.9 christos build_modules_nodep: $(MODULES) 423 1.1.1.9 christos @ 424 1.1 christos build_programs_nodep: $(PROGRAMS) $(SCRIPTS) 425 1.1.1.9 christos @ 426 1.1 christos 427 1.1 christos # Kept around for backward compatibility 428 1.1 christos build_apps build_tests: build_programs 429 1.1 christos 430 1.1.1.2 christos # Convenience target to prebuild all generated files, not just the mandatory 431 1.1.1.2 christos # ones 432 1.1.1.9 christos build_all_generated: $(GENERATED_MANDATORY) $(GENERATED) build_docs 433 1.1.1.8 christos @{- output_off() if $disabled{makedepend}; "\@rem" -} 434 1.1.1.4 christos @$(ECHO) "Warning: consider configuring with no-makedepend, because if" 435 1.1.1.4 christos @$(ECHO) " target system doesn't have $(PERL)," 436 1.1.1.4 christos @$(ECHO) " then make will fail..." 437 1.1.1.8 christos @{- output_on() if $disabled{makedepend}; "\@rem" -} 438 1.1.1.2 christos 439 1.1.1.9 christos all: build_sw build_docs 440 1.1.1.9 christos 441 1.1 christos test: tests 442 1.1.1.9 christos {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep copy-utils 443 1.1.1.11 christos $(MAKE) /$(MAKEFLAGS) run_tests 444 1.1.1.11 christos run_tests: 445 1.1.1.8 christos @{- output_off() if $disabled{tests}; "\@rem" -} 446 1.1.1.9 christos cmd /C "set "SRCTOP=$(SRCDIR)" & set "BLDTOP=$(BLDDIR)" & set "PERL=$(PERL)" & set "FIPSKEY=$(FIPSKEY)" & "$(PERL)" "$(SRCDIR)\test\run_tests.pl" $(TESTS)" 447 1.1.1.9 christos @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} 448 1.1.1.3 christos @$(ECHO) "Tests are not supported with your chosen Configure options" 449 1.1.1.8 christos @{- output_on() if !$disabled{tests}; "\@rem" -} 450 1.1 christos 451 1.1 christos list-tests: 452 1.1.1.8 christos @{- output_off() if $disabled{tests}; "\@rem" -} 453 1.1.1.9 christos @cmd /C "set "SRCTOP=$(SRCDIR)" & "$(PERL)" "$(SRCDIR)\test\run_tests.pl" list" 454 1.1.1.9 christos @{- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -} 455 1.1.1.3 christos @$(ECHO) "Tests are not supported with your chosen Configure options" 456 1.1.1.8 christos @{- output_on() if !$disabled{tests}; "\@rem" -} 457 1.1 christos 458 1.1.1.9 christos install: install_sw install_ssldirs install_docs {- $disabled{fips} ? "" : "install_fips" -} 459 1.1 christos 460 1.1.1.9 christos uninstall: uninstall_docs uninstall_sw {- $disabled{fips} ? "" : "uninstall_fips" -} 461 1.1 christos 462 1.1 christos libclean: 463 1.1.1.4 christos "$(PERL)" -e "map { m/(.*)\.dll$$/; unlink glob """{.,apps,test,fuzz}/$$1.*"""; } @ARGV" $(SHLIBS) 464 1.1.1.4 christos -del /Q /F $(LIBS) libcrypto.* libssl.* ossl_static.pdb 465 1.1 christos 466 1.1 christos clean: libclean 467 1.1.1.9 christos {- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS1) || "\@rem" -} 468 1.1.1.9 christos {- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS3) || "\@rem" -} 469 1.1.1.9 christos {- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS5) || "\@rem" -} 470 1.1.1.9 christos {- join("\n\t", map { "-del /Q /F $_" } @HTMLDOCS7) || "\@rem" -} 471 1.1.1.8 christos {- join("\n\t", map { "-del /Q /F $_" } @PROGRAMS) || "\@rem" -} 472 1.1.1.9 christos {- join("\n\t", map { "-del /Q /F $_" } @MODULES) || "\@rem" -} 473 1.1.1.9 christos {- join("\n\t", map { "-del /Q /F $_" } @SCRIPTS) || "\@rem" -} 474 1.1.1.9 christos {- join("\n\t", map { "-del /Q /F $_" } @GENERATED_MANDATORY) || "\@rem" -} 475 1.1.1.9 christos {- join("\n\t", map { "-del /Q /F $_" } @GENERATED) || "\@rem" -} 476 1.1.1.4 christos -del /Q /S /F *.d *.obj *.pdb *.ilk *.manifest 477 1.1.1.4 christos -del /Q /S /F engines\*.lib engines\*.exp 478 1.1.1.4 christos -del /Q /S /F apps\*.lib apps\*.rc apps\*.res apps\*.exp 479 1.1.1.4 christos -del /Q /S /F test\*.exp 480 1.1.1.9 christos -rd /Q /S test\test-runs 481 1.1 christos 482 1.1 christos distclean: clean 483 1.1.1.9 christos -del /Q /F include\openssl\configuration.h 484 1.1 christos -del /Q /F configdata.pm 485 1.1 christos -del /Q /F makefile 486 1.1 christos 487 1.1.1.9 christos depend: makefile 488 1.1.1.8 christos @ {- output_off() if $disabled{makedepend}; "\@rem" -} 489 1.1.1.9 christos @ "$(PERL)" "$(SRCDIR)\util\add-depends.pl" "{- $target{makedep_scheme} -}" 490 1.1.1.8 christos @ {- output_on() if $disabled{makedepend}; "\@rem" -} 491 1.1 christos 492 1.1 christos # Install helper targets ############################################# 493 1.1 christos 494 1.1.1.9 christos install_sw: install_dev install_engines install_modules install_runtime 495 1.1 christos 496 1.1.1.9 christos uninstall_sw: uninstall_runtime uninstall_modules uninstall_engines uninstall_dev 497 1.1 christos 498 1.1 christos install_docs: install_html_docs 499 1.1 christos 500 1.1 christos uninstall_docs: uninstall_html_docs 501 1.1 christos 502 1.1.1.9 christos {- output_off() if $disabled{fips}; "" -} 503 1.1.1.9 christos install_fips: build_sw $(INSTALL_FIPSMODULECONF) 504 1.1.1.9 christos # @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1) 505 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(MODULESDIR)" 506 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)" 507 1.1.1.9 christos @$(ECHO) "*** Installing FIPS module" 508 1.1.1.9 christos @$(ECHO) "install $(INSTALL_FIPSMODULE) -> $(MODULESDIR)\$(FIPSMODULENAME)" 509 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(INSTALL_FIPSMODULE)" "$(MODULESDIR)" 510 1.1.1.9 christos @$(ECHO) "*** Installing FIPS module configuration" 511 1.1.1.9 christos @$(ECHO) "install $(INSTALL_FIPSMODULECONF) -> $(OPENSSLDIR)\fipsmodule.cnf" 512 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(INSTALL_FIPSMODULECONF)" "$(OPENSSLDIR)" 513 1.1.1.9 christos 514 1.1.1.9 christos uninstall_fips: 515 1.1.1.9 christos @$(ECHO) "*** Uninstalling FIPS module configuration" 516 1.1.1.9 christos $(RM) "$(OPENSSLDIR)\fipsmodule.cnf" 517 1.1.1.9 christos @$(ECHO) "*** Uninstalling FIPS module" 518 1.1.1.9 christos $(RM) "$(MODULESDIR)\$(FIPSMODULENAME)" 519 1.1.1.9 christos {- if ($disabled{fips}) { output_on(); } else { output_off(); } "" -} 520 1.1.1.9 christos install_fips: 521 1.1.1.9 christos @$(ECHO) "The 'install_fips' target requires the 'enable-fips' option" 522 1.1.1.9 christos 523 1.1.1.9 christos uninstall_fips: 524 1.1.1.9 christos @$(ECHO) "The 'uninstall_fips' target requires the 'enable-fips' option" 525 1.1.1.9 christos {- output_on() if !$disabled{fips}; "" -} 526 1.1.1.9 christos 527 1.1 christos install_ssldirs: 528 1.1 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\certs" 529 1.1 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\private" 530 1.1 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(OPENSSLDIR)\misc" 531 1.1 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \ 532 1.1 christos "$(OPENSSLDIR)\openssl.cnf.dist" 533 1.1 christos @IF NOT EXIST "$(OPENSSLDIR)\openssl.cnf" \ 534 1.1 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\openssl.cnf" \ 535 1.1 christos "$(OPENSSLDIR)\openssl.cnf" 536 1.1.1.9 christos @if not "$(MISC_SCRIPTS)"=="" \ 537 1.1.1.9 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" $(MISC_SCRIPTS) \ 538 1.1 christos "$(OPENSSLDIR)\misc" 539 1.1.1.4 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \ 540 1.1.1.4 christos "$(OPENSSLDIR)\ct_log_list.cnf.dist" 541 1.1.1.4 christos @IF NOT EXIST "$(OPENSSLDIR)\ct_log_list.cnf" \ 542 1.1.1.4 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\apps\ct_log_list.cnf" \ 543 1.1.1.4 christos "$(OPENSSLDIR)\ct_log_list.cnf" 544 1.1 christos 545 1.1.1.5 christos install_dev: install_runtime_libs 546 1.1.1.3 christos @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) 547 1.1.1.3 christos @$(ECHO) "*** Installing development files" 548 1.1 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\include\openssl" 549 1.1.1.9 christos @{- output_off() if $disabled{uplink}; "" -} 550 1.1 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(SRCDIR)\ms\applink.c" \ 551 1.1 christos "$(INSTALLTOP)\include\openssl" 552 1.1.1.9 christos @{- output_on() if $disabled{uplink}; "" -} 553 1.1.1.3 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" "-exclude_re=/__DECC_" \ 554 1.1.1.3 christos "$(SRCDIR)\include\openssl\*.h" \ 555 1.1 christos "$(INSTALLTOP)\include\openssl" 556 1.1.1.3 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" "$(BLDDIR)\include\openssl\*.h" \ 557 1.1 christos "$(INSTALLTOP)\include\openssl" 558 1.1.1.4 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)" 559 1.1.1.4 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)" 560 1.1 christos @if "$(SHLIBS)"=="" \ 561 1.1.1.4 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)" 562 1.1 christos 563 1.1 christos uninstall_dev: 564 1.1 christos 565 1.1.1.9 christos _install_modules_deps: install_runtime_libs build_modules 566 1.1.1.9 christos 567 1.1.1.9 christos install_engines: _install_modules_deps 568 1.1.1.3 christos @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) 569 1.1.1.3 christos @$(ECHO) "*** Installing engines" 570 1.1 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(ENGINESDIR)" 571 1.1.1.9 christos @if not "$(INSTALL_ENGINES)"=="" \ 572 1.1 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)" 573 1.1.1.9 christos @if not "$(INSTALL_ENGINES)"=="" \ 574 1.1 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)" 575 1.1 christos 576 1.1 christos uninstall_engines: 577 1.1 christos 578 1.1.1.9 christos install_modules: _install_modules_deps 579 1.1.1.9 christos @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) 580 1.1.1.9 christos @$(ECHO) "*** Installing modules" 581 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(MODULESDIR)" 582 1.1.1.9 christos @if not "$(INSTALL_MODULES)"=="" \ 583 1.1.1.9 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULES) "$(MODULESDIR)" 584 1.1.1.9 christos @if not "$(INSTALL_MODULES)"=="" \ 585 1.1.1.9 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULEPDBS) "$(MODULESDIR)" 586 1.1.1.9 christos 587 1.1.1.9 christos uninstall_modules: 588 1.1.1.9 christos 589 1.1.1.5 christos install_runtime: install_programs 590 1.1.1.5 christos 591 1.1.1.5 christos install_runtime_libs: build_libs 592 1.1.1.3 christos @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) 593 1.1.1.5 christos @$(ECHO) "*** Installing runtime libraries" 594 1.1 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin" 595 1.1 christos @if not "$(SHLIBS)"=="" \ 596 1.1 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin" 597 1.1 christos @if not "$(SHLIBS)"=="" \ 598 1.1 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \ 599 1.1 christos "$(INSTALLTOP)\bin" 600 1.1.1.5 christos 601 1.1.1.5 christos install_programs: install_runtime_libs build_programs 602 1.1.1.5 christos @if "$(INSTALLTOP)"=="" ( $(ECHO) "INSTALLTOP should not be empty" & exit 1 ) 603 1.1.1.5 christos @$(ECHO) "*** Installing runtime programs" 604 1.1.1.9 christos @if not "$(INSTALL_PROGRAMS)"=="" \ 605 1.1.1.9 christos "$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\bin" 606 1.1.1.9 christos @if not "$(INSTALL_PROGRAMS)"=="" \ 607 1.1.1.9 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \ 608 1.1 christos "$(INSTALLTOP)\bin" 609 1.1.1.9 christos @if not "$(INSTALL_PROGRAMS)"=="" \ 610 1.1.1.9 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \ 611 1.1 christos "$(INSTALLTOP)\bin" 612 1.1.1.9 christos @if not "$(INSTALL_PROGRAMS)"=="" \ 613 1.1.1.9 christos "$(PERL)" "$(SRCDIR)\util\copy.pl" $(BIN_SCRIPTS) \ 614 1.1 christos "$(INSTALLTOP)\bin" 615 1.1 christos 616 1.1 christos uninstall_runtime: 617 1.1 christos 618 1.1.1.9 christos install_html_docs: install_image_docs build_html_docs 619 1.1.1.9 christos @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 ) 620 1.1.1.9 christos @echo *** Installing HTML docs 621 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man1" 622 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man3" 623 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man5" 624 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man7" 625 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man1\*.html \ 626 1.1.1.9 christos "$(INSTALLTOP)\html\man1" 627 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man3\*.html \ 628 1.1.1.9 christos "$(INSTALLTOP)\html\man3" 629 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man5\*.html \ 630 1.1.1.9 christos "$(INSTALLTOP)\html\man5" 631 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(BLDDIR)\doc\html\man7\*.html \ 632 1.1.1.9 christos "$(INSTALLTOP)\html\man7" 633 1.1.1.9 christos 634 1.1.1.9 christos uninstall_html_docs: uninstall_image_docs 635 1.1.1.9 christos 636 1.1.1.9 christos install_image_docs: 637 1.1.1.9 christos @if "$(INSTALLTOP)"=="" ( echo INSTALLTOP should not be empty & exit 1 ) 638 1.1.1.9 christos @echo *** Installing HTML images 639 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(INSTALLTOP)\html\man7\img" 640 1.1.1.9 christos @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(SRCDIR)\doc\man7\img\*.png \ 641 1.1.1.9 christos "$(INSTALLTOP)\html\man7\img" 642 1.1.1.9 christos 643 1.1.1.9 christos uninstall_image_docs: 644 1.1.1.9 christos 645 1.1.1.9 christos # Helper targets ##################################################### 646 1.1.1.9 christos 647 1.1.1.9 christos copy-utils: $(BLDDIR)\apps\openssl.cnf 648 1.1.1.9 christos 649 1.1.1.9 christos $(BLDDIR)\apps\openssl.cnf: makefile 650 1.1.1.9 christos @if NOT EXIST "$(BLDDIR)\apps" mkdir "$(BLDDIR)\apps" 651 1.1.1.9 christos @if NOT "$(SRCDIR)"=="$(BLDDIR)" copy "$(SRCDIR)\apps\$(@F)" "$(BLDDIR)\apps" 652 1.1 christos 653 1.1 christos # Building targets ################################################### 654 1.1 christos 655 1.1.1.9 christos makefile: configdata.pm {- join(" ", map { '"'.$_.'"' } @{$config{build_file_templates}}) -} 656 1.1.1.9 christos @$(ECHO) "Detected changed: $?" 657 1.1.1.9 christos "$(PERL)" configdata.pm 658 1.1.1.9 christos @$(ECHO) "**************************************************" 659 1.1.1.9 christos @$(ECHO) "*** ***" 660 1.1.1.9 christos @$(ECHO) "*** Please run the same make command again ***" 661 1.1.1.9 christos @$(ECHO) "*** ***" 662 1.1.1.9 christos @$(ECHO) "**************************************************" 663 1.1.1.9 christos @exit 1 664 1.1.1.9 christos 665 1.1.1.9 christos configdata.pm: "$(SRCDIR)\Configure" {- join(" ", map { '"'.$_.'"' } @{$config{build_infos}}, @{$config{conf_files}}) -} 666 1.1.1.3 christos @$(ECHO) "Detected changed: $?" 667 1.1.1.4 christos "$(PERL)" configdata.pm -r 668 1.1.1.3 christos @$(ECHO) "**************************************************" 669 1.1.1.3 christos @$(ECHO) "*** ***" 670 1.1.1.3 christos @$(ECHO) "*** Please run the same make command again ***" 671 1.1.1.3 christos @$(ECHO) "*** ***" 672 1.1.1.3 christos @$(ECHO) "**************************************************" 673 1.1 christos @exit 1 674 1.1 christos 675 1.1.1.4 christos reconfigure reconf: 676 1.1.1.4 christos "$(PERL)" configdata.pm -r 677 1.1.1.4 christos 678 1.1 christos {- 679 1.1 christos use File::Basename; 680 1.1.1.9 christos use File::Spec::Functions qw/:DEFAULT abs2rel rel2abs file_name_is_absolute/; 681 1.1.1.9 christos 682 1.1.1.9 christos # Helper function to convert dependencies in platform agnostic form to 683 1.1.1.9 christos # dependencies in platform form. 684 1.1.1.9 christos sub compute_platform_depends { 685 1.1.1.9 christos map { my $x = $_; 686 1.1.1.9 christos 687 1.1.1.9 christos grep { $x eq $_ } @{$unified_info{programs}} and platform->bin($x) 688 1.1.1.9 christos or grep { $x eq $_ } @{$unified_info{modules}} and platform->dso($x) 689 1.1.1.9 christos or grep { $x eq $_ } @{$unified_info{libraries}} and platform->lib($x) 690 1.1.1.9 christos or platform->convertext($x); } @_; 691 1.1.1.9 christos } 692 1.1 christos 693 1.1 christos # Helper function to figure out dependencies on libraries 694 1.1 christos # It takes a list of library names and outputs a list of dependencies 695 1.1 christos sub compute_lib_depends { 696 1.1 christos if ($disabled{shared}) { 697 1.1.1.9 christos return map { platform->staticlib($_) } @_; 698 1.1.1.4 christos } 699 1.1.1.9 christos return map { platform->sharedlib_import($_) // platform->staticlib($_) } @_; 700 1.1 christos } 701 1.1 christos 702 1.1.1.9 christos sub generatetarget { 703 1.1.1.9 christos my %args = @_; 704 1.1.1.9 christos my $deps = join(" ", compute_platform_depends(@{$args{deps}})); 705 1.1.1.9 christos return <<"EOF"; 706 1.1.1.9 christos $args{target}: $deps 707 1.1.1.9 christos EOF 708 1.1.1.9 christos } 709 1.1.1.9 christos 710 1.1.1.9 christos # This function (and the next) avoids quoting paths of generated dependencies 711 1.1.1.9 christos # (in the build tree), but quotes paths of non-generated dependencies (in the 712 1.1.1.9 christos # source tree). This is a workaround for a limitation of C++Builder's make.exe 713 1.1.1.9 christos # in handling quoted paths: https://quality.embarcadero.com/browse/RSP-31756 714 1.1 christos sub generatesrc { 715 1.1 christos my %args = @_; 716 1.1.1.9 christos my $gen0 = $args{generator}->[0]; 717 1.1.1.9 christos my $gen_args = join('', map { " $_" } 718 1.1.1.9 christos @{$args{generator}}[1..$#{$args{generator}}]); 719 1.1.1.9 christos my $gen_incs = join("", map { " -I\"$_\"" } @{$args{generator_incs}}); 720 1.1.1.9 christos my $incs = join("", map { " -I\"$_\"" } @{$args{incs}}); 721 1.1.1.9 christos my $defs = join("", map { " -D".$_ } @{$args{defs}}); 722 1.1.1.9 christos my $deps = join(' ', 723 1.1.1.9 christos map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ } 724 1.1.1.9 christos compute_platform_depends(@{$args{generator_deps}}, 725 1.1.1.9 christos @{$args{deps}})); 726 1.1.1.9 christos 727 1.1.1.9 christos if ($args{src} =~ /\.html$/) { 728 1.1.1.9 christos # 729 1.1.1.9 christos # HTML generator 730 1.1.1.9 christos # 731 1.1.1.9 christos my $title = basename($args{src}, ".html"); 732 1.1.1.9 christos my $pod = $gen0; 733 1.1.1.9 christos return <<"EOF"; 734 1.1.1.9 christos $args{src}: "$pod" 735 1.1.1.9 christos "\$(PERL)" "\$(SRCDIR)/util/mkpod2html.pl" -i "$pod" -o \$\@ -t "$title" -r "\$(SRCDIR)/doc" 736 1.1 christos EOF 737 1.1.1.9 christos } elsif (platform->isdef($args{src})) { 738 1.1.1.9 christos # 739 1.1.1.9 christos # Linker script-ish generator 740 1.1.1.9 christos # 741 1.1.1.9 christos my $target = platform->def($args{src}); 742 1.1.1.9 christos my $mkdef = abs2rel(rel2abs(catfile($config{sourcedir}, 743 1.1.1.9 christos "util", "mkdef.pl")), 744 1.1.1.9 christos rel2abs($config{builddir})); 745 1.1.1.9 christos my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : ''; 746 1.1.1.9 christos my $ord_name = 747 1.1.1.9 christos $args{generator}->[1] || basename(platform->dsoname($args{product})); 748 1.1.1.9 christos return <<"EOF"; 749 1.1.1.9 christos $target: $gen0 $deps $mkdef 750 1.1.1.9 christos "\$(PERL)" "$mkdef"$ord_ver --type $args{intent} --ordinals $gen0 --name $ord_name --OS windows > $target 751 1.1 christos EOF 752 1.1.1.9 christos } elsif (platform->isasm($args{src}) 753 1.1.1.9 christos || platform->iscppasm($args{src})) { 754 1.1.1.9 christos # 755 1.1.1.9 christos # Assembler generator 756 1.1.1.9 christos # 757 1.1.1.9 christos my $cppflags = { 758 1.1.1.9 christos shlib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 759 1.1.1.9 christos lib => '$(LIB_CFLAGS) $(LIB_CPPFLAGS)', 760 1.1.1.9 christos dso => '$(DSO_CFLAGS) $(DSO_CPPFLAGS)', 761 1.1.1.9 christos bin => '$(BIN_CFLAGS) $(BIN_CPPFLAGS)' 762 1.1.1.9 christos } -> {$args{intent}}; 763 1.1.1.9 christos my $target = platform->isasm($args{src}) 764 1.1.1.9 christos ? platform->asm($args{src}) 765 1.1.1.9 christos : $args{src}; 766 1.1.1.9 christos 767 1.1.1.9 christos my $generator; 768 1.1.1.9 christos if ($gen0 =~ /\.pl$/) { 769 1.1.1.9 christos $generator = '"$(PERL)"'.$gen_incs.' "'.$gen0.'"'.$gen_args 770 1.1.1.10 christos .' "$(PERLASM_SCHEME)"'.$incs.' '.$cppflags.$defs.' $(PROCESSOR)'; 771 1.1.1.9 christos } elsif ($gen0 =~ /\.S$/) { 772 1.1 christos $generator = undef; 773 1.1 christos } else { 774 1.1.1.9 christos die "Generator type for $src unknown: $gen0\n"; 775 1.1 christos } 776 1.1 christos 777 1.1 christos if (defined($generator)) { 778 1.1 christos return <<"EOF"; 779 1.1.1.9 christos $target: "$gen0" $deps 780 1.1.1.9 christos cmd /C "set "ASM=\$(AS)" & $generator \$@" 781 1.1 christos EOF 782 1.1 christos } 783 1.1 christos return <<"EOF"; 784 1.1.1.9 christos $target: "$gen0" $deps 785 1.1.1.9 christos \$(CPP) $incs $cppflags $defs "$gen0" > \$@.i 786 1.1.1.9 christos move /Y \$@.i \$@ 787 1.1.1.9 christos EOF 788 1.1.1.9 christos } elsif ($gen0 =~ m|^.*\.in$|) { 789 1.1.1.9 christos # 790 1.1.1.9 christos # "dofile" generator (file.in -> file) 791 1.1.1.9 christos # 792 1.1.1.9 christos my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, 793 1.1.1.9 christos "util", "dofile.pl")), 794 1.1.1.9 christos rel2abs($config{builddir})); 795 1.1.1.9 christos my @perlmodules = ( 'configdata.pm', 796 1.1.1.9 christos grep { $_ =~ m|\.pm$| } @{$args{deps}} ); 797 1.1.1.9 christos my %perlmoduleincs = map { '"-I'.dirname($_).'"' => 1 } @perlmodules; 798 1.1.1.9 christos $deps = join(' ', $deps, compute_platform_depends(@perlmodules)); 799 1.1.1.9 christos @perlmodules = map { "-M".basename($_, '.pm') } @perlmodules; 800 1.1.1.9 christos my $perlmodules = join(' ', '', sort keys %perlmoduleincs, @perlmodules); 801 1.1.1.9 christos return <<"EOF"; 802 1.1.1.9 christos $args{src}: "$gen0" $deps 803 1.1.1.9 christos "\$(PERL)"$perlmodules "$dofile" "-o$target{build_file}" "$gen0"$gen_args > \$@ 804 1.1.1.9 christos EOF 805 1.1.1.9 christos } elsif (grep { $_ eq $gen0 } @{$unified_info{programs}}) { 806 1.1.1.9 christos # 807 1.1.1.9 christos # Generic generator using OpenSSL programs 808 1.1.1.9 christos # 809 1.1.1.9 christos 810 1.1.1.9 christos # Redo $gen0, to ensure that we have the proper extension. 811 1.1.1.9 christos $gen0 = platform->bin($gen0); 812 1.1.1.9 christos return <<"EOF"; 813 1.1.1.9 christos $args{src}: $gen0 $deps "\$(BLDDIR)\\util\\wrap.pl" 814 1.1.1.9 christos "\$(PERL)" "\$(BLDDIR)\\util\\wrap.pl" "$gen0"$gen_args > \$@ 815 1.1.1.9 christos EOF 816 1.1.1.9 christos } else { 817 1.1.1.9 christos # 818 1.1.1.9 christos # Generic generator using Perl 819 1.1.1.9 christos # 820 1.1.1.9 christos return <<"EOF"; 821 1.1.1.9 christos $args{src}: "$gen0" $deps 822 1.1.1.9 christos "\$(PERL)"$gen_incs "$gen0"$gen_args > \$@ 823 1.1 christos EOF 824 1.1 christos } 825 1.1 christos } 826 1.1 christos 827 1.1 christos sub src2obj { 828 1.1.1.9 christos my $asmext = platform->asmext(); 829 1.1 christos my %args = @_; 830 1.1.1.9 christos my @srcs = 831 1.1.1.9 christos map { my $x = $_; 832 1.1.1.9 christos (platform->isasm($x) && grep { $x eq $_ } @generated) 833 1.1.1.9 christos ? platform->asm($x) : $x } 834 1.1.1.9 christos ( @{$args{srcs}} ); 835 1.1 christos my $srcs = '"'.join('" "', @srcs).'"'; 836 1.1.1.9 christos my $deps = join(' ', 837 1.1.1.9 christos map { file_name_is_absolute($_) || ($_ =~ m|^../|) ? "\"$_\"" : $_ } 838 1.1.1.9 christos (@srcs, @{$args{deps}})); 839 1.1.1.9 christos my $incs = join("", map { ' -I"'.$_.'"' } @{$args{incs}}); 840 1.1.1.9 christos my $defs = join("", map { " -D".$_ } @{$args{defs}}); 841 1.1.1.9 christos my $cflags = { shlib => ' $(LIB_CFLAGS)', 842 1.1.1.9 christos lib => ' $(LIB_CFLAGS)', 843 1.1.1.4 christos dso => ' $(DSO_CFLAGS)', 844 1.1.1.4 christos bin => ' $(BIN_CFLAGS)' } -> {$args{intent}}; 845 1.1.1.4 christos $cflags .= $incs; 846 1.1.1.9 christos $cflags .= { shlib => ' $(LIB_CPPFLAGS)', 847 1.1.1.9 christos lib => ' $(LIB_CPPFLAGS)', 848 1.1.1.4 christos dso => ' $(DSO_CPPFLAGS)', 849 1.1.1.4 christos bin => ' $(BIN_CPPFLAGS)' } -> {$args{intent}}; 850 1.1.1.9 christos my $asflags = { shlib => ' $(LIB_ASFLAGS)', 851 1.1.1.9 christos lib => ' $(LIB_ASFLAGS)', 852 1.1.1.4 christos dso => ' $(DSO_ASFLAGS)', 853 1.1.1.4 christos bin => ' $(BIN_ASFLAGS)' } -> {$args{intent}}; 854 1.1.1.9 christos my $makedepcmd = $config{makedepcmd} unless $disabled{makedepend}; 855 1.1.1.4 christos if ($srcs[0] =~ /\.rc$/) { 856 1.1.1.9 christos my $res = platform->res($args{obj}); 857 1.1.1.4 christos return <<"EOF"; 858 1.1.1.9 christos $res: $deps 859 1.1.1.6 christos \$(RC) \$(RCFLAGS) \$(RCOUTFLAG)\$\@ $srcs 860 1.1.1.4 christos EOF 861 1.1.1.4 christos } 862 1.1.1.9 christos my $obj = platform->obj($args{obj}); 863 1.1.1.9 christos my $dep = platform->dep($args{obj}); 864 1.1.1.9 christos if ($srcs[0] =~ /\Q${asmext}\E$/) { 865 1.1 christos return <<"EOF"; 866 1.1.1.9 christos $obj: $deps 867 1.1.1.4 christos \$(AS) $asflags \$(ASOUTFLAG)\$\@ $srcs 868 1.1.1.4 christos EOF 869 1.1.1.4 christos } elsif ($srcs[0] =~ /.S$/) { 870 1.1.1.4 christos return <<"EOF"; 871 1.1.1.9 christos $obj: $deps 872 1.1.1.9 christos \$(CC) /EP -D__ASSEMBLER__ $cflags $defs $srcs > \$@.asm 873 1.1.1.9 christos \$(AS) $asflags \$(ASOUTFLAG)\$\@ \$@.asm 874 1.1 christos EOF 875 1.1 christos } 876 1.1.1.5 christos my $recipe = <<"EOF"; 877 1.1.1.9 christos $obj: $deps 878 1.1.1.9 christos \$(CC) $cflags $defs -c \$(COUTFLAG)\$\@ $srcs 879 1.1 christos EOF 880 1.1.1.5 christos $recipe .= <<"EOF" unless $disabled{makedepend}; 881 1.1.1.9 christos cmd /C "$makedepcmd $cflags $defs $srcs > $dep 2>&1" 882 1.1.1.5 christos EOF 883 1.1.1.5 christos return $recipe; 884 1.1 christos } 885 1.1 christos 886 1.1.1.5 christos # We *know* this routine is only called when we've configure 'shared'. 887 1.1.1.5 christos # Also, note that even though the import library built here looks like 888 1.1.1.5 christos # a static library, it really isn't. 889 1.1.1.9 christos sub obj2shlib { 890 1.1 christos my %args = @_; 891 1.1 christos my $lib = $args{lib}; 892 1.1.1.9 christos my @objs = map { platform->convertext($_) } 893 1.1.1.9 christos grep { platform->isobj($_) } 894 1.1.1.9 christos @{$args{objs}}; 895 1.1.1.9 christos my @ress = map { platform->convertext($_) } 896 1.1.1.9 christos grep { platform->isres($_) } 897 1.1.1.9 christos @{$args{objs}}; 898 1.1.1.9 christos my @defs = map { platform->def($_) } 899 1.1.1.9 christos grep { platform->isdef($_) } 900 1.1.1.4 christos @{$args{objs}}; 901 1.1.1.4 christos my @deps = compute_lib_depends(@{$args{deps}}); 902 1.1.1.4 christos die "More than one exported symbols list" if scalar @defs > 1; 903 1.1.1.9 christos my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps); 904 1.1.1.9 christos my $objs = join($target{ld_resp_delim}, @objs); 905 1.1.1.9 christos my $ress = join($target{ld_resp_delim}, @ress); 906 1.1.1.9 christos my $deps = join(" ", @objs, @ress, @defs, @deps); 907 1.1.1.9 christos my $import = platform->sharedlib_import($lib); 908 1.1.1.9 christos my $dll = platform->sharedlib($lib); 909 1.1.1.9 christos my $shared_def = $target{lddefflag} . join("", @defs); 910 1.1.1.9 christos my $implib_rule = $target{ld_implib_rule} || ""; 911 1.1.1.9 christos my $implib_flag = $target{ld_implib_flag} 912 1.1.1.9 christos ? "$target{ld_implib_flag}$import" 913 1.1.1.9 christos : ""; 914 1.1 christos return <<"EOF" 915 1.1.1.5 christos # The import library may look like a static library, but it is not. 916 1.1.1.5 christos # We MUST make the import library depend on the DLL, in case someone 917 1.1.1.5 christos # mistakenly removes the latter. 918 1.1.1.5 christos $import: $dll 919 1.1.1.9 christos $implib_rule 920 1.1.1.5 christos $dll: $deps 921 1.1.1.5 christos IF EXIST $full.manifest DEL /F /Q $full.manifest 922 1.1.1.4 christos IF EXIST \$@ DEL /F /Q \$@ 923 1.1.1.9 christos cmd /C "\$(LD) \$(LDFLAGS) \$(LIB_LDFLAGS) @<< $implib_flag || (DEL /Q \$(\@B).* $import & EXIT 1)" 924 1.1.1.9 christos $objs$target{ld_resp_delim}\$(LDOUTFLAG)$dll$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(LIB_EX_LIBS)$target{ld_resp_delim}$shared_def$target{ldresflag}$ress 925 1.1 christos << 926 1.1.1.5 christos IF EXIST $dll.manifest \\ 927 1.1.1.5 christos \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dll.manifest \$(MTOUTFLAG)$dll 928 1.1.1.5 christos IF EXIST apps\\$dll DEL /Q /F apps\\$dll 929 1.1.1.5 christos IF EXIST test\\$dll DEL /Q /F test\\$dll 930 1.1.1.5 christos IF EXIST fuzz\\$dll DEL /Q /F fuzz\\$dll 931 1.1.1.5 christos COPY $dll apps 932 1.1.1.5 christos COPY $dll test 933 1.1.1.5 christos COPY $dll fuzz 934 1.1 christos EOF 935 1.1 christos } 936 1.1 christos sub obj2dso { 937 1.1 christos my %args = @_; 938 1.1.1.9 christos my $dso = platform->dso($args{module}); 939 1.1.1.9 christos my $dso_n = platform->dsoname($args{module}); 940 1.1.1.9 christos my @objs = map { platform->convertext($_) } 941 1.1.1.9 christos grep { platform->isobj($_) } 942 1.1.1.9 christos @{$args{objs}}; 943 1.1.1.9 christos my @ress = map { platform->convertext($_) } 944 1.1.1.9 christos grep { platform->isres($_) } 945 1.1.1.9 christos @{$args{objs}}; 946 1.1.1.9 christos my @defs = map { platform->def($_) } 947 1.1.1.9 christos grep { platform->isdef($_) } 948 1.1.1.9 christos @{$args{objs}}; 949 1.1.1.4 christos my @deps = compute_lib_depends(@{$args{deps}}); 950 1.1.1.9 christos die "More than one exported symbols list" if scalar @defs > 1; 951 1.1.1.9 christos my $objs = join($target{ld_resp_delim}, @objs); 952 1.1.1.9 christos my $ress = join($target{ld_resp_delim}, @ress); 953 1.1.1.9 christos my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps); 954 1.1.1.9 christos my $deps = join(" ", @objs, @ress, @defs, @deps); 955 1.1.1.9 christos my $shared_def = $target{lddefflag} . join("", @defs); 956 1.1 christos return <<"EOF"; 957 1.1.1.9 christos $dso: $deps 958 1.1.1.9 christos IF EXIST $dso.manifest DEL /F /Q $dso.manifest 959 1.1.1.9 christos cmd /C "\$(LD) \$(LDFLAGS) \$(DSO_LDFLAGS) @<< || (DEL /Q \$(\@B).* $dso_n.* & EXIT 1)" 960 1.1.1.9 christos $objs$target{ld_resp_delim}\$(LDOUTFLAG)$dso$target{ldpostoutflag}$target{ld_resp_delim}$linklibs \$(DSO_EX_LIBS)$target{ld_resp_delim}$shared_def$target{ldresflag}$ress 961 1.1 christos << 962 1.1.1.9 christos IF EXIST $dso.manifest \\ 963 1.1.1.9 christos \$(MT) \$(MTFLAGS) \$(MTINFLAG)$dso.manifest \$(MTOUTFLAG)$dso 964 1.1 christos EOF 965 1.1 christos } 966 1.1 christos sub obj2lib { 967 1.1.1.4 christos my %args = @_; 968 1.1.1.9 christos my $lib = platform->staticlib($args{lib}); 969 1.1.1.9 christos my @objs = map { platform->obj($_) } @{$args{objs}}; 970 1.1.1.9 christos my $objs = join($target{ar_resp_delim}, @objs); 971 1.1.1.4 christos my $deps = join(" ", @objs); 972 1.1 christos return <<"EOF"; 973 1.1.1.5 christos $lib: $deps 974 1.1.1.5 christos \$(AR) \$(ARFLAGS) \$(AROUTFLAG)$lib @<< 975 1.1.1.4 christos $objs 976 1.1 christos << 977 1.1 christos EOF 978 1.1 christos } 979 1.1 christos sub obj2bin { 980 1.1 christos my %args = @_; 981 1.1.1.9 christos my $bin = platform->bin($args{bin}); 982 1.1.1.9 christos my @objs = map { platform->convertext($_) } 983 1.1.1.9 christos grep { platform->isobj($_) } 984 1.1.1.9 christos @{$args{objs}}; 985 1.1.1.9 christos my @ress = map { platform->convertext($_) } 986 1.1.1.9 christos grep { platform->isres($_) } 987 1.1.1.9 christos @{$args{objs}}; 988 1.1.1.4 christos my @deps = compute_lib_depends(@{$args{deps}}); 989 1.1.1.9 christos my $objs = join($target{ld_resp_delim}, @objs); 990 1.1.1.9 christos my $ress = join($target{ld_resp_delim}, @ress); 991 1.1.1.9 christos my $linklibs = join("", map { "$_$target{ld_resp_delim}" } @deps); 992 1.1.1.9 christos my $deps = join(" ", @objs, @ress, @deps); 993 1.1 christos return <<"EOF"; 994 1.1.1.9 christos $bin: $deps 995 1.1.1.9 christos IF EXIST $bin.manifest DEL /F /Q $bin.manifest 996 1.1.1.9 christos \$(LD) \$(LDFLAGS) \$(BIN_LDFLAGS) @<< 997 1.1.1.9 christos $objs$target{ld_resp_delim}\$(LDOUTFLAG)$bin$target{ldpostoutflag}$target{ld_resp_delim}$linklibs\$(BIN_EX_LIBS)$target{ldresflag}$target{ldresflag}$ress 998 1.1 christos << 999 1.1.1.9 christos IF EXIST $bin.manifest \\ 1000 1.1.1.9 christos \$(MT) \$(MTFLAGS) \$(MTINFLAG)$bin.manifest \$(MTOUTFLAG)$bin 1001 1.1 christos EOF 1002 1.1 christos } 1003 1.1 christos sub in2script { 1004 1.1 christos my %args = @_; 1005 1.1 christos my $script = $args{script}; 1006 1.1 christos my $sources = '"'.join('" "', @{$args{sources}}).'"'; 1007 1.1 christos my $dofile = abs2rel(rel2abs(catfile($config{sourcedir}, 1008 1.1 christos "util", "dofile.pl")), 1009 1.1 christos rel2abs($config{builddir})); 1010 1.1 christos return <<"EOF"; 1011 1.1.1.9 christos $script: $sources configdata.pm 1012 1.1 christos "\$(PERL)" "-I\$(BLDDIR)" -Mconfigdata "$dofile" \\ 1013 1.1.1.9 christos "-o$target{build_file}" $sources > \$@ 1014 1.1 christos EOF 1015 1.1 christos } 1016 1.1 christos sub generatedir { 1017 1.1 christos my %args = @_; 1018 1.1 christos my $dir = $args{dir}; 1019 1.1.1.9 christos my @deps = map { platform->convertext($_) } @{$args{deps}}; 1020 1.1 christos my @actions = (); 1021 1.1.1.9 christos my %extinfo = ( dso => platform->dsoext(), 1022 1.1.1.9 christos lib => platform->libext(), 1023 1.1.1.9 christos bin => platform->binext() ); 1024 1.1 christos 1025 1.1.1.5 christos # We already have a 'test' target, and the top directory is just plain 1026 1.1.1.5 christos # silly 1027 1.1.1.5 christos return if $dir eq "test" || $dir eq "."; 1028 1.1.1.5 christos 1029 1.1 christos foreach my $type (("dso", "lib", "bin", "script")) { 1030 1.1 christos next unless defined($unified_info{dirinfo}->{$dir}->{products}->{$type}); 1031 1.1 christos # For lib object files, we could update the library. However, 1032 1.1 christos # LIB on Windows doesn't work that way, so we won't create any 1033 1.1 christos # actions for it, and the dependencies are already taken care of. 1034 1.1 christos if ($type ne "lib") { 1035 1.1 christos foreach my $prod (@{$unified_info{dirinfo}->{$dir}->{products}->{$type}}) { 1036 1.1 christos if (dirname($prod) eq $dir) { 1037 1.1 christos push @deps, $prod.$extinfo{$type}; 1038 1.1 christos } 1039 1.1 christos } 1040 1.1 christos } 1041 1.1 christos } 1042 1.1 christos 1043 1.1 christos my $deps = join(" ", @deps); 1044 1.1 christos my $actions = join("\n", "", @actions); 1045 1.1 christos return <<"EOF"; 1046 1.1.1.5 christos $dir $dir\\ : $deps$actions 1047 1.1 christos EOF 1048 1.1 christos } 1049 1.1 christos "" # Important! This becomes part of the template result. 1050 1.1 christos -} 1051