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