forked from cffs/lib-musl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.uk
277 lines (259 loc) · 10.4 KB
/
Makefile.uk
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# libmusl Makefile.uk
#
# Authors: Felipe Huici <[email protected]>
# Gaulthier Gain <[email protected]>
# Alexander Jung <[email protected]>
#
# Copyright (c) 2017, NEC Europe Ltd., NEC Corporation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
#
################################################################################
# Library registration
################################################################################
$(eval $(call addlib_s,libmusl,$(CONFIG_LIBMUSL)))
# Additionally, build glue code. This is put into a separate library so that we
# can apply a thick helping of warning suppressions to musl, which throws
# lots of compilation warnings, but keep our glue code up to our standards.
$(eval $(call addlib_s,libmuslglue,$(CONFIG_LIBMUSL)))
################################################################################
# Sources
################################################################################
LIBMUSL_VERSION=1.1.19
LIBMUSL_URL=https://www.musl-libc.org/releases/musl-$(LIBMUSL_VERSION).tar.gz
LIBMUSL_PATCHDIR=$(LIBMUSL_BASE)/patches
$(eval $(call fetch,libmusl,$(LIBMUSL_URL)))
$(eval $(call patch,libmusl,$(LIBMUSL_PATCHDIR),musl-$(LIBMUSL_VERSION)))
################################################################################
# Helpers
################################################################################
LIBMUSL_SUBDIR=musl-$(LIBMUSL_VERSION)
LIBMUSL=$(LIBMUSL_ORIGIN)/$(LIBMUSL_SUBDIR)/
# Additional macros for musl sub-libraries
include $(LIBMUSL_BASE)/Makefile.rules
################################################################################
# Library includes
################################################################################
LIBMUSL_GLOBAL_INCLUDES-y += -I$(LIBMUSL)/arch/$(ARCH)
LIBMUSL_GLOBAL_INCLUDES-y += -I$(LIBMUSL)/arch/generic
LIBMUSL_GLOBAL_INCLUDES-y += -I$(LIBMUSL_BASE)/include
CINCLUDES-y += $(LIBMUSL_GLOBAL_INCLUDES-y)
CXXINCLUDES-y += $(LIBMUSL_GLOBAL_INCLUDES-y)
################################################################################
# Musl-specific Targets
################################################################################
# generate alltypes.h through musl sed script
$(LIBMUSL)/arch/$(ARCH)/bits/alltypes.h: $(LIBMUSL_BUILD)/.patched
$(call verbose_cmd,CONFIGURE,libmusl: $(notdir $@),\
sed -f $(LIBMUSL)/tools/mkalltypes.sed \
$(LIBMUSL)/arch/$(ARCH)/bits/alltypes.h.in \
$(LIBMUSL)/include/alltypes.h.in > $@ && \
$(TOUCH) $@)
# generate version.h
$(LIBMUSL)/src/internal/version.h:
$(call verbose_cmd,CONFIGURE,libmusl: $(notdir $@),\
printf '#define VERSION "%s"\n' "$$(cd $(LIBMUSL); sh tools/version.sh)" > $@ \
$(TOUCH) $@)
UK_PREPARE += $(LIBMUSL)/arch/$(ARCH)/bits/alltypes.h
UK_PREPARE += $(LIBMUSL)/src/internal/version.h
UK_PREPARE += $(LIBMUSL_BUILD)/.prepared
LIBMUSL_CLEAN += $(LIBMUSL)/arch/$(ARCH)/bits/alltypes.h
LIBMUSL_CLEAN += $(LIBMUSL)/src/internal/version.h
LIBMUSL_CLEAN += $(LIBMUSL_BUILD)/include
################################################################################
# Global flags
################################################################################
LIBMUSL_HDRS_FLAGS-y += -Wno-unused-parameter
LIBMUSL_HDRS_FLAGS-y += -Wno-unused-value
LIBMUSL_HDRS_FLAGS-y += -Wno-parentheses
LIBMUSL_HDRS_FLAGS-y += -Wno-error=sign-compare
LIBMUSL_HDRS_FLAGS-y += -Wno-builtin-macro-redefined
LIBMUSL_HDRS_FLAGS-y += -D_POSIX_SOURCE -D_BSD_SOURCE
LIBMUSL_CFLAGS-y += -Wno-implicit-fallthrough
LIBMUSL_CFLAGS-y += -Wno-restrict
LIBMUSL_CFLAGS-y += -Wno-unused-but-set-variable
LIBMUSL_CFLAGS-y += -Wno-sign-compare
LIBMUSL_CFLAGS-y += -Wno-empty-body
LIBMUSL_CFLAGS-y += -Wno-maybe-uninitialized
LIBMUSL_CFLAGS-y += -Wno-unknown-pragmas
LIBMUSL_CFLAGS-y += -Wno-missing-braces
LIBMUSL_CFLAGS-y += -Wno-cast-function-type
LIBMUSL_CFLAGS-y += -Wno-format-contains-nul
LIBMUSL_CFLAGS-y += -Wno-type-limits
LIBMUSL_CFLAGS-y += -DUK_LIBC_SYSCALL=0
LIBMUSL_CFLAGS-y += $(LIBMUSL_HDRS_FLAGS-y)
# We globally switch off warnings that are caused by musl's public headers
CFLAGS += $(LIBMUSL_HDRS_FLAGS-y)
CXXFLAGS += $(LIBMUSL_HDRS_FLAGS-y)
################################################################################
# OS dependencies code - Glue between Unicore and musl
################################################################################
LIBMUSLGLUE_SRCS-y += $(LIBMUSL_BASE)/mem.c
################################################################################
# Core Standard Library
################################################################################
LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/sys/types.h
LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/sys/param.h
LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/sys/time.h
LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/sys/mount.h
LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/sys/sysmacros.h
LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/sys/file.h
LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/alloca.h
LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/stdbool.h
LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/limits.h
LIBMUSL_CORE_HDRS-y += $(LIBMUSL)/include/assert.h
$(eval $(call _libmusl_import_lib,core,$(LIBMUSL_CORE_HDRS-y),$(LIBMUSL_CORE_SRCS-y)))
################################################################################
# musl code -- one external Makefile per sub-lib
################################################################################
ifeq ($(CONFIG_LIBMUSL_MQ),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.mq
endif
ifeq ($(CONFIG_LIBMUSL_DIRENT),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.dirent
endif
ifeq ($(CONFIG_LIBMUSL_MISC),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.misc
endif
ifeq ($(CONFIG_LIBMUSL_TEMP),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.temp
endif
ifeq ($(CONFIG_LIBMUSL_MULTIBYTE),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.multibyte
endif
ifeq ($(CONFIG_LIBMUSL_PROCESS),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.process
endif
ifeq ($(CONFIG_LIBMUSL_MMAN),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.mman
endif
ifeq ($(CONFIG_LIBMUSL_STDLIB),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.stdlib
endif
ifeq ($(CONFIG_LIBMUSL_FCNTL),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.fcntl
endif
ifeq ($(CONFIG_LIBMUSL_STDIO),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.stdio
endif
ifeq ($(CONFIG_LIBMUSL_CONF),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.conf
endif
ifeq ($(CONFIG_LIBMUSL_MATH),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.math
endif
ifeq ($(CONFIG_LIBMUSL_AIO),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.aio
endif
ifeq ($(CONFIG_LIBMUSL_STAT),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.stat
endif
ifeq ($(CONFIG_LIBMUSL_SEARCH),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.search
endif
ifeq ($(CONFIG_LIBMUSL_CRYPT),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.crypt
endif
ifeq ($(CONFIG_LIBMUSL_SELECT),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.select
endif
ifeq ($(CONFIG_LIBMUSL_MALLOC),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.malloc
endif
ifeq ($(CONFIG_LIBMUSL_UNISTD),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.unistd
endif
ifeq ($(CONFIG_LIBMUSL_SIGNAL),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.signal
endif
ifeq ($(CONFIG_LIBMUSL_THREAD),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.thread
endif
ifeq ($(CONFIG_LIBMUSL_LEGACY),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.legacy
endif
ifeq ($(CONFIG_LIBMUSL_ENV),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.env
endif
ifeq ($(CONFIG_LIBMUSL_TIME),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.time
endif
ifeq ($(CONFIG_LIBMUSL_ERRNO),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.errno
endif
ifeq ($(CONFIG_LIBMUSL_IPC),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.ipc
endif
ifeq ($(CONFIG_LIBMUSL_PRNG),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.prng
endif
ifeq ($(CONFIG_LIBMUSL_LDSO),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.ldso
endif
ifeq ($(CONFIG_LIBMUSL_PASSWD),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.passwd
endif
ifeq ($(CONFIG_LIBMUSL_FENV),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.fenv
endif
ifeq ($(CONFIG_LIBMUSL_CTYPE),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.ctype
endif
ifeq ($(CONFIG_LIBMUSL_LINUX),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.linux
endif
ifeq ($(CONFIG_LIBMUSL_INTERNAL),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.internal
endif
ifeq ($(CONFIG_LIBMUSL_NETWORK),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.network
endif
ifeq ($(CONFIG_LIBMUSL_SCHED),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.sched
endif
ifeq ($(CONFIG_LIBMUSL_STRING),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.string
endif
ifeq ($(CONFIG_LIBMUSL_REGEX),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.regex
endif
ifeq ($(CONFIG_LIBMUSL_TERMIOS),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.termios
endif
ifeq ($(CONFIG_LIBMUSL_EXIT),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.exit
endif
ifeq ($(CONFIG_LIBMUSL_SETJMP),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.setjmp
endif
ifeq ($(CONFIG_LIBMUSL_LOCALE),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.locale
endif
ifeq ($(CONFIG_LIBMUSL_COMPLEX),y)
include $(LIBMUSL_BASE)/Makefile.uk.musl.complex
endif