1#	$NetBSD: Makefile.inc,v 1.29 2015/06/07 15:06:24 matt Exp $
2
3.ifnmake obj
4.include "${NETBSDSRCDIR}/common/lib/libc/arch/arm/features.mk"
5.endif
6
7.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \
8	|| ${LIB} == "rump")
9
10.if "${FEAT_LDREX}" == "no"
11SRCS.atomic+=	atomic_add_32_cas.c atomic_add_32_nv_cas.c \
12		atomic_and_32_cas.c atomic_and_32_nv_cas.c \
13		atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
14		atomic_inc_32_cas.c atomic_inc_32_nv_cas.c \
15		atomic_or_32_cas.c atomic_or_32_nv_cas.c \
16		atomic_swap_32_cas.c membar_ops_nop.c
17
18.if ${LIB} == "c"
19SRCS.atomic+=	atomic_xor_32_cas.c atomic_xor_16_cas.c atomic_xor_8_cas.c \
20		atomic_sub_32_cas.c atomic_sub_16_cas.c atomic_sub_8_cas.c \
21		atomic_nand_32_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c \
22		atomic_or_16_cas.c atomic_or_8_cas.c \
23		atomic_and_16_cas.c atomic_and_8_cas.c \
24		atomic_add_16_cas.c atomic_add_8_cas.c \
25		atomic_swap_16_cas.c atomic_swap_8_cas.c \
26		atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c \
27		atomic_load.c atomic_store.c \
28		atomic_and_16_nv_cas.c atomic_and_8_nv_cas.c	\
29		atomic_c11_compare_exchange_cas_32.c	\
30		atomic_c11_compare_exchange_cas_16.c	\
31		atomic_c11_compare_exchange_cas_8.c
32.endif
33
34.else
35.for op in add and cas nand or xor
36.for sz in 8 16 32 64
37SRCS.atomic+=	atomic_${op}_${sz}.S
38.endfor
39.endfor
40SRCS.atomic+=	atomic_dec_32.S atomic_dec_64.S
41SRCS.atomic+=	atomic_inc_32.S atomic_inc_64.S
42SRCS.atomic+=	atomic_sub_64.S
43SRCS.atomic+=	atomic_swap.S atomic_swap_16.S atomic_swap_64.S
44SRCS.atomic+=	membar_ops.S
45.if defined(LIB) && ${LIB} != "kern" && ${LIB} != "rump"
46.for op in add and nand or sub xor
47SRCS.atomic+=	sync_fetch_and_${op}_8.S
48.endfor
49.for sz in 1 2 4 8
50SRCS.atomic+=	sync_bool_compare_and_swap_${sz}.S
51.endfor
52.endif
53.endif
54
55.endif
56
57.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread" || ${LIB} == "rump")
58
59SRCS.atomic+=	atomic_simplelock.c
60.if "${FEAT_THUMB2}" == "no"
61CPUFLAGS.atomic_simplelock.c+=	-marm
62.endif
63
64.endif
65
66.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread")
67
68.if "${FEAT_LDREX}" == "no"
69SRCS.atomic+=	atomic_init_testset.c
70SRCS.atomic+=	atomic_cas_up.S
71CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP
72CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_16_UP
73CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_8_UP
74.if "${FEAT_EABI}" == "yes" && "${FEAT_LDRD}" == "yes"
75CPPFLAGS+= -D__HAVE_ATOMIC_CAS_64_UP -D__HAVE_ASM_ATOMIC_CAS_64_UP
76.endif
77.else
78SRCS.atomic+=	atomic_init_cas.c
79.endif #FEAT_LDREX
80
81.endif #LIB
82
83.if "${FEAT_THUMB2}" == "no"
84.for f in ${SRCS.atomic:M*.S}
85CPUFLAGS.$f+=	-marm
86.endfor
87.endif
88
89SRCS+=	${SRCS.atomic}
90