1# SPDX-License-Identifier: GPL-2.0
2#
3# Makefile for alpha-specific library files..
4#
5
6asflags-y := $(KBUILD_CFLAGS)
7ccflags-y := -Werror
8
9# Many of these routines have implementations tuned for ev6.
10# Choose them iff we're targeting ev6 specifically.
11ev6-$(CONFIG_ALPHA_EV6) := ev6-
12
13# Several make use of the cttz instruction introduced in ev67.
14ev67-$(CONFIG_ALPHA_EV67) := ev67-
15
16lib-y =	__divqu.o __remqu.o __divlu.o __remlu.o \
17	udiv-qrnnd.o \
18	udelay.o \
19	$(ev6-y)memset.o \
20	$(ev6-y)memcpy.o \
21	memmove.o \
22	checksum.o \
23	csum_partial_copy.o \
24	$(ev67-y)strlen.o \
25	stycpy.o \
26	styncpy.o \
27	$(ev67-y)strchr.o \
28	$(ev67-y)strrchr.o \
29	$(ev6-y)memchr.o \
30	$(ev6-y)copy_user.o \
31	$(ev6-y)clear_user.o \
32	$(ev6-y)csum_ipv6_magic.o \
33	$(ev6-y)clear_page.o \
34	$(ev6-y)copy_page.o \
35	fpreg.o \
36	callback_srm.o srm_puts.o srm_printk.o \
37	fls.o
38
39# The division routines are built from single source, with different defines.
40AFLAGS___divqu.o = -DDIV
41AFLAGS___remqu.o =       -DREM
42AFLAGS___divlu.o = -DDIV       -DINTSIZE
43AFLAGS___remlu.o =       -DREM -DINTSIZE
44
45$(addprefix $(obj)/,__divqu.o __remqu.o __divlu.o __remlu.o): \
46						$(src)/$(ev6-y)divide.S FORCE
47	$(call if_changed_rule,as_o_S)
48
49# There are direct branches between {str*cpy,str*cat} and stx*cpy.
50# Ensure the branches are within range by merging these objects.
51
52LDFLAGS_stycpy.o := -r
53LDFLAGS_styncpy.o := -r
54
55$(obj)/stycpy.o: $(obj)/strcpy.o $(obj)/$(ev67-y)strcat.o \
56		 $(obj)/$(ev6-y)stxcpy.o FORCE
57	$(call if_changed,ld)
58
59$(obj)/styncpy.o: $(obj)/strncpy.o $(obj)/$(ev67-y)strncat.o \
60		 $(obj)/$(ev6-y)stxncpy.o FORCE
61	$(call if_changed,ld)
62