3 # unix.pl - the standard unix makefile stuff.
16 { $cflags="-g2 -ggdb"; }
18 { $cflags="-O3 -fomit-frame-pointer"; }
39 # static library stuff
42 $ranlib=&which("ranlib") or $ranlib="true";
58 'md5-x86_64' => 'crypto/md5',
59 'x86_64-mont' => 'crypto/bn',
60 'x86_64-mont5' => 'crypto/bn',
61 'x86_64-gf2m' => 'crypto/bn',
62 'aes-x86_64' => 'crypto/aes',
63 'vpaes-x86_64' => 'crypto/aes',
64 'bsaes-x86_64' => 'crypto/aes',
65 'aesni-x86_64' => 'crypto/aes',
66 'aesni-sha1-x86_64' => 'crypto/aes',
67 'sha1-x86_64' => 'crypto/sha',
68 'e_padlock-x86_64' => 'engines',
69 'rc4-x86_64' => 'crypto/rc4',
70 'rc4-md5-x86_64' => 'crypto/rc4',
71 'ghash-x86_64' => 'crypto/modes',
72 'aesni-gcm-x86_64' => 'crypto/modes',
73 'aesni-sha256-x86_64' => 'crypto/aes',
74 'rsaz-x86_64' => 'crypto/bn',
75 'rsaz-avx2' => 'crypto/bn',
76 'aesni-mb-x86_64' => 'crypto/aes',
77 'sha1-mb-x86_64' => 'crypto/sha',
78 'sha256-mb-x86_64' => 'crypto/sha',
79 'ecp_nistz256-x86_64' => 'crypto/ec',
80 'wp-x86_64' => 'crypto/whrlpool',
81 'cmll-x86_64' => 'crypto/camellia',
84 # If I were feeling more clever, these could probably be extracted
86 sub platform_perlasm_compile_target
88 local($target, $source, $bname) = @_;
92 # FIXME: export CC so rsaz-avx2 can test for it, since BSD make does
93 # not export variables, unlike GNU make. But this also requires fixing
94 # the .s.o rule to use CC!
95 if ($target eq "\$(OBJ_D)/$p.o")
98 \$(TMP_D)/$p.s: $perl1{$p}/asm/$p.pl
99 \$(PERL) $perl1{$p}/asm/$p.pl \$(PERLASM_SCHEME) > \$@
103 if ($target eq '$(OBJ_D)/x86_64cpuid.o')
106 $(TMP_D)/x86_64cpuid.s: crypto/x86_64cpuid.pl
107 $(PERL) crypto/x86_64cpuid.pl $(PERLASM_SCHEME) > $@
110 elsif ($target eq '$(OBJ_D)/sha256-x86_64.o')
113 $(TMP_D)/sha256-x86_64.s: crypto/sha/asm/sha512-x86_64.pl
114 $(PERL) crypto/sha/asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@
117 elsif ($target eq '$(OBJ_D)/sha512-x86_64.o')
120 $(TMP_D)/sha512-x86_64.s: crypto/sha/asm/sha512-x86_64.pl
121 $(PERL) crypto/sha/asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@
124 elsif ($target eq '$(OBJ_D)/sha512-x86_64.o')
127 $(TMP_D)/sha512-x86_64.s: crypto/sha/asm/sha512-x86_64.pl
128 $(PERL) crypto/sha/asm/sha512-x86_64.pl $(PERLASM_SCHEME) $@
135 sub special_compile_target
139 if ($target eq 'crypto/bn/x86_64-gcc')
142 \$(TMP_D)/x86_64-gcc.o: crypto/bn/asm/x86_64-gcc.c
143 \$(CC) \$(LIB_CFLAGS) -c -o \$@ crypto/bn/asm/x86_64-gcc.c
151 local($obj,$target,$name,$shlib)=@_;
152 local($ret,$_,$Name);
154 $target =~ s/\//$o/g if $o ne '/';
156 ($Name=$name) =~ tr/a-z/A-Z/;
158 $ret.="$target: \$(${Name}OBJ)\n";
159 $ret.="\t\$(RM) $target\n";
160 $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
161 $ret.="\t\$(RANLIB) $target\n\n";
166 local($target,$files,$dep_libs,$libs)=@_;
169 $file =~ s/\//$o/g if $o ne '/';
171 $ret.="$target: $files $dep_libs\n";
172 $ret.="\t\$(LINK_CMD) ${efile}$target \$(LFLAGS) $files $libs\n\n";
180 foreach $path (split /:/, $ENV{PATH})
182 if (-x "$path/$name")
184 return "$path/$name";
190 my ($target, $deps) = @_;
193 (OPENSSL="`pwd`/util/opensslwrap.sh"; \\
194 OPENSSL_DEBUG_MEMORY=on; \\
195 export OPENSSL OPENSSL_DEBUG_MEMORY; \\
196 \$(PERL) \$(BIN_D)${o}c_rehash certs/demo; \\
202 my ($target, $deps, $test_cmd) = @_;
204 $target: $deps force.$target
205 TOP=. BIN_D=\$(BIN_D) TEST_D=\$(TEST_D) \\
206 PERL=\$(PERL) \$(PERL) test/$test_cmd \$(TESTS)