1# $NetBSD: Makefile.inc,v 1.5 2022/08/06 21:31:33 riastradh Exp $
2
3.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \
4	|| ${LIB} == "rump")
5
6.for op in add and cas nand or sub swap xor
7.for sz in 8 16 32 64
8SRCS.atomic+=	atomic_${op}_${sz}.S
9.endfor
10.endfor
11SRCS.atomic+=	atomic_dec_32.S atomic_dec_64.S
12SRCS.atomic+=	atomic_inc_32.S atomic_inc_64.S
13SRCS.atomic+=	membar_ops.S
14#and cas nand or sub swap xor
15.for op in swp cas clr set eor add
16.for sz in 1 2 4 8
17.for ar in _relax _acq _rel _acq_rel _sync
18__aarch64_${op}${sz}${ar}.S: __aarch64_lse.S
19	${_MKTARGET_CREATE}
20	printf '#define OP ${op}\n#define OP_${op}\n#define SZ ${sz}\n#define AR ${ar}\n#define AR${ar}\n#include "__aarch64_lse.S"\n' > ${.TARGET}
21SRCS.gen+=	__aarch64_${op}${sz}${ar}.S
22.endfor
23.endfor
24.endfor
25.for op in casp
26.for ar in _relax _acq _rel _acq_rel _sync
27__aarch64_${op}${ar}.S: __aarch64_lse.S
28	${_MKTARGET_CREATE}
29	printf '#define OP ${op}\n#define OP_${op}\n#define AR ${ar}\n#define AR${ar}\n#include "__aarch64_lse.S"\n' > ${.TARGET}
30SRCS.gen+=	__aarch64_${op}${ar}.S
31.endfor
32.endfor
33#.for op in add and nand or sub xor
34#SRCS.atomic+=	sync_fetch_and_${op}_8.S
35#.endfor
36#.for sz in 1 2 4 8
37#SRCS.atomic+=	sync_bool_compare_and_swap_${sz}.S
38#.endfor
39
40.endif
41
42SRCS.atomic+=	atomic_init_cas.c
43
44SRCS+=		${SRCS.atomic} ${SRCS.gen}
45CLEANFILES+=	${SRCS.gen}
46