1# $FreeBSD$ 2# Use this to help generate the asm *.S files after an import. It is not 3# perfect by any means, but does what is needed. 4# Do a 'make -f Makefile.asm all' and it will generate *.S. Move them 5# to the arch subdir, and correct any exposed paths and $ FreeBSD $ tags. 6 7.include "Makefile.inc" 8 9.if defined(ASM_aarch64) 10 11.PATH: ${LCRYPTO_SRC}/crypto \ 12 ${LCRYPTO_SRC}/crypto/aes/asm \ 13 ${LCRYPTO_SRC}/crypto/bn/asm \ 14 ${LCRYPTO_SRC}/crypto/chacha/asm \ 15 ${LCRYPTO_SRC}/crypto/ec/asm \ 16 ${LCRYPTO_SRC}/crypto/modes/asm \ 17 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 18 ${LCRYPTO_SRC}/crypto/sha/asm 19 20PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm 21 22# cpuid 23SRCS= arm64cpuid.pl 24 25# aes 26SRCS+= aesv8-armx.pl vpaes-armv8.pl 27 28# bn 29SRCS+= armv8-mont.pl 30 31# chacha 32SRCS+= chacha-armv8.pl 33 34# ec 35SRCS+= ecp_nistz256-armv8.pl 36 37# modes 38SRCS+= ghashv8-armx.pl 39 40# poly1305 41SRCS+= poly1305-armv8.pl 42 43# sha 44SRCS+= keccak1600-armv8.pl sha1-armv8.pl sha512-armv8.pl 45 46ASM= ${SRCS:R:S/$/.S/} sha256-armv8.S 47 48all: ${ASM} 49 50CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/} sha256-armv8.s 51.SUFFIXES: .pl 52 53sha256-armv8.S: sha512-armv8.pl 54 env CC=cc perl ${.ALLSRC} linux64 ${.TARGET:R:S/$/.s/} 55 ( echo '/* $$'FreeBSD'$$ */' ;\ 56 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 57 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 58 59.pl.S: 60 env CC=cc perl ${.IMPSRC} linux64 ${.TARGET:R:S/$/.s/} 61 ( echo '/* $$'FreeBSD'$$ */' ;\ 62 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\ 63 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 64 65.elif defined(ASM_amd64) 66 67.PATH: ${LCRYPTO_SRC}/crypto \ 68 ${LCRYPTO_SRC}/crypto/aes/asm \ 69 ${LCRYPTO_SRC}/crypto/bn/asm \ 70 ${LCRYPTO_SRC}/crypto/camellia/asm \ 71 ${LCRYPTO_SRC}/crypto/chacha/asm \ 72 ${LCRYPTO_SRC}/crypto/ec/asm \ 73 ${LCRYPTO_SRC}/crypto/md5/asm \ 74 ${LCRYPTO_SRC}/crypto/modes/asm \ 75 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 76 ${LCRYPTO_SRC}/crypto/rc4/asm \ 77 ${LCRYPTO_SRC}/crypto/sha/asm \ 78 ${LCRYPTO_SRC}/crypto/whrlpool/asm \ 79 ${LCRYPTO_SRC}/engines/asm 80 81# cpuid 82SRCS+= x86_64cpuid.pl 83 84# aes 85SRCS= aesni-mb-x86_64.pl aesni-sha1-x86_64.pl aesni-sha256-x86_64.pl \ 86 aesni-x86_64.pl vpaes-x86_64.pl 87 88# bn 89SRCS+= rsaz-avx2.pl rsaz-x86_64.pl x86_64-gf2m.pl x86_64-mont.pl \ 90 x86_64-mont5.pl 91 92# camellia 93SRCS+= cmll-x86_64.pl 94 95# chacha 96SRCS+= chacha-x86_64.pl 97 98# ec 99SRCS+= ecp_nistz256-x86_64.pl x25519-x86_64.pl 100 101# md5 102SRCS+= md5-x86_64.pl 103 104# modes 105SRCS+= aesni-gcm-x86_64.pl ghash-x86_64.pl 106 107# poly1305 108SRCS+= poly1305-x86_64.pl 109 110# rc4 111SRCS+= rc4-md5-x86_64.pl rc4-x86_64.pl 112 113# sha 114SRCS+= keccak1600-x86_64.pl sha1-mb-x86_64.pl sha1-x86_64.pl \ 115 sha256-mb-x86_64.pl 116 117# whrlpool 118SRCS+= wp-x86_64.pl 119 120# engines 121SRCS+= e_padlock-x86_64.pl 122 123SHA_ASM= sha256-x86_64 sha512-x86_64 124SHA_SRC= sha512-x86_64.pl 125SHA_TMP= ${SHA_ASM:S/$/.s/} 126 127ASM= ${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/} 128 129all: ${ASM} 130 131CLEANFILES= ${ASM} ${SHA_ASM:S/$/.s/} 132.SUFFIXES: .pl 133 134.pl.S: 135 ( echo '/* $$'FreeBSD'$$ */' ;\ 136 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\ 137 env CC=cc perl ${.IMPSRC} elf ) > ${.TARGET} 138 139${SHA_TMP}: ${SHA_SRC} 140 env CC=cc perl ${.ALLSRC} elf ${.TARGET} 141 142.for s in ${SHA_ASM} 143${s}.S: ${s}.s 144 ( echo '/* $$'FreeBSD'$$ */' ;\ 145 echo '/* Do not modify. This file is auto-generated from ${SHA_SRC}. */' ;\ 146 cat ${s}.s ) > ${.TARGET} 147.endfor 148 149.elif defined(ASM_arm) 150 151.PATH: ${LCRYPTO_SRC}/crypto \ 152 ${LCRYPTO_SRC}/crypto/aes/asm \ 153 ${LCRYPTO_SRC}/crypto/bn/asm \ 154 ${LCRYPTO_SRC}/crypto/chacha/asm \ 155 ${LCRYPTO_SRC}/crypto/ec/asm \ 156 ${LCRYPTO_SRC}/crypto/modes/asm \ 157 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 158 ${LCRYPTO_SRC}/crypto/sha/asm 159 160PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm 161 162# cpuid 163SRCS= armv4cpuid.pl 164 165# aes 166SRCS+= aes-armv4.pl aesv8-armx.pl bsaes-armv7.pl 167 168# bn 169SRCS+= armv4-mont.pl armv4-gf2m.pl 170 171# chacha 172SRCS+= chacha-armv4.pl 173 174# ec 175SRCS+= ecp_nistz256-armv4.pl 176 177# modes 178SRCS+= ghash-armv4.pl ghashv8-armx.pl 179 180# poly1305 181SRCS+= poly1305-armv4.pl 182 183# sha 184SRCS+= keccak1600-armv4.pl sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl 185 186ASM= aes-armv4.S ${SRCS:R:S/$/.S/} 187 188all: ${ASM} 189 190CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/} 191.SUFFIXES: .pl 192 193aes-armv4.S: aes-armv4.pl 194 ( echo '/* $$'FreeBSD'$$ */' ;\ 195 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\ 196 env CC=cc perl ${.ALLSRC} linux32 ) > ${.TARGET} 197 198.pl.S: 199 env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/} 200 ( echo '/* $$'FreeBSD'$$ */' ;\ 201 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\ 202 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 203 204.elif defined(ASM_i386) 205 206.PATH: ${LCRYPTO_SRC}/crypto \ 207 ${LCRYPTO_SRC}/crypto/aes/asm \ 208 ${LCRYPTO_SRC}/crypto/bf/asm \ 209 ${LCRYPTO_SRC}/crypto/bn/asm \ 210 ${LCRYPTO_SRC}/crypto/camellia/asm \ 211 ${LCRYPTO_SRC}/crypto/cast/asm \ 212 ${LCRYPTO_SRC}/crypto/chacha/asm \ 213 ${LCRYPTO_SRC}/crypto/des/asm \ 214 ${LCRYPTO_SRC}/crypto/ec/asm \ 215 ${LCRYPTO_SRC}/crypto/md5/asm \ 216 ${LCRYPTO_SRC}/crypto/modes/asm \ 217 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 218 ${LCRYPTO_SRC}/crypto/rc4/asm \ 219 ${LCRYPTO_SRC}/crypto/rc5/asm \ 220 ${LCRYPTO_SRC}/crypto/ripemd/asm \ 221 ${LCRYPTO_SRC}/crypto/sha/asm \ 222 ${LCRYPTO_SRC}/crypto/whrlpool/asm \ 223 ${LCRYPTO_SRC}/engines/asm 224 225#PERLPATH= -I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm 226 227# cpuid 228SRCS= x86cpuid.pl 229 230# aes 231SRCS+= aesni-x86.pl vpaes-x86.pl 232 233# blowfish 234SRCS+= bf-586.pl 235 236# bn 237SRCS+= bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl 238 239# camellia 240SRCS+= cmll-x86.pl 241 242# cast 243SRCS+= cast-586.pl 244 245# chacha 246SRCS+= chacha-x86.pl 247 248# des 249SRCS+= crypt586.pl des-586.pl 250 251# ec 252SRCS+= ecp_nistz256-x86.pl 253 254# md5 255SRCS+= md5-586.pl 256 257# modes 258SRCS+= ghash-x86.pl 259 260# poly1305 261SRCS+= poly1305-x86.pl 262 263# rc4 264SRCS+= rc4-586.pl 265 266# rc5 267SRCS+= rc5-586.pl 268 269# ripemd 270SRCS+= rmd-586.pl 271 272# sha 273SRCS+= sha1-586.pl sha256-586.pl sha512-586.pl 274 275# whrlpool 276SRCS+= wp-mmx.pl 277 278# engines 279SRCS+= e_padlock-x86.pl 280 281ASM= ${SRCS:R:S/$/.S/} 282 283all: ${ASM} 284 285CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/} 286.SUFFIXES: .pl 287 288.pl.S: 289 ( echo '/* $$'FreeBSD'$$ */' ;\ 290 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\ 291 echo '#ifdef PIC' ;\ 292 env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ${.IMPSRC:R:S/$/.s/} ;\ 293 cat ${.IMPSRC:R:S/$/.s/} ;\ 294 echo '#else' ;\ 295 env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ${.IMPSRC:R:S/$/.s/} ;\ 296 cat ${.IMPSRC:R:S/$/.s/} ;\ 297 echo '#endif' ) > ${.TARGET} 298.endif 299 300.include <bsd.prog.mk> 301