summaryrefslogtreecommitdiff
path: root/libc/string/Makefile.in
blob: 08a1856b76efe816181b230716e7ee3017ff4ae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Makefile for uClibc
#
# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#

subdirs += libc/string/$(TARGET_ARCH) libc/string/generic

#
# Arch specific fun
#
# Collect the subarch specific implementation (asm files)
ifneq ($(strip $(TARGET_SUBARCH)),)
STRING_SUBARCH_DIR := $(top_srcdir)libc/string/$(TARGET_ARCH)/$(TARGET_SUBARCH)
STRING_SUBARCH_OUT := $(top_builddir)libc/string/$(TARGET_ARCH)/$(TARGET_SUBARCH)

STRING_SUBARCH_SSRC := $(wildcard $(STRING_SUBARCH_OUT)/*.S)
STRING_SUBARCH_SOBJ := $(patsubst $(STRING_SUBARCH_DIR)/%.S,$(STRING_SUBARCH_OUT)/%.o,$(STRING_SUBARCH_SSRC))

STRING_SUBARCH_OBJS := $(STRING_SUBARCH_SOBJ)
endif

# Collect the arch specific implementation (asm, c files)
STRING_ARCH_DIR := $(top_srcdir)libc/string/$(TARGET_ARCH)
STRING_ARCH_OUT := $(top_builddir)libc/string/$(TARGET_ARCH)

STRING_ARCH_SRC := $(wildcard $(STRING_ARCH_DIR)/*.c)
STRING_ARCH_OBJ := $(patsubst $(STRING_ARCH_DIR)/%.c,$(STRING_ARCH_OUT)/%.o,$(STRING_ARCH_SRC))

STRING_ARCH_SSRC := $(wildcard $(STRING_ARCH_DIR)/*.S)

# Exclude the subarch implementation from the arch ones
ifneq ($(strip $(STRING_SUBARCH_OBJS)),)
STRING_ARCH_SSRC := $(filter-out $(patsubst %.o,$(STRING_ARCH_DIR)/%.S,$(notdir $(STRING_SUBARCH_OBJS))),$(STRING_ARCH_SSRC))
endif

STRING_ARCH_SOBJ := $(patsubst $(STRING_ARCH_DIR)/%.S,$(STRING_ARCH_OUT)/%.o,$(STRING_ARCH_SSRC))

STRING_ARCH_OBJS := $(STRING_ARCH_OBJ) $(STRING_ARCH_SOBJ)

libc-$(UCLIBC_HAS_STRING_ARCH_OPT) += $(STRING_ARCH_OBJS) $(STRING_SUBARCH_OBJS)

libc-nomulti-$(UCLIBC_HAS_STRING_ARCH_OPT) += $(STRING_ARCH_SOBJ) $(STRING_SUBARCH_OBJS)

#
# Generic stuff
#
STRING_GENERIC_DIR := $(top_srcdir)libc/string/generic
STRING_GENERIC_OUT := $(top_builddir)libc/string/generic

STRING_GENERIC_SRC := $(wildcard $(STRING_GENERIC_DIR)/*.c)
STRING_GENERIC_SRC := $(filter-out $(STRING_GENERIC_DIR)/_memcpy_fwd.c, $(STRING_GENERIC_SRC))

ifeq ($(UCLIBC_HAS_STRING_ARCH_OPT),y)
ifneq ($(strip $(STRING_ARCH_OBJS)),)
STRING_GENERIC_SRC := $(filter-out $(patsubst %.o,$(STRING_GENERIC_DIR)/%.c,$(notdir $(STRING_ARCH_OBJS))),$(STRING_GENERIC_SRC))
endif
ifneq ($(strip $(STRING_SUBARCH_OBJS)),)
STRING_GENERIC_SRC := $(filter-out $(patsubst %.o,$(STRING_GENERIC_DIR)/%.c,$(notdir $(STRING_SUBARCH_OBJS))),$(STRING_GENERIC_SRC))
endif
endif

STRING_GENERIC_OBJS := $(patsubst $(STRING_GENERIC_DIR)/%.c,$(STRING_GENERIC_OUT)/%.o,$(STRING_GENERIC_SRC))

libc-$(UCLIBC_HAS_STRING_GENERIC_OPT) += $(STRING_GENERIC_OBJS)

#
# Top level string
#
STRING_DIR := $(top_srcdir)libc/string
STRING_OUT := $(top_builddir)libc/string

STRING_ALL_WXSRC := $(wildcard $(STRING_DIR)/w*_l.c)
ifeq ($(UCLIBC_HAS_LOCALE),y)
STRING_WXSRC := $(STRING_ALL_WXSRC)
else
# wcscoll_l
STRING_WXSRC := $(filter-out $(STRING_DIR)/wcsxfrm_l.c,$(STRING_ALL_WXSRC))
endif

STRING_ALL_XLSRC := $(filter-out $(STRING_ALL_WXSRC),$(wildcard $(STRING_DIR)/*_l.c))
ifeq ($(UCLIBC_HAS_LOCALE),y)
STRING_XLSRC := $(STRING_ALL_XLSRC)
else
# strcoll_l
STRING_XLSRC := $(filter-out $(STRING_DIR)/strxfrm_l.c,$(STRING_ALL_XLSRC))
endif

STRING_ALL_WSRC := $(filter-out $(STRING_ALL_WXSRC),$(wildcard $(STRING_DIR)/w*.c))
ifeq ($(UCLIBC_HAS_LOCALE),y)
STRING_WSRC := $(STRING_ALL_WSRC)
else
# wcscoll
STRING_WSRC := $(filter-out $(STRING_DIR)/wcsxfrm.c,$(STRING_ALL_WSRC))
endif

STRING_ALL_CSRC := $(filter-out $(STRING_ALL_WXSRC) $(STRING_ALL_XLSRC) $(STRING_ALL_WSRC) $(STRING_DIR)/_collate.c,$(wildcard $(STRING_DIR)/*.c))
ifeq ($(UCLIBC_HAS_LOCALE),y)
STRING_CSRC := $(STRING_ALL_CSRC)
else
# strcoll
STRING_CSRC := $(filter-out $(STRING_DIR)/strxfrm.c,$(STRING_ALL_CSRC))
endif

ifeq ($(UCLIBC_HAS_WCHAR),y)
STRING_CSRC += $(STRING_WSRC)
endif
ifeq ($(UCLIBC_HAS_XLOCALE),y)
STRING_CSRC += $(STRING_XLSRC)
ifeq ($(UCLIBC_HAS_WCHAR),y)
STRING_CSRC += $(STRING_WXSRC)
endif
endif

ifeq ($(UCLIBC_HAS_STRING_ARCH_OPT),y)
ifneq ($(strip $(STRING_ARCH_OBJS)),)
STRING_CSRC := $(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_ARCH_OBJS))),$(STRING_CSRC))
endif
ifneq ($(strip $(STRING_SUBARCH_OBJS)),)
STRING_CSRC := $(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_SUBARCH_OBJS))),$(STRING_CSRC))
endif
endif

ifeq ($(UCLIBC_HAS_STRING_GENERIC_OPT),y)
ifneq ($(strip $(STRING_GENERIC_OBJS)),)
STRING_CSRC := $(filter-out $(patsubst %.o,$(STRING_DIR)/%.c,$(notdir $(STRING_GENERIC_OBJS))),$(STRING_CSRC))
endif
endif

STRING_COBJ := $(patsubst $(STRING_DIR)/%.c,$(STRING_OUT)/%.o,$(STRING_CSRC))

libc-y += $(STRING_COBJ)

libc-nomulti-$(UCLIBC_HAS_XLOCALE) += $(STRING_OUT)/wcsxfrm_l.o
libc-nomulti-y += $(STRING_OUT)/__xpg_strerror_r.o

objclean-y += string_clean

string_clean:
	$(do_rm) $(addprefix $(STRING_OUT)/,$(addprefix *., o os oS) $(addprefix */*., o os oS) $(addprefix */*/*., o os oS))