]>
Commit | Line | Data |
---|---|---|
41af0db3 DG |
1 | # These variables are specifically meant to be overridable via the make |
2 | # command-line. | |
202034fd MH |
3 | # ?= doesn't work for CC and AR because make has a default value for them. |
4 | ifeq ($(origin CC), default) | |
5 | CC := clang | |
6 | endif | |
a279514a | 7 | NM ?= $(patsubst %clang,%llvm-nm,$(filter-out ccache sccache,$(CC))) |
202034fd MH |
8 | ifeq ($(origin AR), default) |
9 | AR = $(patsubst %clang,%llvm-ar,$(filter-out ccache sccache,$(CC))) | |
10 | endif | |
8852e15a | 11 | EXTRA_CFLAGS ?= -O2 -DNDEBUG |
320054e8 | 12 | # The directory where we build the sysroot. |
255e6f7c | 13 | SYSROOT ?= $(CURDIR)/sysroot |
320054e8 | 14 | # A directory to install to for "make install". |
255e6f7c | 15 | INSTALL_DIR ?= /usr/local |
dcd28cf8 | 16 | # single or posix; note that pthread support is still a work-in-progress. |
41af0db3 | 17 | THREAD_MODEL ?= single |
c7465d22 AL |
18 | # dlmalloc or none |
19 | MALLOC_IMPL ?= dlmalloc | |
320054e8 | 20 | # yes or no |
41af0db3 | 21 | BUILD_LIBC_TOP_HALF ?= yes |
8098d862 | 22 | # The directory where we will store intermediate artifacts. |
3a1843bb | 23 | OBJDIR ?= $(CURDIR)/build/$(TARGET_TRIPLE) |
320054e8 | 24 | |
ba81b409 CS |
25 | # When the length is no larger than this threshold, we consider the |
26 | # overhead of bulk memory opcodes to outweigh the performance benefit, | |
27 | # and fall back to the original musl implementation. See | |
28 | # https://github.com/WebAssembly/wasi-libc/pull/263 for relevant | |
29 | # discussion | |
30 | BULK_MEMORY_THRESHOLD ?= 32 | |
31 | ||
41af0db3 DG |
32 | # Variables from this point on are not meant to be overridable via the |
33 | # make command-line. | |
34 | ||
f1af8cea | 35 | # Set the default WASI target triple. |
41af0db3 | 36 | TARGET_TRIPLE = wasm32-wasi |
f1af8cea PP |
37 | |
38 | # Threaded version necessitates a different traget, as objects from different | |
39 | # targets can't be mixed together while linking. | |
40 | ifeq ($(THREAD_MODEL), posix) | |
41 | TARGET_TRIPLE = wasm32-wasi-pthread | |
42 | endif | |
41af0db3 DG |
43 | |
44 | # These variables describe the locations of various files and directories in | |
45 | # the source tree. | |
320054e8 | 46 | DLMALLOC_DIR = $(CURDIR)/dlmalloc |
dbfccac2 | 47 | DLMALLOC_SRC_DIR = $(DLMALLOC_DIR)/src |
320054e8 | 48 | DLMALLOC_SOURCES = $(DLMALLOC_SRC_DIR)/dlmalloc.c |
dbfccac2 | 49 | DLMALLOC_INC = $(DLMALLOC_DIR)/include |
a7af7c06 DG |
50 | EMMALLOC_DIR = $(CURDIR)/emmalloc |
51 | EMMALLOC_SOURCES = $(EMMALLOC_DIR)/emmalloc.c | |
320054e8 DG |
52 | LIBC_BOTTOM_HALF_DIR = $(CURDIR)/libc-bottom-half |
53 | LIBC_BOTTOM_HALF_CLOUDLIBC_SRC = $(LIBC_BOTTOM_HALF_DIR)/cloudlibc/src | |
54 | LIBC_BOTTOM_HALF_CLOUDLIBC_SRC_INC = $(LIBC_BOTTOM_HALF_CLOUDLIBC_SRC)/include | |
55 | LIBC_BOTTOM_HALF_HEADERS_PUBLIC = $(LIBC_BOTTOM_HALF_DIR)/headers/public | |
56 | LIBC_BOTTOM_HALF_HEADERS_PRIVATE = $(LIBC_BOTTOM_HALF_DIR)/headers/private | |
320054e8 DG |
57 | LIBC_BOTTOM_HALF_SOURCES = $(LIBC_BOTTOM_HALF_DIR)/sources |
58 | LIBC_BOTTOM_HALF_ALL_SOURCES = \ | |
69031b63 | 59 | $(sort \ |
320054e8 | 60 | $(shell find $(LIBC_BOTTOM_HALF_CLOUDLIBC_SRC) -name \*.c) \ |
69031b63 | 61 | $(shell find $(LIBC_BOTTOM_HALF_SOURCES) -name \*.c)) |
5b148b61 AC |
62 | |
63 | # FIXME(https://reviews.llvm.org/D85567) - due to a bug in LLD the weak | |
64 | # references to a function defined in `chdir.c` only work if `chdir.c` is at the | |
65 | # end of the archive, but once that LLD review lands and propagates into LLVM | |
66 | # then we don't have to do this. | |
67 | LIBC_BOTTOM_HALF_ALL_SOURCES := $(filter-out $(LIBC_BOTTOM_HALF_SOURCES)/chdir.c,$(LIBC_BOTTOM_HALF_ALL_SOURCES)) | |
68 | LIBC_BOTTOM_HALF_ALL_SOURCES := $(LIBC_BOTTOM_HALF_ALL_SOURCES) $(LIBC_BOTTOM_HALF_SOURCES)/chdir.c | |
69 | ||
320054e8 | 70 | LIBWASI_EMULATED_MMAN_SOURCES = \ |
69031b63 | 71 | $(sort $(shell find $(LIBC_BOTTOM_HALF_DIR)/mman -name \*.c)) |
b9b64a69 | 72 | LIBWASI_EMULATED_PROCESS_CLOCKS_SOURCES = \ |
69031b63 | 73 | $(sort $(shell find $(LIBC_BOTTOM_HALF_DIR)/clocks -name \*.c)) |
659ff414 | 74 | LIBWASI_EMULATED_GETPID_SOURCES = \ |
69031b63 | 75 | $(sort $(shell find $(LIBC_BOTTOM_HALF_DIR)/getpid -name \*.c)) |
d1cd4f48 | 76 | LIBWASI_EMULATED_SIGNAL_SOURCES = \ |
69031b63 | 77 | $(sort $(shell find $(LIBC_BOTTOM_HALF_DIR)/signal -name \*.c)) |
d1cd4f48 DG |
78 | LIBWASI_EMULATED_SIGNAL_MUSL_SOURCES = \ |
79 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/signal/psignal.c \ | |
80 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/string/strsignal.c | |
320054e8 DG |
81 | LIBC_BOTTOM_HALF_CRT_SOURCES = $(wildcard $(LIBC_BOTTOM_HALF_DIR)/crt/*.c) |
82 | LIBC_TOP_HALF_DIR = $(CURDIR)/libc-top-half | |
83 | LIBC_TOP_HALF_MUSL_DIR = $(LIBC_TOP_HALF_DIR)/musl | |
84 | LIBC_TOP_HALF_MUSL_SRC_DIR = $(LIBC_TOP_HALF_MUSL_DIR)/src | |
85 | LIBC_TOP_HALF_MUSL_INC = $(LIBC_TOP_HALF_MUSL_DIR)/include | |
86 | LIBC_TOP_HALF_MUSL_SOURCES = \ | |
41af0db3 DG |
87 | $(addprefix $(LIBC_TOP_HALF_MUSL_SRC_DIR)/, \ |
88 | misc/a64l.c \ | |
89 | misc/basename.c \ | |
90 | misc/dirname.c \ | |
91 | misc/ffs.c \ | |
92 | misc/ffsl.c \ | |
93 | misc/ffsll.c \ | |
94 | misc/fmtmsg.c \ | |
95 | misc/getdomainname.c \ | |
96 | misc/gethostid.c \ | |
97 | misc/getopt.c \ | |
98 | misc/getopt_long.c \ | |
99 | misc/getsubopt.c \ | |
100 | misc/uname.c \ | |
101 | misc/nftw.c \ | |
102 | errno/strerror.c \ | |
103 | network/htonl.c \ | |
104 | network/htons.c \ | |
105 | network/ntohl.c \ | |
106 | network/ntohs.c \ | |
107 | network/inet_ntop.c \ | |
108 | network/inet_pton.c \ | |
109 | network/inet_aton.c \ | |
110 | network/in6addr_any.c \ | |
111 | network/in6addr_loopback.c \ | |
112 | fenv/fenv.c \ | |
113 | fenv/fesetround.c \ | |
114 | fenv/feupdateenv.c \ | |
115 | fenv/fesetexceptflag.c \ | |
116 | fenv/fegetexceptflag.c \ | |
117 | fenv/feholdexcept.c \ | |
118 | exit/exit.c \ | |
119 | exit/atexit.c \ | |
120 | exit/assert.c \ | |
121 | exit/quick_exit.c \ | |
122 | exit/at_quick_exit.c \ | |
123 | time/strftime.c \ | |
124 | time/asctime.c \ | |
125 | time/asctime_r.c \ | |
126 | time/ctime.c \ | |
127 | time/ctime_r.c \ | |
128 | time/wcsftime.c \ | |
129 | time/strptime.c \ | |
130 | time/difftime.c \ | |
131 | time/timegm.c \ | |
132 | time/ftime.c \ | |
133 | time/gmtime.c \ | |
134 | time/gmtime_r.c \ | |
135 | time/timespec_get.c \ | |
136 | time/getdate.c \ | |
137 | time/localtime.c \ | |
138 | time/localtime_r.c \ | |
139 | time/mktime.c \ | |
140 | time/__tm_to_secs.c \ | |
141 | time/__month_to_secs.c \ | |
142 | time/__secs_to_tm.c \ | |
143 | time/__year_to_secs.c \ | |
144 | time/__tz.c \ | |
145 | fcntl/creat.c \ | |
146 | dirent/alphasort.c \ | |
147 | dirent/versionsort.c \ | |
8b7148f6 | 148 | env/__stack_chk_fail.c \ |
41af0db3 DG |
149 | env/clearenv.c \ |
150 | env/getenv.c \ | |
151 | env/putenv.c \ | |
152 | env/setenv.c \ | |
153 | env/unsetenv.c \ | |
154 | unistd/posix_close.c \ | |
079adff8 | 155 | stat/futimesat.c \ |
e066a8b9 | 156 | legacy/getpagesize.c \ |
dcd28cf8 | 157 | thread/thrd_sleep.c \ |
41af0db3 | 158 | ) \ |
320054e8 DG |
159 | $(filter-out %/procfdname.c %/syscall.c %/syscall_ret.c %/vdso.c %/version.c, \ |
160 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/internal/*.c)) \ | |
161 | $(filter-out %/flockfile.c %/funlockfile.c %/__lockfile.c %/ftrylockfile.c \ | |
162 | %/rename.c \ | |
163 | %/tmpnam.c %/tmpfile.c %/tempnam.c \ | |
164 | %/popen.c %/pclose.c \ | |
165 | %/remove.c \ | |
166 | %/gets.c, \ | |
167 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/stdio/*.c)) \ | |
168 | $(filter-out %/strsignal.c, \ | |
169 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/string/*.c)) \ | |
8048aeb5 | 170 | $(filter-out %/dcngettext.c %/textdomain.c %/bind_textdomain_codeset.c, \ |
320054e8 DG |
171 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/locale/*.c)) \ |
172 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/stdlib/*.c) \ | |
173 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/search/*.c) \ | |
174 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/multibyte/*.c) \ | |
175 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/regex/*.c) \ | |
320054e8 DG |
176 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/prng/*.c) \ |
177 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/conf/*.c) \ | |
178 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/ctype/*.c) \ | |
900b8032 | 179 | $(filter-out %/__signbit.c %/__signbitf.c %/__signbitl.c \ |
16450763 DG |
180 | %/__fpclassify.c %/__fpclassifyf.c %/__fpclassifyl.c \ |
181 | %/ceilf.c %/ceil.c \ | |
182 | %/floorf.c %/floor.c \ | |
183 | %/truncf.c %/trunc.c \ | |
184 | %/rintf.c %/rint.c \ | |
185 | %/nearbyintf.c %/nearbyint.c \ | |
186 | %/sqrtf.c %/sqrt.c \ | |
187 | %/fabsf.c %/fabs.c \ | |
cf81683e DG |
188 | %/copysignf.c %/copysign.c \ |
189 | %/fminf.c %/fmaxf.c \ | |
190 | %/fmin.c %/fmax.c, \ | |
900b8032 | 191 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/math/*.c)) \ |
5ccebd31 DG |
192 | $(filter-out %/crealf.c %/creal.c %creall.c \ |
193 | %/cimagf.c %/cimag.c %cimagl.c, \ | |
7d5074ff | 194 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/complex/*.c)) \ |
320054e8 | 195 | $(wildcard $(LIBC_TOP_HALF_MUSL_SRC_DIR)/crypt/*.c) |
dcd28cf8 | 196 | |
33c3753c AB |
197 | ifeq ($(THREAD_MODEL), posix) |
198 | LIBC_TOP_HALF_MUSL_SOURCES += \ | |
199 | $(addprefix $(LIBC_TOP_HALF_MUSL_SRC_DIR)/, \ | |
a00bf321 | 200 | env/__init_tls.c \ |
201 | stdio/__lockfile.c \ | |
f0295069 YT |
202 | stdio/flockfile.c \ |
203 | stdio/ftrylockfile.c \ | |
204 | stdio/funlockfile.c \ | |
d02cec69 | 205 | thread/__lock.c \ |
33c3753c AB |
206 | thread/__wait.c \ |
207 | thread/__timedwait.c \ | |
a00bf321 | 208 | thread/default_attr.c \ |
209 | thread/pthread_attr_destroy.c \ | |
627654f0 | 210 | thread/pthread_attr_get.c \ |
a00bf321 | 211 | thread/pthread_attr_init.c \ |
212 | thread/pthread_attr_setstack.c \ | |
213 | thread/pthread_attr_setstacksize.c \ | |
583c4269 AB |
214 | thread/pthread_barrier_destroy.c \ |
215 | thread/pthread_barrier_init.c \ | |
216 | thread/pthread_barrier_wait.c \ | |
c40403f9 MK |
217 | thread/pthread_cleanup_push.c \ |
218 | thread/pthread_cond_broadcast.c \ | |
219 | thread/pthread_cond_destroy.c \ | |
220 | thread/pthread_cond_init.c \ | |
221 | thread/pthread_cond_signal.c \ | |
222 | thread/pthread_cond_timedwait.c \ | |
223 | thread/pthread_cond_wait.c \ | |
3d00b969 MK |
224 | thread/pthread_condattr_destroy.c \ |
225 | thread/pthread_condattr_init.c \ | |
226 | thread/pthread_condattr_setclock.c \ | |
227 | thread/pthread_condattr_setpshared.c \ | |
241060c3 | 228 | thread/pthread_create.c \ |
c071a602 | 229 | thread/pthread_detach.c \ |
c718ee13 | 230 | thread/pthread_getspecific.c \ |
9d2f5a82 | 231 | thread/pthread_join.c \ |
c718ee13 | 232 | thread/pthread_key_create.c \ |
33c3753c AB |
233 | thread/pthread_mutex_consistent.c \ |
234 | thread/pthread_mutex_destroy.c \ | |
235 | thread/pthread_mutex_init.c \ | |
236 | thread/pthread_mutex_getprioceiling.c \ | |
237 | thread/pthread_mutex_lock.c \ | |
238 | thread/pthread_mutex_timedlock.c \ | |
239 | thread/pthread_mutex_trylock.c \ | |
240 | thread/pthread_mutex_unlock.c \ | |
241 | thread/pthread_mutexattr_destroy.c \ | |
242 | thread/pthread_mutexattr_init.c \ | |
243 | thread/pthread_mutexattr_setprotocol.c \ | |
244 | thread/pthread_mutexattr_setpshared.c \ | |
245 | thread/pthread_mutexattr_setrobust.c \ | |
246 | thread/pthread_mutexattr_settype.c \ | |
c718ee13 | 247 | thread/pthread_once.c \ |
27ba71f9 MK |
248 | thread/pthread_rwlock_destroy.c \ |
249 | thread/pthread_rwlock_init.c \ | |
250 | thread/pthread_rwlock_rdlock.c \ | |
251 | thread/pthread_rwlock_timedrdlock.c \ | |
252 | thread/pthread_rwlock_timedwrlock.c \ | |
253 | thread/pthread_rwlock_tryrdlock.c \ | |
254 | thread/pthread_rwlock_trywrlock.c \ | |
255 | thread/pthread_rwlock_unlock.c \ | |
256 | thread/pthread_rwlock_wrlock.c \ | |
257 | thread/pthread_rwlockattr_destroy.c \ | |
258 | thread/pthread_rwlockattr_init.c \ | |
259 | thread/pthread_rwlockattr_setpshared.c \ | |
241060c3 | 260 | thread/pthread_setcancelstate.c \ |
c718ee13 | 261 | thread/pthread_setspecific.c \ |
a00bf321 | 262 | thread/pthread_self.c \ |
2057ce92 AB |
263 | thread/pthread_testcancel.c \ |
264 | thread/sem_destroy.c \ | |
265 | thread/sem_getvalue.c \ | |
266 | thread/sem_init.c \ | |
267 | thread/sem_post.c \ | |
268 | thread/sem_timedwait.c \ | |
269 | thread/sem_trywait.c \ | |
270 | thread/sem_wait.c \ | |
33c3753c AB |
271 | ) |
272 | endif | |
273 | ||
320054e8 DG |
274 | MUSL_PRINTSCAN_SOURCES = \ |
275 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/internal/floatscan.c \ | |
276 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/stdio/vfprintf.c \ | |
2201343c | 277 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/stdio/vfwprintf.c \ |
320054e8 DG |
278 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/stdio/vfscanf.c \ |
279 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/stdlib/strtod.c \ | |
280 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/stdlib/wcstod.c | |
d3cc92a6 CS |
281 | BULK_MEMORY_SOURCES = \ |
282 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/string/memcpy.c \ | |
283 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/string/memmove.c \ | |
284 | $(LIBC_TOP_HALF_MUSL_SRC_DIR)/string/memset.c | |
320054e8 DG |
285 | LIBC_TOP_HALF_HEADERS_PRIVATE = $(LIBC_TOP_HALF_DIR)/headers/private |
286 | LIBC_TOP_HALF_SOURCES = $(LIBC_TOP_HALF_DIR)/sources | |
287 | LIBC_TOP_HALF_ALL_SOURCES = \ | |
288 | $(LIBC_TOP_HALF_MUSL_SOURCES) \ | |
69031b63 | 289 | $(sort $(shell find $(LIBC_TOP_HALF_SOURCES) -name \*.c)) |
320054e8 | 290 | |
8852e15a JE |
291 | # Add any extra flags |
292 | CFLAGS = $(EXTRA_CFLAGS) | |
320054e8 | 293 | # Set the target. |
8852e15a | 294 | CFLAGS += --target=$(TARGET_TRIPLE) |
320054e8 DG |
295 | # WebAssembly floating-point match doesn't trap. |
296 | # TODO: Add -fno-signaling-nans when the compiler supports it. | |
5ccfab77 | 297 | CFLAGS += -fno-trapping-math |
63f0f3c5 DG |
298 | # Add all warnings, but disable a few which occur in third-party code. |
299 | CFLAGS += -Wall -Wextra -Werror \ | |
300 | -Wno-null-pointer-arithmetic \ | |
9520010f | 301 | -Wno-unused-parameter \ |
e69430a9 | 302 | -Wno-sign-compare \ |
6273a5ff | 303 | -Wno-unused-variable \ |
ed6e0ba9 | 304 | -Wno-unused-function \ |
e8270d1b | 305 | -Wno-ignored-attributes \ |
b77dcff6 | 306 | -Wno-missing-braces \ |
9cbfeaaa | 307 | -Wno-ignored-pragmas \ |
a78cd329 DG |
308 | -Wno-unused-but-set-variable \ |
309 | -Wno-unknown-warning-option | |
dbfccac2 DG |
310 | |
311 | # Configure support for threads. | |
320054e8 | 312 | ifeq ($(THREAD_MODEL), single) |
d3cc92a6 | 313 | CFLAGS += -mthread-model single |
dbfccac2 | 314 | endif |
320054e8 | 315 | ifeq ($(THREAD_MODEL), posix) |
dcd28cf8 AB |
316 | # Specify the tls-model until LLVM 15 is released (which should contain |
317 | # https://reviews.llvm.org/D130053). | |
318 | CFLAGS += -mthread-model posix -pthread -ftls-model=local-exec | |
3d00b969 MK |
319 | |
320 | # Include cloudlib's directory to access the structure definition of clockid_t | |
321 | CFLAGS += -I$(LIBC_BOTTOM_HALF_CLOUDLIBC_SRC) | |
320054e8 DG |
322 | endif |
323 | ||
fc260f1a JE |
324 | # Expose the public headers to the implementation. We use `-isystem` for |
325 | # purpose for two reasons: | |
326 | # | |
327 | # 1. It only does `<...>` not `"...."` lookup. We are making a libc, | |
328 | # which is a system library, so all public headers should be | |
329 | # accessible via `<...>` and never also need `"..."`. `-isystem` main | |
330 | # purpose is to only effect `<...>` lookup. | |
331 | # | |
332 | # 2. The `-I` for private headers added for specific C files below | |
333 | # should come earlier in the search path, so they can "override" | |
334 | # and/or `#include_next` the public headers. `-isystem` (like | |
335 | # `-idirafter`) comes later in the search path than `-I`. | |
336 | CFLAGS += -isystem "$(SYSROOT_INC)" | |
320054e8 | 337 | |
41af0db3 DG |
338 | # These variables describe the locations of various files and directories in |
339 | # the build tree. | |
320054e8 | 340 | objs = $(patsubst $(CURDIR)/%.c,$(OBJDIR)/%.o,$(1)) |
41af0db3 | 341 | DLMALLOC_OBJS = $(call objs,$(DLMALLOC_SOURCES)) |
a7af7c06 | 342 | EMMALLOC_OBJS = $(call objs,$(EMMALLOC_SOURCES)) |
41af0db3 DG |
343 | LIBC_BOTTOM_HALF_ALL_OBJS = $(call objs,$(LIBC_BOTTOM_HALF_ALL_SOURCES)) |
344 | LIBC_TOP_HALF_ALL_OBJS = $(call objs,$(LIBC_TOP_HALF_ALL_SOURCES)) | |
c7465d22 | 345 | ifeq ($(MALLOC_IMPL),dlmalloc) |
41af0db3 | 346 | LIBC_OBJS += $(DLMALLOC_OBJS) |
a7af7c06 DG |
347 | else ifeq ($(MALLOC_IMPL),emmalloc) |
348 | LIBC_OBJS += $(EMMALLOC_OBJS) | |
c7465d22 AL |
349 | else ifeq ($(MALLOC_IMPL),none) |
350 | # No object files to add. | |
351 | else | |
352 | $(error unknown malloc implementation $(MALLOC_IMPL)) | |
dbfccac2 | 353 | endif |
320054e8 | 354 | # Add libc-bottom-half's objects. |
41af0db3 | 355 | LIBC_OBJS += $(LIBC_BOTTOM_HALF_ALL_OBJS) |
320054e8 | 356 | ifeq ($(BUILD_LIBC_TOP_HALF),yes) |
320054e8 | 357 | # libc-top-half is musl. |
41af0db3 | 358 | LIBC_OBJS += $(LIBC_TOP_HALF_ALL_OBJS) |
320054e8 | 359 | endif |
41af0db3 DG |
360 | MUSL_PRINTSCAN_OBJS = $(call objs,$(MUSL_PRINTSCAN_SOURCES)) |
361 | MUSL_PRINTSCAN_LONG_DOUBLE_OBJS = $(patsubst %.o,%.long-double.o,$(MUSL_PRINTSCAN_OBJS)) | |
362 | MUSL_PRINTSCAN_NO_FLOATING_POINT_OBJS = $(patsubst %.o,%.no-floating-point.o,$(MUSL_PRINTSCAN_OBJS)) | |
d3cc92a6 | 363 | BULK_MEMORY_OBJS = $(call objs,$(BULK_MEMORY_SOURCES)) |
41af0db3 | 364 | LIBWASI_EMULATED_MMAN_OBJS = $(call objs,$(LIBWASI_EMULATED_MMAN_SOURCES)) |
b9b64a69 | 365 | LIBWASI_EMULATED_PROCESS_CLOCKS_OBJS = $(call objs,$(LIBWASI_EMULATED_PROCESS_CLOCKS_SOURCES)) |
659ff414 | 366 | LIBWASI_EMULATED_GETPID_OBJS = $(call objs,$(LIBWASI_EMULATED_GETPID_SOURCES)) |
d1cd4f48 DG |
367 | LIBWASI_EMULATED_SIGNAL_OBJS = $(call objs,$(LIBWASI_EMULATED_SIGNAL_SOURCES)) |
368 | LIBWASI_EMULATED_SIGNAL_MUSL_OBJS = $(call objs,$(LIBWASI_EMULATED_SIGNAL_MUSL_SOURCES)) | |
41af0db3 DG |
369 | |
370 | # These variables describe the locations of various files and | |
371 | # directories in the generated sysroot tree. | |
f1af8cea | 372 | SYSROOT_LIB := $(SYSROOT)/lib/$(TARGET_TRIPLE) |
41af0db3 | 373 | SYSROOT_INC = $(SYSROOT)/include |
f1af8cea | 374 | SYSROOT_SHARE = $(SYSROOT)/share/$(TARGET_TRIPLE) |
320054e8 | 375 | |
1f409842 DG |
376 | # Files from musl's include directory that we don't want to install in the |
377 | # sysroot's include directory. | |
41af0db3 | 378 | MUSL_OMIT_HEADERS := |
1f409842 DG |
379 | |
380 | # Remove files which aren't headers (we generate alltypes.h below). | |
41af0db3 | 381 | MUSL_OMIT_HEADERS += \ |
1f409842 DG |
382 | "bits/syscall.h.in" \ |
383 | "bits/alltypes.h.in" \ | |
384 | "alltypes.h.in" | |
385 | ||
33e8b518 | 386 | # Use the compiler's version of these headers. |
41af0db3 | 387 | MUSL_OMIT_HEADERS += \ |
33e8b518 DG |
388 | "stdarg.h" \ |
389 | "stddef.h" | |
390 | ||
1f409842 | 391 | # Use the WASI errno definitions. |
41af0db3 | 392 | MUSL_OMIT_HEADERS += \ |
1f409842 DG |
393 | "bits/errno.h" |
394 | ||
395 | # Remove headers that aren't supported yet or that aren't relevant for WASI. | |
41af0db3 | 396 | MUSL_OMIT_HEADERS += \ |
1f409842 DG |
397 | "sys/procfs.h" \ |
398 | "sys/user.h" \ | |
399 | "sys/kd.h" "sys/vt.h" "sys/soundcard.h" "sys/sem.h" \ | |
400 | "sys/shm.h" "sys/msg.h" "sys/ipc.h" "sys/ptrace.h" \ | |
401 | "sys/statfs.h" \ | |
402 | "bits/kd.h" "bits/vt.h" "bits/soundcard.h" "bits/sem.h" \ | |
403 | "bits/shm.h" "bits/msg.h" "bits/ipc.h" "bits/ptrace.h" \ | |
404 | "bits/statfs.h" \ | |
405 | "sys/vfs.h" \ | |
406 | "sys/statvfs.h" \ | |
407 | "syslog.h" "sys/syslog.h" \ | |
408 | "wait.h" "sys/wait.h" \ | |
409 | "ucontext.h" "sys/ucontext.h" \ | |
410 | "paths.h" \ | |
411 | "utmp.h" "utmpx.h" \ | |
412 | "lastlog.h" \ | |
413 | "sys/acct.h" \ | |
414 | "sys/cachectl.h" \ | |
415 | "sys/epoll.h" "sys/reboot.h" "sys/swap.h" \ | |
416 | "sys/sendfile.h" "sys/inotify.h" \ | |
417 | "sys/quota.h" \ | |
418 | "sys/klog.h" \ | |
419 | "sys/fsuid.h" \ | |
420 | "sys/io.h" \ | |
421 | "sys/prctl.h" \ | |
422 | "sys/mtio.h" \ | |
423 | "sys/mount.h" \ | |
424 | "sys/fanotify.h" \ | |
425 | "sys/personality.h" \ | |
426 | "elf.h" "link.h" "bits/link.h" \ | |
427 | "scsi/scsi.h" "scsi/scsi_ioctl.h" "scsi/sg.h" \ | |
428 | "sys/auxv.h" \ | |
429 | "pwd.h" "shadow.h" "grp.h" \ | |
430 | "mntent.h" \ | |
431 | "netdb.h" \ | |
432 | "resolv.h" \ | |
433 | "pty.h" \ | |
434 | "dlfcn.h" \ | |
435 | "setjmp.h" \ | |
436 | "ulimit.h" \ | |
437 | "sys/xattr.h" \ | |
438 | "wordexp.h" \ | |
439 | "spawn.h" \ | |
440 | "sys/membarrier.h" \ | |
441 | "sys/signalfd.h" \ | |
442 | "termios.h" \ | |
443 | "sys/termios.h" \ | |
444 | "bits/termios.h" \ | |
445 | "net/if.h" \ | |
446 | "net/if_arp.h" \ | |
447 | "net/ethernet.h" \ | |
448 | "net/route.h" \ | |
449 | "netinet/if_ether.h" \ | |
450 | "netinet/ether.h" \ | |
eb7230cf DG |
451 | "sys/timerfd.h" \ |
452 | "libintl.h" \ | |
dcd28cf8 AB |
453 | "sys/sysmacros.h" \ |
454 | "aio.h" | |
1f409842 DG |
455 | |
456 | ifeq ($(THREAD_MODEL), single) | |
457 | # Remove headers not supported in single-threaded mode. | |
dcd28cf8 | 458 | MUSL_OMIT_HEADERS += "pthread.h" |
1f409842 DG |
459 | endif |
460 | ||
41af0db3 | 461 | default: finish |
320054e8 DG |
462 | |
463 | $(SYSROOT_LIB)/libc.a: $(LIBC_OBJS) | |
464 | ||
465 | $(SYSROOT_LIB)/libc-printscan-long-double.a: $(MUSL_PRINTSCAN_LONG_DOUBLE_OBJS) | |
466 | ||
467 | $(SYSROOT_LIB)/libc-printscan-no-floating-point.a: $(MUSL_PRINTSCAN_NO_FLOATING_POINT_OBJS) | |
468 | ||
469 | $(SYSROOT_LIB)/libwasi-emulated-mman.a: $(LIBWASI_EMULATED_MMAN_OBJS) | |
470 | ||
b9b64a69 DG |
471 | $(SYSROOT_LIB)/libwasi-emulated-process-clocks.a: $(LIBWASI_EMULATED_PROCESS_CLOCKS_OBJS) |
472 | ||
659ff414 DG |
473 | $(SYSROOT_LIB)/libwasi-emulated-getpid.a: $(LIBWASI_EMULATED_GETPID_OBJS) |
474 | ||
d1cd4f48 DG |
475 | $(SYSROOT_LIB)/libwasi-emulated-signal.a: $(LIBWASI_EMULATED_SIGNAL_OBJS) $(LIBWASI_EMULATED_SIGNAL_MUSL_OBJS) |
476 | ||
320054e8 DG |
477 | %.a: |
478 | @mkdir -p "$(@D)" | |
255e6f7c | 479 | # On Windows, the commandline for the ar invocation got too long, so it needs to be split up. |
9eb4a995 JE |
480 | $(AR) crs $@ $(wordlist 1, 199, $^) |
481 | $(AR) crs $@ $(wordlist 200, 399, $^) | |
482 | $(AR) crs $@ $(wordlist 400, 599, $^) | |
483 | $(AR) crs $@ $(wordlist 600, 799, $^) | |
255e6f7c TS |
484 | # This might eventually overflow again, but at least it'll do so in a loud way instead of |
485 | # silently dropping the tail. | |
9eb4a995 | 486 | $(AR) crs $@ $(wordlist 800, 100000, $^) |
320054e8 | 487 | |
5ccfab77 | 488 | $(MUSL_PRINTSCAN_OBJS): CFLAGS += \ |
320054e8 DG |
489 | -D__wasilibc_printscan_no_long_double \ |
490 | -D__wasilibc_printscan_full_support_option="\"add -lc-printscan-long-double to the link command\"" | |
491 | ||
5ccfab77 | 492 | $(MUSL_PRINTSCAN_NO_FLOATING_POINT_OBJS): CFLAGS += \ |
320054e8 DG |
493 | -D__wasilibc_printscan_no_floating_point \ |
494 | -D__wasilibc_printscan_floating_point_support_option="\"remove -lc-printscan-no-floating-point from the link command\"" | |
495 | ||
5d0a7558 CS |
496 | # TODO: apply -mbulk-memory globally, once |
497 | # https://github.com/llvm/llvm-project/issues/52618 is resolved | |
d3cc92a6 CS |
498 | $(BULK_MEMORY_OBJS): CFLAGS += \ |
499 | -mbulk-memory | |
500 | ||
ba81b409 CS |
501 | $(BULK_MEMORY_OBJS): CFLAGS += \ |
502 | -DBULK_MEMORY_THRESHOLD=$(BULK_MEMORY_THRESHOLD) | |
503 | ||
5ccfab77 | 504 | $(LIBWASI_EMULATED_SIGNAL_MUSL_OBJS): CFLAGS += \ |
d1cd4f48 DG |
505 | -D_WASI_EMULATED_SIGNAL |
506 | ||
8e8cc34a | 507 | $(OBJDIR)/%.long-double.o: $(CURDIR)/%.c include_dirs |
320054e8 | 508 | @mkdir -p "$(@D)" |
9e09e02a | 509 | $(CC) $(CFLAGS) -MD -MP -o $@ -c $< |
dcf13b6f | 510 | |
8e8cc34a | 511 | $(OBJDIR)/%.no-floating-point.o: $(CURDIR)/%.c include_dirs |
320054e8 | 512 | @mkdir -p "$(@D)" |
9e09e02a | 513 | $(CC) $(CFLAGS) -MD -MP -o $@ -c $< |
320054e8 | 514 | |
8e8cc34a | 515 | $(OBJDIR)/%.o: $(CURDIR)/%.c include_dirs |
320054e8 | 516 | @mkdir -p "$(@D)" |
9e09e02a | 517 | $(CC) $(CFLAGS) -MD -MP -o $@ -c $< |
320054e8 | 518 | |
255e6f7c | 519 | -include $(shell find $(OBJDIR) -name \*.d) |
320054e8 | 520 | |
5ccfab77 | 521 | $(DLMALLOC_OBJS): CFLAGS += \ |
320054e8 DG |
522 | -I$(DLMALLOC_INC) |
523 | ||
5ccfab77 | 524 | startup_files $(LIBC_BOTTOM_HALF_ALL_OBJS): CFLAGS += \ |
320054e8 DG |
525 | -I$(LIBC_BOTTOM_HALF_HEADERS_PRIVATE) \ |
526 | -I$(LIBC_BOTTOM_HALF_CLOUDLIBC_SRC_INC) \ | |
87c2aa04 AB |
527 | -I$(LIBC_BOTTOM_HALF_CLOUDLIBC_SRC) \ |
528 | -I$(LIBC_TOP_HALF_MUSL_SRC_DIR)/include \ | |
529 | -I$(LIBC_TOP_HALF_MUSL_SRC_DIR)/internal | |
320054e8 | 530 | |
5ccfab77 | 531 | $(LIBC_TOP_HALF_ALL_OBJS) $(MUSL_PRINTSCAN_LONG_DOUBLE_OBJS) $(MUSL_PRINTSCAN_NO_FLOATING_POINT_OBJS) $(LIBWASI_EMULATED_SIGNAL_MUSL_OBJS): CFLAGS += \ |
320054e8 DG |
532 | -I$(LIBC_TOP_HALF_MUSL_SRC_DIR)/include \ |
533 | -I$(LIBC_TOP_HALF_MUSL_SRC_DIR)/internal \ | |
534 | -I$(LIBC_TOP_HALF_MUSL_DIR)/arch/wasm32 \ | |
535 | -I$(LIBC_TOP_HALF_MUSL_DIR)/arch/generic \ | |
536 | -I$(LIBC_TOP_HALF_HEADERS_PRIVATE) \ | |
537 | -Wno-parentheses \ | |
538 | -Wno-shift-op-parentheses \ | |
539 | -Wno-bitwise-op-parentheses \ | |
540 | -Wno-logical-op-parentheses \ | |
541 | -Wno-string-plus-int \ | |
542 | -Wno-dangling-else \ | |
543 | -Wno-unknown-pragmas | |
544 | ||
b9b64a69 DG |
545 | $(LIBWASI_EMULATED_PROCESS_CLOCKS_OBJS): CFLAGS += \ |
546 | -I$(LIBC_BOTTOM_HALF_CLOUDLIBC_SRC) | |
547 | ||
8e8cc34a | 548 | include_dirs: |
dcf13b6f DG |
549 | # |
550 | # Install the include files. | |
551 | # | |
320054e8 | 552 | mkdir -p "$(SYSROOT_INC)" |
320054e8 DG |
553 | cp -r "$(LIBC_BOTTOM_HALF_HEADERS_PUBLIC)"/* "$(SYSROOT_INC)" |
554 | ||
555 | # Generate musl's bits/alltypes.h header. | |
556 | mkdir -p "$(SYSROOT_INC)/bits" | |
557 | sed -f $(LIBC_TOP_HALF_MUSL_DIR)/tools/mkalltypes.sed \ | |
558 | $(LIBC_TOP_HALF_MUSL_DIR)/arch/wasm32/bits/alltypes.h.in \ | |
559 | $(LIBC_TOP_HALF_MUSL_DIR)/include/alltypes.h.in \ | |
560 | > "$(SYSROOT_INC)/bits/alltypes.h" | |
561 | ||
562 | # Copy in the bulk of musl's public header files. | |
563 | cp -r "$(LIBC_TOP_HALF_MUSL_INC)"/* "$(SYSROOT_INC)" | |
564 | # Copy in the musl's "bits" header files. | |
565 | cp -r "$(LIBC_TOP_HALF_MUSL_DIR)"/arch/generic/bits/* "$(SYSROOT_INC)/bits" | |
566 | cp -r "$(LIBC_TOP_HALF_MUSL_DIR)"/arch/wasm32/bits/* "$(SYSROOT_INC)/bits" | |
567 | ||
1f409842 DG |
568 | # Remove selected header files. |
569 | $(RM) $(patsubst %,$(SYSROOT_INC)/%,$(MUSL_OMIT_HEADERS)) | |
320054e8 | 570 | |
8e8cc34a | 571 | startup_files: include_dirs |
dcf13b6f | 572 | # |
320054e8 | 573 | # Build the startup files. |
dcf13b6f | 574 | # |
320054e8 DG |
575 | @mkdir -p "$(OBJDIR)" |
576 | cd "$(OBJDIR)" && \ | |
9e09e02a | 577 | $(CC) $(CFLAGS) -c $(LIBC_BOTTOM_HALF_CRT_SOURCES) -MD -MP && \ |
320054e8 DG |
578 | mkdir -p "$(SYSROOT_LIB)" && \ |
579 | mv *.o "$(SYSROOT_LIB)" | |
dcf13b6f | 580 | |
8e8cc34a | 581 | libc: include_dirs \ |
320054e8 DG |
582 | $(SYSROOT_LIB)/libc.a \ |
583 | $(SYSROOT_LIB)/libc-printscan-long-double.a \ | |
584 | $(SYSROOT_LIB)/libc-printscan-no-floating-point.a \ | |
d1cd4f48 | 585 | $(SYSROOT_LIB)/libwasi-emulated-mman.a \ |
b9b64a69 | 586 | $(SYSROOT_LIB)/libwasi-emulated-process-clocks.a \ |
659ff414 | 587 | $(SYSROOT_LIB)/libwasi-emulated-getpid.a \ |
d1cd4f48 | 588 | $(SYSROOT_LIB)/libwasi-emulated-signal.a |
320054e8 | 589 | |
8e8cc34a | 590 | finish: startup_files libc |
dcf13b6f | 591 | # |
320054e8 | 592 | # Create empty placeholder libraries. |
dcf13b6f | 593 | # |
1f7d798a | 594 | for name in m rt pthread crypt util xnet resolv dl; do \ |
9eb4a995 | 595 | $(AR) crs "$(SYSROOT_LIB)/lib$${name}.a"; \ |
320054e8 | 596 | done |
dbfccac2 | 597 | |
c7465d22 AL |
598 | # |
599 | # The build succeeded! The generated sysroot is in $(SYSROOT). | |
600 | # | |
601 | ||
602 | # The check for defined and undefined symbols expects there to be a heap | |
603 | # alloctor (providing malloc, calloc, free, etc). Skip this step if the build | |
604 | # is done without a malloc implementation. | |
605 | ifneq ($(MALLOC_IMPL),none) | |
606 | finish: check-symbols | |
607 | endif | |
608 | ||
18f9e0aa JE |
609 | DEFINED_SYMBOLS = $(SYSROOT_SHARE)/defined-symbols.txt |
610 | UNDEFINED_SYMBOLS = $(SYSROOT_SHARE)/undefined-symbols.txt | |
611 | ||
c7465d22 | 612 | check-symbols: startup_files libc |
dbfccac2 | 613 | # |
320054e8 | 614 | # Collect metadata on the sysroot and perform sanity checks. |
dbfccac2 | 615 | # |
320054e8 DG |
616 | mkdir -p "$(SYSROOT_SHARE)" |
617 | ||
41af0db3 | 618 | # |
320054e8 | 619 | # Collect symbol information. |
41af0db3 DG |
620 | # |
621 | @# TODO: Use llvm-nm --extern-only instead of grep. This is blocked on | |
622 | @# LLVM PR40497, which is fixed in 9.0, but not in 8.0. | |
623 | @# Ignore certain llvm builtin symbols such as those starting with __mul | |
624 | @# since these dependencies can vary between llvm versions. | |
a279514a | 625 | "$(NM)" --defined-only "$(SYSROOT_LIB)"/libc.a "$(SYSROOT_LIB)"/libwasi-emulated-*.a "$(SYSROOT_LIB)"/*.o \ |
294b23c3 | 626 | |grep ' [[:upper:]] ' |sed 's/.* [[:upper:]] //' |LC_ALL=C sort |uniq > "$(DEFINED_SYMBOLS)" |
a279514a | 627 | for undef_sym in $$("$(NM)" --undefined-only "$(SYSROOT_LIB)"/libc.a "$(SYSROOT_LIB)"/libc-*.a "$(SYSROOT_LIB)"/*.o \ |
fad009dc | 628 | |grep ' U ' |sed 's/.* U //' |LC_ALL=C sort |uniq); do \ |
18f9e0aa JE |
629 | grep -q '\<'$$undef_sym'\>' "$(DEFINED_SYMBOLS)" || echo $$undef_sym; \ |
630 | done | grep -v "^__mul" > "$(UNDEFINED_SYMBOLS)" | |
631 | grep '^_*imported_wasi_' "$(UNDEFINED_SYMBOLS)" \ | |
320054e8 DG |
632 | > "$(SYSROOT_LIB)/libc.imports" |
633 | ||
41af0db3 | 634 | # |
b1196b49 | 635 | # Generate a test file that includes all public C header files. |
41af0db3 | 636 | # |
4cb4b26f | 637 | cd "$(SYSROOT_INC)" && \ |
b1196b49 | 638 | for header in $$(find . -type f -not -name mman.h -not -name signal.h -not -name times.h -not -name resource.h |grep -v /bits/ |grep -v /c++/); do \ |
4cb4b26f JE |
639 | echo '#include <'$$header'>' | sed 's/\.\///' ; \ |
640 | done |LC_ALL=C sort >$(SYSROOT_SHARE)/include-all.c ; \ | |
320054e8 DG |
641 | cd - >/dev/null |
642 | ||
41af0db3 | 643 | # |
320054e8 | 644 | # Test that it compiles. |
41af0db3 | 645 | # |
9e09e02a | 646 | $(CC) $(CFLAGS) -fsyntax-only "$(SYSROOT_SHARE)/include-all.c" -Wno-\#warnings |
320054e8 | 647 | |
8df0d4cd | 648 | # |
41af0db3 DG |
649 | # Collect all the predefined macros, except for compiler version macros |
650 | # which we don't need to track here. | |
8df0d4cd | 651 | # |
41af0db3 DG |
652 | @# |
653 | @# For the __*_ATOMIC_*_LOCK_FREE macros, squash individual compiler names | |
654 | @# to attempt, toward keeping these files compiler-independent. | |
655 | @# | |
656 | @# We have to add `-isystem $(SYSROOT_INC)` because otherwise clang puts | |
657 | @# its builtin include path first, which produces compiler-specific | |
658 | @# output. | |
659 | @# | |
660 | @# TODO: Undefine __FLOAT128__ for now since it's not in clang 8.0. | |
661 | @# TODO: Filter out __FLT16_* for now, as not all versions of clang have these. | |
df006e12 | 662 | @# TODO: Filter out __NO_MATH_ERRNO_ and a few __*WIDTH__ that are new to clang 14. |
e9fcbdea MH |
663 | @# TODO: clang defined __FLT_EVAL_METHOD__ until clang 15, so we force-undefine it |
664 | @# for older versions. | |
cf850d1a MH |
665 | @# TODO: Undefine __wasm_mutable_globals__ and __wasm_sign_ext__, that are new to |
666 | @# clang 16 for -mcpu=generic. | |
667 | @# TODO: As of clang 16, __GNUC_VA_LIST is #defined without a value. | |
9e09e02a | 668 | $(CC) $(CFLAGS) "$(SYSROOT_SHARE)/include-all.c" \ |
8df0d4cd | 669 | -isystem $(SYSROOT_INC) \ |
38b930a2 | 670 | -std=gnu17 \ |
320054e8 | 671 | -E -dM -Wno-\#warnings \ |
9f0d8e85 | 672 | -D_ALL_SOURCE \ |
320054e8 DG |
673 | -U__llvm__ \ |
674 | -U__clang__ \ | |
675 | -U__clang_major__ \ | |
676 | -U__clang_minor__ \ | |
677 | -U__clang_patchlevel__ \ | |
678 | -U__clang_version__ \ | |
ad513341 MH |
679 | -U__clang_literal_encoding__ \ |
680 | -U__clang_wide_literal_encoding__ \ | |
cf850d1a MH |
681 | -U__wasm_mutable_globals__ \ |
682 | -U__wasm_sign_ext__ \ | |
320054e8 DG |
683 | -U__GNUC__ \ |
684 | -U__GNUC_MINOR__ \ | |
685 | -U__GNUC_PATCHLEVEL__ \ | |
686 | -U__VERSION__ \ | |
687 | -U__FLOAT128__ \ | |
df006e12 MH |
688 | -U__NO_MATH_ERRNO__ \ |
689 | -U__BITINT_MAXWIDTH__ \ | |
e9fcbdea | 690 | -U__FLT_EVAL_METHOD__ -Wno-builtin-macro-redefined \ |
320054e8 | 691 | | sed -e 's/__[[:upper:][:digit:]]*_ATOMIC_\([[:upper:][:digit:]_]*\)_LOCK_FREE/__compiler_ATOMIC_\1_LOCK_FREE/' \ |
cf850d1a | 692 | | sed -e 's/__GNUC_VA_LIST $$/__GNUC_VA_LIST 1/' \ |
f74124a6 | 693 | | grep -v '^#define __FLT16_' \ |
df006e12 | 694 | | grep -v '^#define __\(BOOL\|INT_\(LEAST\|FAST\)\(8\|16\|32\|64\)\|INT\|LONG\|LLONG\|SHRT\)_WIDTH__' \ |
320054e8 DG |
695 | > "$(SYSROOT_SHARE)/predefined-macros.txt" |
696 | ||
320054e8 | 697 | # Check that the computed metadata matches the expected metadata. |
255e6f7c | 698 | # This ignores whitespace because on Windows the output has CRLF line endings. |
f1af8cea | 699 | diff -wur "$(CURDIR)/expected/$(TARGET_TRIPLE)" "$(SYSROOT_SHARE)" |
320054e8 | 700 | |
8e8cc34a | 701 | install: finish |
320054e8 DG |
702 | mkdir -p "$(INSTALL_DIR)" |
703 | cp -r "$(SYSROOT)/lib" "$(SYSROOT)/share" "$(SYSROOT)/include" "$(INSTALL_DIR)" | |
704 | ||
111c8729 JE |
705 | clean: |
706 | $(RM) -r "$(OBJDIR)" | |
707 | $(RM) -r "$(SYSROOT)" | |
708 | ||
709 | .PHONY: default startup_files libc finish install include_dirs clean |