diff options
Diffstat (limited to 'src/lib/libcrypto/util/mk1mf.pl')
-rw-r--r-- | src/lib/libcrypto/util/mk1mf.pl | 316 |
1 files changed, 198 insertions, 118 deletions
diff --git a/src/lib/libcrypto/util/mk1mf.pl b/src/lib/libcrypto/util/mk1mf.pl index 149a0f4f80..6fbf3ceca6 100644 --- a/src/lib/libcrypto/util/mk1mf.pl +++ b/src/lib/libcrypto/util/mk1mf.pl | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/local/bin/perl |
2 | # A bit of an evil hack but it post processes the file ../MINFO which | 2 | # A bit of an evil hack but it post processes the file ../MINFO which |
3 | # is generated by `make files` in the top directory. | 3 | # is generated by `make files` in the top directory. |
4 | # This script outputs one mega makefile that has no shell stuff or any | 4 | # This script outputs one mega makefile that has no shell stuff or any |
@@ -6,82 +6,59 @@ | |||
6 | # | 6 | # |
7 | 7 | ||
8 | $INSTALLTOP="/usr/local/ssl"; | 8 | $INSTALLTOP="/usr/local/ssl"; |
9 | $OPTIONS=""; | ||
10 | $ssl_version=""; | ||
11 | |||
12 | open(IN,"<Makefile.ssl") || die "unable to open Makefile.ssl!\n"; | ||
13 | while(<IN>) { | ||
14 | $ssl_version=$1 if (/^VERSION=(.*)$/); | ||
15 | $OPTIONS=$1 if (/^OPTIONS=(.*)$/); | ||
16 | $INSTALLTOP=$1 if (/^INSTALLTOP=(.*$)/); | ||
17 | } | ||
18 | close(IN); | ||
9 | 19 | ||
10 | $ssl_version="0.8.2"; | 20 | die "Makefile.ssl is not the toplevel Makefile!\n" if $ssl_version eq ""; |
11 | 21 | ||
12 | $infile="MINFO"; | 22 | $infile="MINFO"; |
13 | 23 | ||
14 | %ops=( | 24 | %ops=( |
15 | "VC-WIN32", "Microsoft Visual C++ 4.[01] - Windows NT [34].x", | 25 | "VC-WIN32", "Microsoft Visual C++ [4-6] - Windows NT or 9X", |
26 | "VC-NT", "Microsoft Visual C++ [4-6] - Windows NT ONLY", | ||
16 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", | 27 | "VC-W31-16", "Microsoft Visual C++ 1.52 - Windows 3.1 - 286", |
17 | "VC-WIN16", "Alias for VC-W31-32", | 28 | "VC-WIN16", "Alias for VC-W31-32", |
18 | "VC-W31-32", "Microsoft Visual C++ 1.52 - Windows 3.1 - 386+", | 29 | "VC-W31-32", "Microsoft Visual C++ 1.52 - Windows 3.1 - 386+", |
19 | "VC-MSDOS","Microsoft Visual C++ 1.52 - MSDOS", | 30 | "VC-MSDOS","Microsoft Visual C++ 1.52 - MSDOS", |
20 | "BC-NT", "Borland C++ 4.5 - Windows NT - PROBABLY NOT WORKING", | 31 | "Mingw32", "GNU C++ - Windows NT or 9x", |
32 | "Mingw32-files", "Create files with DOS copy ...", | ||
33 | "BC-NT", "Borland C++ 4.5 - Windows NT", | ||
21 | "BC-W31", "Borland C++ 4.5 - Windows 3.1 - PROBABLY NOT WORKING", | 34 | "BC-W31", "Borland C++ 4.5 - Windows 3.1 - PROBABLY NOT WORKING", |
22 | "BC-MSDOS","Borland C++ 4.5 - MSDOS", | 35 | "BC-MSDOS","Borland C++ 4.5 - MSDOS", |
23 | "linux-elf","Linux elf", | 36 | "linux-elf","Linux elf", |
37 | "ultrix-mips","DEC mips ultrix", | ||
24 | "FreeBSD","FreeBSD distribution", | 38 | "FreeBSD","FreeBSD distribution", |
25 | "default","cc under unix", | 39 | "default","cc under unix", |
26 | ); | 40 | ); |
27 | 41 | ||
28 | $type=""; | 42 | $platform=""; |
29 | foreach (@ARGV) | 43 | foreach (@ARGV) |
30 | { | 44 | { |
31 | if (/^no-rc2$/) { $no_rc2=1; } | 45 | if (!&read_options && !defined($ops{$_})) |
32 | elsif (/^no-rc4$/) { $no_rc4=1; } | ||
33 | elsif (/^no-rc5$/) { $no_rc5=1; } | ||
34 | elsif (/^no-idea$/) { $no_idea=1; } | ||
35 | elsif (/^no-des$/) { $no_des=1; } | ||
36 | elsif (/^no-bf$/) { $no_bf=1; } | ||
37 | elsif (/^no-cast$/) { $no_cast=1; } | ||
38 | elsif (/^no-md2$/) { $no_md2=1; } | ||
39 | elsif (/^no-md5$/) { $no_md5=1; } | ||
40 | elsif (/^no-sha$/) { $no_sha=1; } | ||
41 | elsif (/^no-sha1$/) { $no_sha1=1; } | ||
42 | elsif (/^no-rmd160$/) { $no_rmd160=1; } | ||
43 | elsif (/^no-mdc2$/) { $no_mdc2=1; } | ||
44 | elsif (/^no-patents$/) { $no_rc2=$no_rc4=$no_rc5=$no_idea=$no_rsa=1; } | ||
45 | elsif (/^no-rsa$/) { $no_rsa=1; } | ||
46 | elsif (/^no-dsa$/) { $no_dsa=1; } | ||
47 | elsif (/^no-dh$/) { $no_dh=1; } | ||
48 | elsif (/^no-asm$/) { $no_asm=1; } | ||
49 | elsif (/^no-ssl2$/) { $no_ssl2=1; } | ||
50 | elsif (/^no-ssl3$/) { $no_ssl3=1; } | ||
51 | elsif (/^no-err$/) { $no_err=1; } | ||
52 | elsif (/^no-sock$/) { $no_sock=1; } | ||
53 | |||
54 | elsif (/^just-ssl$/) { $no_rc2=$no_idea=$no_des=$no_bf=$no_cast=1; | ||
55 | $no_md2=$no_sha=$no_mdc2=$no_dsa=$no_dh=1; | ||
56 | $no_ssl2=$no_err=1; } | ||
57 | |||
58 | elsif (/^rsaref$/) { $rsaref=1; } | ||
59 | elsif (/^gcc$/) { $gcc=1; } | ||
60 | elsif (/^debug$/) { $debug=1; } | ||
61 | elsif (/^shlib$/) { $shlib=1; } | ||
62 | elsif (/^dll$/) { $shlib=1; } | ||
63 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } | ||
64 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } | ||
65 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) | ||
66 | { $c_flags.="$_ "; } | ||
67 | else | ||
68 | { | 46 | { |
69 | if (!defined($ops{$_})) | 47 | print STDERR "unknown option - $_\n"; |
70 | { | 48 | print STDERR "usage: perl mk1mf.pl [options] [system]\n"; |
71 | print STDERR "unknown option - $_\n"; | 49 | print STDERR "\nwhere [system] can be one of the following\n"; |
72 | print STDERR "usage: perl mk1mf.pl [system] [options]\n"; | 50 | foreach $i (sort keys %ops) |
73 | print STDERR "\nwhere [system] can be one of the following\n"; | 51 | { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; } |
74 | foreach $i (sort keys %ops) | 52 | print STDERR <<"EOF"; |
75 | { printf STDERR "\t%-10s\t%s\n",$i,$ops{$i}; } | ||
76 | print STDERR <<"EOF"; | ||
77 | and [options] can be one of | 53 | and [options] can be one of |
78 | no-md2 no-md5 no-sha no-sha1 no-mdc2 no-rmd160 - Skip this digest | 54 | no-md2 no-md5 no-sha no-mdc2 no-ripemd - Skip this digest |
79 | no-rc2 no-rc4 no-idea no-des no-bf no-cast - Skip this symetric cipher | 55 | no-rc2 no-rc4 no-idea no-des no-bf no-cast - Skip this symetric cipher |
80 | no-rc5 | 56 | no-rc5 |
81 | no-rsa no-dsa no-dh - Skip this public key cipher | 57 | no-rsa no-dsa no-dh - Skip this public key cipher |
82 | no-ssl2 no-ssl3 - Skip this version of SSL | 58 | no-ssl2 no-ssl3 - Skip this version of SSL |
83 | just-ssl - remove all non-ssl keys/digest | 59 | just-ssl - remove all non-ssl keys/digest |
84 | no-asm - No x86 asm | 60 | no-asm - No x86 asm |
61 | nasm - Use NASM for x86 asm | ||
85 | no-socks - No socket code | 62 | no-socks - No socket code |
86 | no-err - No error strings | 63 | no-err - No error strings |
87 | dll/shlib - Build shared libraries (MS) | 64 | dll/shlib - Build shared libraries (MS) |
@@ -96,15 +73,18 @@ TMP=tmpdir OUT=outdir SRC=srcdir BIN=binpath INC=header-outdir CC=C-compiler | |||
96 | -<ex_cc_flags> - extra 'cc' flags, | 73 | -<ex_cc_flags> - extra 'cc' flags, |
97 | added (MS), or replace (unix) | 74 | added (MS), or replace (unix) |
98 | EOF | 75 | EOF |
99 | exit(1); | 76 | exit(1); |
100 | } | ||
101 | $type=$_; | ||
102 | } | 77 | } |
78 | $platform=$_; | ||
79 | } | ||
80 | foreach (split / /, $OPTIONS) | ||
81 | { | ||
82 | print STDERR "unknown option - $_\n" if !&read_options; | ||
103 | } | 83 | } |
104 | 84 | ||
105 | $no_mdc2=1 if ($no_des); | 85 | $no_mdc2=1 if ($no_des); |
106 | 86 | ||
107 | $no_ssl3=1 if ($no_md5 || $no_sha1); | 87 | $no_ssl3=1 if ($no_md5 || $no_sha); |
108 | $no_ssl3=1 if ($no_rsa && $no_dh); | 88 | $no_ssl3=1 if ($no_rsa && $no_dh); |
109 | 89 | ||
110 | $no_ssl2=1 if ($no_md5 || $no_rsa); | 90 | $no_ssl2=1 if ($no_md5 || $no_rsa); |
@@ -114,6 +94,7 @@ $out_def="out"; | |||
114 | $inc_def="outinc"; | 94 | $inc_def="outinc"; |
115 | $tmp_def="tmp"; | 95 | $tmp_def="tmp"; |
116 | 96 | ||
97 | $mkdir="mkdir"; | ||
117 | 98 | ||
118 | ($ssl,$crypto)=("ssl","crypto"); | 99 | ($ssl,$crypto)=("ssl","crypto"); |
119 | $RSAglue="RSAglue"; | 100 | $RSAglue="RSAglue"; |
@@ -125,62 +106,79 @@ $bin_dir=(defined($VARS{'BIN'}))?$VARS{'BIN'}:''; | |||
125 | 106 | ||
126 | # $bin_dir.=$o causes a core dump on my sparc :-( | 107 | # $bin_dir.=$o causes a core dump on my sparc :-( |
127 | 108 | ||
109 | $NT=0; | ||
110 | |||
128 | push(@INC,"util/pl","pl"); | 111 | push(@INC,"util/pl","pl"); |
129 | if ($type eq "VC-MSDOS") | 112 | if ($platform eq "VC-MSDOS") |
130 | { | 113 | { |
131 | $asmbits=16; | 114 | $asmbits=16; |
132 | $msdos=1; | 115 | $msdos=1; |
133 | require 'VC-16.pl'; | 116 | require 'VC-16.pl'; |
134 | } | 117 | } |
135 | elsif ($type eq "VC-W31-16") | 118 | elsif ($platform eq "VC-W31-16") |
136 | { | 119 | { |
137 | $asmbits=16; | 120 | $asmbits=16; |
138 | $msdos=1; $win16=1; | 121 | $msdos=1; $win16=1; |
139 | require 'VC-16.pl'; | 122 | require 'VC-16.pl'; |
140 | } | 123 | } |
141 | elsif (($type eq "VC-W31-32") || ($type eq "VC-WIN16")) | 124 | elsif (($platform eq "VC-W31-32") || ($platform eq "VC-WIN16")) |
142 | { | 125 | { |
143 | $asmbits=32; | 126 | $asmbits=32; |
144 | $msdos=1; $win16=1; | 127 | $msdos=1; $win16=1; |
145 | require 'VC-16.pl'; | 128 | require 'VC-16.pl'; |
146 | } | 129 | } |
147 | elsif (($type eq "VC-WIN32") || ($type eq "VC-NT")) | 130 | elsif (($platform eq "VC-WIN32") || ($platform eq "VC-NT")) |
148 | { | 131 | { |
132 | $NT = 1 if $platform eq "VC-NT"; | ||
149 | require 'VC-32.pl'; | 133 | require 'VC-32.pl'; |
150 | } | 134 | } |
151 | elsif ($type eq "BC-NT") | 135 | elsif ($platform eq "Mingw32") |
136 | { | ||
137 | require 'Mingw32.pl'; | ||
138 | } | ||
139 | elsif ($platform eq "Mingw32-files") | ||
140 | { | ||
141 | require 'Mingw32f.pl'; | ||
142 | } | ||
143 | elsif ($platform eq "BC-NT") | ||
152 | { | 144 | { |
153 | $bc=1; | 145 | $bc=1; |
154 | require 'BC-32.pl'; | 146 | require 'BC-32.pl'; |
155 | } | 147 | } |
156 | elsif ($type eq "BC-W31") | 148 | elsif ($platform eq "BC-W31") |
157 | { | 149 | { |
158 | $bc=1; | 150 | $bc=1; |
159 | $msdos=1; $w16=1; | 151 | $msdos=1; $w16=1; |
160 | require 'BC-16.pl'; | 152 | require 'BC-16.pl'; |
161 | } | 153 | } |
162 | elsif ($type eq "BC-Q16") | 154 | elsif ($platform eq "BC-Q16") |
163 | { | 155 | { |
164 | $msdos=1; $w16=1; $shlib=0; $qw=1; | 156 | $msdos=1; $w16=1; $shlib=0; $qw=1; |
165 | require 'BC-16.pl'; | 157 | require 'BC-16.pl'; |
166 | } | 158 | } |
167 | elsif ($type eq "BC-MSDOS") | 159 | elsif ($platform eq "BC-MSDOS") |
168 | { | 160 | { |
169 | $asmbits=16; | 161 | $asmbits=16; |
170 | $msdos=1; | 162 | $msdos=1; |
171 | require 'BC-16.pl'; | 163 | require 'BC-16.pl'; |
172 | } | 164 | } |
173 | elsif ($type eq "FreeBSD") | 165 | elsif ($platform eq "FreeBSD") |
174 | { | 166 | { |
175 | require 'unix.pl'; | 167 | require 'unix.pl'; |
176 | $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer'; | 168 | $cflags='-DTERMIO -D_ANSI_SOURCE -O2 -fomit-frame-pointer'; |
177 | } | 169 | } |
178 | elsif ($type eq "linux-elf") | 170 | elsif ($platform eq "linux-elf") |
179 | { | 171 | { |
180 | require "unix.pl"; | 172 | require "unix.pl"; |
181 | require "linux.pl"; | 173 | require "linux.pl"; |
182 | $unix=1; | 174 | $unix=1; |
183 | } | 175 | } |
176 | elsif ($platform eq "ultrix-mips") | ||
177 | { | ||
178 | require "unix.pl"; | ||
179 | require "ultrix.pl"; | ||
180 | $unix=1; | ||
181 | } | ||
184 | else | 182 | else |
185 | { | 183 | { |
186 | require "unix.pl"; | 184 | require "unix.pl"; |
@@ -203,9 +201,9 @@ $cflags.=" -DNO_MD2" if $no_md2; | |||
203 | $cflags.=" -DNO_MD5" if $no_md5; | 201 | $cflags.=" -DNO_MD5" if $no_md5; |
204 | $cflags.=" -DNO_SHA" if $no_sha; | 202 | $cflags.=" -DNO_SHA" if $no_sha; |
205 | $cflags.=" -DNO_SHA1" if $no_sha1; | 203 | $cflags.=" -DNO_SHA1" if $no_sha1; |
206 | $cflags.=" -DNO_RMD160" if $no_rmd160; | 204 | $cflags.=" -DNO_RIPEMD" if $no_rmd160; |
207 | $cflags.=" -DNO_MDC2" if $no_mdc2; | 205 | $cflags.=" -DNO_MDC2" if $no_mdc2; |
208 | $cflags.=" -DNO_BLOWFISH" if $no_bf; | 206 | $cflags.=" -DNO_BF" if $no_bf; |
209 | $cflags.=" -DNO_CAST" if $no_cast; | 207 | $cflags.=" -DNO_CAST" if $no_cast; |
210 | $cflags.=" -DNO_DES" if $no_des; | 208 | $cflags.=" -DNO_DES" if $no_des; |
211 | $cflags.=" -DNO_RSA" if $no_rsa; | 209 | $cflags.=" -DNO_RSA" if $no_rsa; |
@@ -223,14 +221,9 @@ else { $cflags="$c_flags$cflags" if ($c_flags ne ""); } | |||
223 | 221 | ||
224 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); | 222 | $ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); |
225 | 223 | ||
226 | if ($ranlib ne "") | ||
227 | { | ||
228 | $ranlib="\$(SRC_D)$o$ranlib"; | ||
229 | } | ||
230 | |||
231 | if ($msdos) | 224 | if ($msdos) |
232 | { | 225 | { |
233 | $banner ="\t\@echo Make sure you have run 'perl Configure $type' in the\n"; | 226 | $banner ="\t\@echo Make sure you have run 'perl Configure $platform' in the\n"; |
234 | $banner.="\t\@echo top level directory, if you don't have perl, you will\n"; | 227 | $banner.="\t\@echo top level directory, if you don't have perl, you will\n"; |
235 | $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n"; | 228 | $banner.="\t\@echo need to probably edit crypto/bn/bn.h, check the\n"; |
236 | $banner.="\t\@echo documentation for details.\n"; | 229 | $banner.="\t\@echo documentation for details.\n"; |
@@ -242,8 +235,8 @@ $link="$bin_dir$link" if ($link !~ /^\$/); | |||
242 | $INSTALLTOP =~ s|/|$o|g; | 235 | $INSTALLTOP =~ s|/|$o|g; |
243 | 236 | ||
244 | $defs= <<"EOF"; | 237 | $defs= <<"EOF"; |
245 | # This makefile has been automatically generated from the SSLeay distribution. | 238 | # This makefile has been automatically generated from the OpenSSL distribution. |
246 | # This single makefile will build the complete SSLeay distribution and | 239 | # This single makefile will build the complete OpenSSL distribution and |
247 | # by default leave the 'intertesting' output files in .${o}out and the stuff | 240 | # by default leave the 'intertesting' output files in .${o}out and the stuff |
248 | # that needs deleting in .${o}tmp. | 241 | # that needs deleting in .${o}tmp. |
249 | # The file was generated by running 'make makefile.one', which | 242 | # The file was generated by running 'make makefile.one', which |
@@ -258,6 +251,7 @@ $defs= <<"EOF"; | |||
258 | INSTALLTOP=$INSTALLTOP | 251 | INSTALLTOP=$INSTALLTOP |
259 | 252 | ||
260 | # Set your compiler options | 253 | # Set your compiler options |
254 | PLATFORM=$platform | ||
261 | CC=$bin_dir${cc} | 255 | CC=$bin_dir${cc} |
262 | CFLAG=$cflags | 256 | CFLAG=$cflags |
263 | APP_CFLAG=$app_cflag | 257 | APP_CFLAG=$app_cflag |
@@ -269,18 +263,16 @@ SHLIB_EX_OBJ=$shlib_ex_obj | |||
269 | # be added | 263 | # be added |
270 | EX_LIBS=$ex_libs | 264 | EX_LIBS=$ex_libs |
271 | 265 | ||
272 | # The SSLeay directory | 266 | # The OpenSSL directory |
273 | SRC_D=$src_dir | 267 | SRC_D=$src_dir |
274 | 268 | ||
275 | LINK=$link | 269 | LINK=$link |
276 | LFLAGS=$lflags | 270 | LFLAGS=$lflags |
277 | 271 | ||
278 | BN_MULW_OBJ=$bn_mulw_obj | 272 | BN_ASM_OBJ=$bn_asm_obj |
279 | BN_MULW_SRC=$bn_mulw_src | 273 | BN_ASM_SRC=$bn_asm_src |
280 | DES_ENC_OBJ=$des_enc_obj | 274 | DES_ENC_OBJ=$des_enc_obj |
281 | DES_ENC_SRC=$des_enc_src | 275 | DES_ENC_SRC=$des_enc_src |
282 | DES_CRYPT_OBJ=$des_crypt_obj | ||
283 | DES_CRYPT_SRC=$des_crypt_src | ||
284 | BF_ENC_OBJ=$bf_enc_obj | 276 | BF_ENC_OBJ=$bf_enc_obj |
285 | BF_ENC_SRC=$bf_enc_src | 277 | BF_ENC_SRC=$bf_enc_src |
286 | CAST_ENC_OBJ=$cast_enc_obj | 278 | CAST_ENC_OBJ=$cast_enc_obj |
@@ -302,11 +294,12 @@ OUT_D=$out_dir | |||
302 | TMP_D=$tmp_dir | 294 | TMP_D=$tmp_dir |
303 | # The output directory for the header files | 295 | # The output directory for the header files |
304 | INC_D=$inc_dir | 296 | INC_D=$inc_dir |
297 | INCO_D=$inc_dir${o}openssl | ||
305 | 298 | ||
306 | CP=$cp | 299 | CP=$cp |
307 | RM=$rm | 300 | RM=$rm |
308 | RANLIB=$ranlib | 301 | RANLIB=$ranlib |
309 | MKDIR=mkdir | 302 | MKDIR=$mkdir |
310 | MKLIB=$bin_dir$mklib | 303 | MKLIB=$bin_dir$mklib |
311 | MLFLAGS=$mlflags | 304 | MLFLAGS=$mlflags |
312 | ASM=$bin_dir$asm | 305 | ASM=$bin_dir$asm |
@@ -315,7 +308,7 @@ ASM=$bin_dir$asm | |||
315 | # You should not need to touch anything below this point | 308 | # You should not need to touch anything below this point |
316 | ###################################################### | 309 | ###################################################### |
317 | 310 | ||
318 | E_EXE=ssleay | 311 | E_EXE=openssl |
319 | SSL=$ssl | 312 | SSL=$ssl |
320 | CRYPTO=$crypto | 313 | CRYPTO=$crypto |
321 | RSAGLUE=$RSAglue | 314 | RSAGLUE=$RSAglue |
@@ -323,6 +316,9 @@ RSAGLUE=$RSAglue | |||
323 | # BIN_D - Binary output directory | 316 | # BIN_D - Binary output directory |
324 | # TEST_D - Binary test file output directory | 317 | # TEST_D - Binary test file output directory |
325 | # LIB_D - library output directory | 318 | # LIB_D - library output directory |
319 | # Note: if you change these point to different directories then uncomment out | ||
320 | # the lines around the 'NB' comment below. | ||
321 | # | ||
326 | BIN_D=\$(OUT_D) | 322 | BIN_D=\$(OUT_D) |
327 | TEST_D=\$(OUT_D) | 323 | TEST_D=\$(OUT_D) |
328 | LIB_D=\$(OUT_D) | 324 | LIB_D=\$(OUT_D) |
@@ -337,8 +333,8 @@ O_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$shlibp | |||
337 | O_RSAGLUE= \$(LIB_D)$o$plib\$(RSAGLUE)$libp | 333 | O_RSAGLUE= \$(LIB_D)$o$plib\$(RSAGLUE)$libp |
338 | SO_SSL= $plib\$(SSL)$so_shlibp | 334 | SO_SSL= $plib\$(SSL)$so_shlibp |
339 | SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp | 335 | SO_CRYPTO= $plib\$(CRYPTO)$so_shlibp |
340 | L_SSL= \$(LIB_D)$o\$(SSL)$libp | 336 | L_SSL= \$(LIB_D)$o$plib\$(SSL)$libp |
341 | L_CRYPTO= \$(LIB_D)$o\$(CRYPTO)$libp | 337 | L_CRYPTO= \$(LIB_D)$o$plib\$(CRYPTO)$libp |
342 | 338 | ||
343 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) | 339 | L_LIBS= \$(L_SSL) \$(L_CRYPTO) |
344 | #L_LIBS= \$(O_SSL) \$(O_RSAGLUE) -lrsaref \$(O_CRYPTO) | 340 | #L_LIBS= \$(O_SSL) \$(O_RSAGLUE) -lrsaref \$(O_CRYPTO) |
@@ -357,23 +353,26 @@ LIBS_DEP=\$(O_CRYPTO) \$(O_RSAGLUE) \$(O_SSL) | |||
357 | EOF | 353 | EOF |
358 | 354 | ||
359 | $rules=<<"EOF"; | 355 | $rules=<<"EOF"; |
360 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INC_D) headers lib exe | 356 | all: banner \$(TMP_D) \$(BIN_D) \$(TEST_D) \$(LIB_D) \$(INCO_D) headers lib exe |
361 | 357 | ||
362 | banner: | 358 | banner: |
363 | $banner | 359 | $banner |
364 | 360 | ||
365 | \$(TMP_D): | 361 | \$(TMP_D): |
366 | \$(MKDIR) \$(TMP_D) | 362 | \$(MKDIR) \$(TMP_D) |
367 | 363 | # NB: uncomment out these lines if BIN_D, TEST_D and LIB_D are different | |
368 | \$(BIN_D): | 364 | #\$(BIN_D): |
369 | \$(MKDIR) \$(BIN_D) | 365 | # \$(MKDIR) \$(BIN_D) |
370 | 366 | # | |
371 | \$(TEST_D): | 367 | #\$(TEST_D): |
372 | \$(MKDIR) \$(TEST_D) | 368 | # \$(MKDIR) \$(TEST_D) |
373 | 369 | ||
374 | \$(LIB_D): | 370 | \$(LIB_D): |
375 | \$(MKDIR) \$(LIB_D) | 371 | \$(MKDIR) \$(LIB_D) |
376 | 372 | ||
373 | \$(INCO_D): \$(INC_D) | ||
374 | \$(MKDIR) \$(INCO_D) | ||
375 | |||
377 | \$(INC_D): | 376 | \$(INC_D): |
378 | \$(MKDIR) \$(INC_D) | 377 | \$(MKDIR) \$(INC_D) |
379 | 378 | ||
@@ -387,8 +386,9 @@ install: | |||
387 | \$(MKDIR) \$(INSTALLTOP) | 386 | \$(MKDIR) \$(INSTALLTOP) |
388 | \$(MKDIR) \$(INSTALLTOP)${o}bin | 387 | \$(MKDIR) \$(INSTALLTOP)${o}bin |
389 | \$(MKDIR) \$(INSTALLTOP)${o}include | 388 | \$(MKDIR) \$(INSTALLTOP)${o}include |
389 | \$(MKDIR) \$(INSTALLTOP)${o}include${o}openssl | ||
390 | \$(MKDIR) \$(INSTALLTOP)${o}lib | 390 | \$(MKDIR) \$(INSTALLTOP)${o}lib |
391 | \$(CP) \$(INC_D)${o}*.\[ch\] \$(INSTALLTOP)${o}include | 391 | \$(CP) \$(INCO_D)${o}*.\[ch\] \$(INSTALLTOP)${o}include${o}openssl |
392 | \$(CP) \$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin | 392 | \$(CP) \$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin |
393 | \$(CP) \$(O_SSL) \$(INSTALLTOP)${o}lib | 393 | \$(CP) \$(O_SSL) \$(INSTALLTOP)${o}lib |
394 | \$(CP) \$(O_CRYPTO) \$(INSTALLTOP)${o}lib | 394 | \$(CP) \$(O_CRYPTO) \$(INSTALLTOP)${o}lib |
@@ -401,6 +401,42 @@ vclean: | |||
401 | \$(RM) \$(OUT_D)$o*.* | 401 | \$(RM) \$(OUT_D)$o*.* |
402 | 402 | ||
403 | EOF | 403 | EOF |
404 | |||
405 | my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform"; | ||
406 | $platform_cpp_symbol =~ s/-/_/g; | ||
407 | if (open(IN,"crypto/buildinf.h")) | ||
408 | { | ||
409 | # Remove entry for this platform in existing file buildinf.h. | ||
410 | |||
411 | my $old_buildinf_h = ""; | ||
412 | while (<IN>) | ||
413 | { | ||
414 | if (/^\#ifdef $platform_cpp_symbol$/) | ||
415 | { | ||
416 | while (<IN>) { last if (/^\#endif/); } | ||
417 | } | ||
418 | else | ||
419 | { | ||
420 | $old_buildinf_h .= $_; | ||
421 | } | ||
422 | } | ||
423 | close(IN); | ||
424 | |||
425 | open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h"; | ||
426 | print OUT $old_buildinf_h; | ||
427 | close(OUT); | ||
428 | } | ||
429 | |||
430 | open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h"; | ||
431 | printf OUT <<EOF; | ||
432 | #ifdef $platform_cpp_symbol | ||
433 | /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */ | ||
434 | #define CFLAGS "$cc $cflags" | ||
435 | #define PLATFORM "$platform" | ||
436 | EOF | ||
437 | printf OUT " #define DATE \"%s\"\n", scalar gmtime(); | ||
438 | printf OUT "#endif\n"; | ||
439 | close(OUT); | ||
404 | 440 | ||
405 | ############################################# | 441 | ############################################# |
406 | # We parse in input file and 'store' info for later printing. | 442 | # We parse in input file and 'store' info for later printing. |
@@ -468,8 +504,8 @@ chop($h); $header=$h; | |||
468 | $defs.=&do_defs("HEADER",$header,"\$(INCL_D)",".h"); | 504 | $defs.=&do_defs("HEADER",$header,"\$(INCL_D)",".h"); |
469 | $rules.=&do_copy_rule("\$(INCL_D)",$header,".h"); | 505 | $rules.=&do_copy_rule("\$(INCL_D)",$header,".h"); |
470 | 506 | ||
471 | $defs.=&do_defs("EXHEADER",$exheader,"\$(INC_D)",".h"); | 507 | $defs.=&do_defs("EXHEADER",$exheader,"\$(INCO_D)",".h"); |
472 | $rules.=&do_copy_rule("\$(INC_D)",$exheader,".h"); | 508 | $rules.=&do_copy_rule("\$(INCO_D)",$exheader,".h"); |
473 | 509 | ||
474 | $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj); | 510 | $defs.=&do_defs("T_OBJ",$test,"\$(OBJ_D)",$obj); |
475 | $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); | 511 | $rules.=&do_compile_rule("\$(OBJ_D)",$test,"\$(APP_CFLAGS)"); |
@@ -496,10 +532,10 @@ foreach (values %lib_nam) | |||
496 | next; | 532 | next; |
497 | } | 533 | } |
498 | 534 | ||
499 | if (($bn_mulw_obj ne "") && ($_ eq "CRYPTO")) | 535 | if (($bn_asm_obj ne "") && ($_ eq "CRYPTO")) |
500 | { | 536 | { |
501 | $lib_obj =~ s/\s\S*\/bn_mulw\S*/ \$(BN_MULW_OBJ)/; | 537 | $lib_obj =~ s/\s\S*\/bn_asm\S*/ \$(BN_ASM_OBJ)/; |
502 | $rules.=&do_asm_rule($bn_mulw_obj,$bn_mulw_src); | 538 | $rules.=&do_asm_rule($bn_asm_obj,$bn_asm_src); |
503 | } | 539 | } |
504 | if (($des_enc_obj ne "") && ($_ eq "CRYPTO")) | 540 | if (($des_enc_obj ne "") && ($_ eq "CRYPTO")) |
505 | { | 541 | { |
@@ -615,6 +651,7 @@ sub var_add | |||
615 | 651 | ||
616 | @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2; | 652 | @a=grep(!/(^md2)|(_md2$)/,@a) if $no_md2; |
617 | @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5; | 653 | @a=grep(!/(^md5)|(_md5$)/,@a) if $no_md5; |
654 | @a=grep(!/(rmd)|(ripemd)/,@a) if $no_rmd160; | ||
618 | 655 | ||
619 | @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa; | 656 | @a=grep(!/(^d2i_r_)|(^i2d_r_)/,@a) if $no_rsa; |
620 | @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa; | 657 | @a=grep(!/(^p_open$)|(^p_seal$)/,@a) if $no_rsa; |
@@ -631,7 +668,7 @@ sub var_add | |||
631 | @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; | 668 | @a=grep(!/(^sha1)|(_sha1$)|(m_dss1$)/,@a) if $no_sha1; |
632 | @a=grep(!/_mdc2$/,@a) if $no_mdc2; | 669 | @a=grep(!/_mdc2$/,@a) if $no_mdc2; |
633 | 670 | ||
634 | @a=grep(!/(^rsa$)|(^genrsa$)|(^req$)|(^ca$)/,@a) if $no_rsa; | 671 | @a=grep(!/(^rsa$)|(^genrsa$)/,@a) if $no_rsa; |
635 | @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; | 672 | @a=grep(!/(^dsa$)|(^gendsa$)|(^dsaparam$)/,@a) if $no_dsa; |
636 | @a=grep(!/^gendsa$/,@a) if $no_sha1; | 673 | @a=grep(!/^gendsa$/,@a) if $no_sha1; |
637 | @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh; | 674 | @a=grep(!/(^dh$)|(^gendh$)/,@a) if $no_dh; |
@@ -677,7 +714,7 @@ sub do_defs | |||
677 | if (($_ =~ /bss_file/) && ($postfix eq ".h")) | 714 | if (($_ =~ /bss_file/) && ($postfix eq ".h")) |
678 | { $pf=".c"; } | 715 | { $pf=".c"; } |
679 | else { $pf=$postfix; } | 716 | else { $pf=$postfix; } |
680 | if ($_ =~ /BN_MULW/) { $t="$_ "; } | 717 | if ($_ =~ /BN_ASM/) { $t="$_ "; } |
681 | elsif ($_ =~ /DES_ENC/) { $t="$_ "; } | 718 | elsif ($_ =~ /DES_ENC/) { $t="$_ "; } |
682 | elsif ($_ =~ /BF_ENC/) { $t="$_ "; } | 719 | elsif ($_ =~ /BF_ENC/) { $t="$_ "; } |
683 | elsif ($_ =~ /CAST_ENC/){ $t="$_ "; } | 720 | elsif ($_ =~ /CAST_ENC/){ $t="$_ "; } |
@@ -704,23 +741,6 @@ sub bname | |||
704 | return($ret); | 741 | return($ret); |
705 | } | 742 | } |
706 | 743 | ||
707 | # do a rule for each file that says 'copy' to new direcory on change | ||
708 | sub do_copy_rule | ||
709 | { | ||
710 | local($to,$files,$p)=@_; | ||
711 | local($ret,$_,$n,$pp); | ||
712 | |||
713 | $files =~ s/\//$o/g if $o ne '/'; | ||
714 | foreach (split(/\s+/,$files)) | ||
715 | { | ||
716 | $n=&bname($_); | ||
717 | if ($n =~ /bss_file/) | ||
718 | { $pp=".c"; } | ||
719 | else { $pp=$p; } | ||
720 | $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \$(SRC_D)$o$_$pp $to${o}$n$pp\n\n"; | ||
721 | } | ||
722 | return($ret); | ||
723 | } | ||
724 | 744 | ||
725 | ############################################################## | 745 | ############################################################## |
726 | # do a rule for each file that says 'compile' to new direcory | 746 | # do a rule for each file that says 'compile' to new direcory |
@@ -746,8 +766,7 @@ sub cc_compile_target | |||
746 | local($target,$source,$ex_flags)=@_; | 766 | local($target,$source,$ex_flags)=@_; |
747 | local($ret); | 767 | local($ret); |
748 | 768 | ||
749 | # EAY EAY | 769 | $ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/); |
750 | $ex_flags.=' -DCFLAGS="\"$(CC) $(CFLAG)\""' if ($source =~ /cversion/); | ||
751 | $target =~ s/\//$o/g if $o ne "/"; | 770 | $target =~ s/\//$o/g if $o ne "/"; |
752 | $source =~ s/\//$o/g if $o ne "/"; | 771 | $source =~ s/\//$o/g if $o ne "/"; |
753 | $ret ="$target: \$(SRC_D)$o$source\n\t"; | 772 | $ret ="$target: \$(SRC_D)$o$source\n\t"; |
@@ -791,3 +810,64 @@ sub do_shlib_rule | |||
791 | return($ret); | 810 | return($ret); |
792 | } | 811 | } |
793 | 812 | ||
813 | # do a rule for each file that says 'copy' to new direcory on change | ||
814 | sub do_copy_rule | ||
815 | { | ||
816 | local($to,$files,$p)=@_; | ||
817 | local($ret,$_,$n,$pp); | ||
818 | |||
819 | $files =~ s/\//$o/g if $o ne '/'; | ||
820 | foreach (split(/\s+/,$files)) | ||
821 | { | ||
822 | $n=&bname($_); | ||
823 | if ($n =~ /bss_file/) | ||
824 | { $pp=".c"; } | ||
825 | else { $pp=$p; } | ||
826 | $ret.="$to${o}$n$pp: \$(SRC_D)$o$_$pp\n\t\$(CP) \$(SRC_D)$o$_$pp $to${o}$n$pp\n\n"; | ||
827 | } | ||
828 | return($ret); | ||
829 | } | ||
830 | |||
831 | sub read_options | ||
832 | { | ||
833 | if (/^no-rc2$/) { $no_rc2=1; } | ||
834 | elsif (/^no-rc4$/) { $no_rc4=1; } | ||
835 | elsif (/^no-rc5$/) { $no_rc5=1; } | ||
836 | elsif (/^no-idea$/) { $no_idea=1; } | ||
837 | elsif (/^no-des$/) { $no_des=1; } | ||
838 | elsif (/^no-bf$/) { $no_bf=1; } | ||
839 | elsif (/^no-cast$/) { $no_cast=1; } | ||
840 | elsif (/^no-md2$/) { $no_md2=1; } | ||
841 | elsif (/^no-md5$/) { $no_md5=1; } | ||
842 | elsif (/^no-sha$/) { $no_sha=1; } | ||
843 | elsif (/^no-sha1$/) { $no_sha1=1; } | ||
844 | elsif (/^no-ripemd$/) { $no_ripemd=1; } | ||
845 | elsif (/^no-mdc2$/) { $no_mdc2=1; } | ||
846 | elsif (/^no-patents$/) { $no_rc2=$no_rc4=$no_rc5=$no_idea=$no_rsa=1; } | ||
847 | elsif (/^no-rsa$/) { $no_rsa=1; } | ||
848 | elsif (/^no-dsa$/) { $no_dsa=1; } | ||
849 | elsif (/^no-dh$/) { $no_dh=1; } | ||
850 | elsif (/^no-hmac$/) { $no_hmac=1; } | ||
851 | elsif (/^no-asm$/) { $no_asm=1; } | ||
852 | elsif (/^nasm$/) { $nasm=1; } | ||
853 | elsif (/^no-ssl2$/) { $no_ssl2=1; } | ||
854 | elsif (/^no-ssl3$/) { $no_ssl3=1; } | ||
855 | elsif (/^no-err$/) { $no_err=1; } | ||
856 | elsif (/^no-sock$/) { $no_sock=1; } | ||
857 | |||
858 | elsif (/^just-ssl$/) { $no_rc2=$no_idea=$no_des=$no_bf=$no_cast=1; | ||
859 | $no_md2=$no_sha=$no_mdc2=$no_dsa=$no_dh=1; | ||
860 | $no_ssl2=$no_err=$no_rmd160=$no_rc5=1; } | ||
861 | |||
862 | elsif (/^rsaref$/) { $rsaref=1; } | ||
863 | elsif (/^gcc$/) { $gcc=1; } | ||
864 | elsif (/^debug$/) { $debug=1; } | ||
865 | elsif (/^shlib$/) { $shlib=1; } | ||
866 | elsif (/^dll$/) { $shlib=1; } | ||
867 | elsif (/^([^=]*)=(.*)$/){ $VARS{$1}=$2; } | ||
868 | elsif (/^-[lL].*$/) { $l_flags.="$_ "; } | ||
869 | elsif ((!/^-help/) && (!/^-h/) && (!/^-\?/) && /^-.*$/) | ||
870 | { $c_flags.="$_ "; } | ||
871 | else { return(0); } | ||
872 | return(1); | ||
873 | } | ||