| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 | ## Copyright 2021 ByteDance Inc.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at##     http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.#ARCH			:= avx avx2 sseTMP_DIR			:= outputOUT_DIR			:= internal/nativeSRC_FILE		:= native/native.cCPU_avx			:= amd64CPU_avx2		:= amd64CPU_sse  		:= amd64TMPL_avx		:= fastint_amd64_test fastfloat_amd64_test native_amd64_test recover_amd64_testTMPL_avx2		:= fastint_amd64_test fastfloat_amd64_test native_amd64_test recover_amd64_testTMPL_sse 		:= fastint_amd64_test fastfloat_amd64_test native_amd64_test recover_amd64_testCFLAGS_avx		:= -msse -mno-sse4 -mavx -mpclmul -mno-avx2 -mstack-alignment=0 -DUSE_AVX=1 -DUSE_AVX2=0CFLAGS_avx2		:= -msse -mno-sse4 -mavx -mpclmul -mavx2 -mstack-alignment=0 -DUSE_AVX=1 -DUSE_AVX2=1 CFLAGS_sse		:= -msse -mno-sse4 -mno-avx -mno-avx2 -mpclmulCC_amd64		:= clangASM2ASM_amd64	:= tools/asm2asm/asm2asm.pyCFLAGS			:= -mno-red-zoneCFLAGS			+= -target x86_64-apple-macos11CFLAGS			+= -fno-asynchronous-unwind-tablesCFLAGS			+= -fno-builtinCFLAGS			+= -fno-exceptionsCFLAGS			+= -fno-rttiCFLAGS			+= -fno-stack-protectorCFLAGS			+= -nostdlibCFLAGS			+= -O3CFLAGS			+= -Wall -WerrorNATIVE_SRC		:= $(wildcard native/*.h)NATIVE_SRC		+= $(wildcard native/*.c).PHONY: all clean ${ARCH}define build_tmpl	$(eval @arch := $(1))	$(eval @tmpl := $(2))	$(eval @dest := $(3))${@dest}: ${@tmpl}	mkdir -p $(dir ${@dest})	echo '// Code generated by Makefile, DO NOT EDIT.' > ${@dest}	echo >> ${@dest}	sed -e 's/{{PACKAGE}}/${@arch}/g' ${@tmpl} >> ${@dest}endefdefine build_arch	$(eval @cpu		:= $(value CPU_$(1)))	$(eval @deps	:= $(foreach tmpl,$(value TMPL_$(1)),${OUT_DIR}/$(1)/${tmpl}.go))	$(eval @asmin	:= ${TMP_DIR}/$(1)/native.s)	$(eval @asmout	:= ${OUT_DIR}/$(1)/native_text_${@cpu}.go)	$(eval @stubin	:= ${OUT_DIR}/native_${@cpu}.tmpl)	$(eval @stubout	:= ${OUT_DIR}/$(1)/native_${@cpu}.go)$(1): ${@asmout} ${@deps}${@asmout}: ${@stubout} ${NATIVE_SRC}	mkdir -p ${TMP_DIR}/$(1)	$${CC_${@cpu}} $${CFLAGS} $${CFLAGS_$(1)} -S -o ${TMP_DIR}/$(1)/native.s ${SRC_FILE}	python3 $${ASM2ASM_${@cpu}} -r ${@stubout} ${TMP_DIR}/$(1)/native.s$(eval $(call 	\	build_tmpl,	\	$(1),		\	${@stubin},	\	${@stubout}	\))$(foreach 							\	tmpl,							\	$(value TMPL_$(1)),				\	$(eval $(call 					\		build_tmpl,					\		$(1),						\		${OUT_DIR}/${tmpl}.tmpl,	\		${OUT_DIR}/$(1)/${tmpl}.go	\	))								\)endefall: ${ARCH}clean:	for arch in ${ARCH}; do \		rm -vfr ${TMP_DIR}/$${arch}; \		rm -vfr ${OUT_DIR}/$${arch}; \	done$(foreach 								\	arch,								\	${ARCH},							\	$(eval $(call build_arch,${arch}))	\)
 |