xref: /llvm-project/libc/src/unistd/CMakeLists.txt (revision defd0d966d5ebae37787e76b86f2f2ff2a5cfd59)
1if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
2  add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS})
3endif()
4
5add_entrypoint_object(
6  _exit
7  SRCS
8    _exit.cpp
9  HDRS
10    _exit.h
11  DEPENDS
12    libc.include.unistd
13    libc.src.__support.OSUtil.osutil
14)
15
16add_entrypoint_object(
17  access
18  ALIAS
19  DEPENDS
20    .${LIBC_TARGET_OS}.access
21)
22
23add_entrypoint_object(
24  chdir
25  ALIAS
26  DEPENDS
27    .${LIBC_TARGET_OS}.chdir
28)
29
30add_entrypoint_object(
31  close
32  ALIAS
33  DEPENDS
34    .${LIBC_TARGET_OS}.close
35)
36
37add_entrypoint_object(
38  dup
39  ALIAS
40  DEPENDS
41    .${LIBC_TARGET_OS}.dup
42)
43
44add_entrypoint_object(
45  dup2
46  ALIAS
47  DEPENDS
48    .${LIBC_TARGET_OS}.dup2
49)
50
51add_entrypoint_object(
52  dup3
53  ALIAS
54  DEPENDS
55    .${LIBC_TARGET_OS}.dup3
56)
57
58add_entrypoint_object(
59  fchdir
60  ALIAS
61  DEPENDS
62    .${LIBC_TARGET_OS}.fchdir
63)
64
65add_entrypoint_object(
66  fork
67  ALIAS
68  DEPENDS
69    .${LIBC_TARGET_OS}.fork
70)
71
72add_entrypoint_object(
73  fpathconf
74  ALIAS
75  DEPENDS
76    .${LIBC_TARGET_OS}.fpathconf
77)
78
79add_entrypoint_object(
80  execv
81  ALIAS
82  DEPENDS
83    .${LIBC_TARGET_OS}.execv
84)
85
86add_entrypoint_object(
87  execve
88  ALIAS
89  DEPENDS
90    .${LIBC_TARGET_OS}.execve
91)
92
93add_entrypoint_object(
94  fsync
95  ALIAS
96  DEPENDS
97    .${LIBC_TARGET_OS}.fsync
98)
99
100add_entrypoint_object(
101  ftruncate
102  ALIAS
103  DEPENDS
104    .${LIBC_TARGET_OS}.ftruncate
105)
106
107add_entrypoint_object(
108  getcwd
109  ALIAS
110  DEPENDS
111    .${LIBC_TARGET_OS}.getcwd
112)
113
114add_entrypoint_object(
115  getpid
116  ALIAS
117  DEPENDS
118    .${LIBC_TARGET_OS}.getpid
119)
120
121add_entrypoint_object(
122  getppid
123  ALIAS
124  DEPENDS
125    .${LIBC_TARGET_OS}.getppid
126)
127
128add_entrypoint_object(
129  geteuid
130  ALIAS
131  DEPENDS
132    .${LIBC_TARGET_OS}.geteuid
133)
134
135add_entrypoint_object(
136  getuid
137  ALIAS
138  DEPENDS
139    .${LIBC_TARGET_OS}.getuid
140)
141
142add_entrypoint_object(
143  isatty
144  ALIAS
145  DEPENDS
146    .${LIBC_TARGET_OS}.isatty
147)
148
149add_entrypoint_object(
150  link
151  ALIAS
152  DEPENDS
153    .${LIBC_TARGET_OS}.link
154)
155
156add_entrypoint_object(
157  linkat
158  ALIAS
159  DEPENDS
160    .${LIBC_TARGET_OS}.linkat
161)
162
163add_entrypoint_object(
164  lseek
165  ALIAS
166  DEPENDS
167    .${LIBC_TARGET_OS}.lseek
168)
169
170add_entrypoint_object(
171  pathconf
172  ALIAS
173  DEPENDS
174    .${LIBC_TARGET_OS}.pathconf
175)
176
177
178add_entrypoint_object(
179  pipe
180  ALIAS
181  DEPENDS
182    .${LIBC_TARGET_OS}.pipe
183)
184
185add_entrypoint_object(
186  pipe2
187  ALIAS
188  DEPENDS
189    .${LIBC_TARGET_OS}.pipe2
190)
191
192add_entrypoint_object(
193  pread
194  ALIAS
195  DEPENDS
196    .${LIBC_TARGET_OS}.pread
197)
198
199add_entrypoint_object(
200  pwrite
201  ALIAS
202  DEPENDS
203    .${LIBC_TARGET_OS}.pwrite
204)
205
206add_entrypoint_object(
207  read
208  ALIAS
209  DEPENDS
210    .${LIBC_TARGET_OS}.read
211)
212
213add_entrypoint_object(
214  readlink
215  ALIAS
216  DEPENDS
217    .${LIBC_TARGET_OS}.readlink
218)
219
220add_entrypoint_object(
221  readlinkat
222  ALIAS
223  DEPENDS
224    .${LIBC_TARGET_OS}.readlinkat
225)
226
227add_entrypoint_object(
228  rmdir
229  ALIAS
230  DEPENDS
231    .${LIBC_TARGET_OS}.rmdir
232)
233
234add_entrypoint_object(
235  symlink
236  ALIAS
237  DEPENDS
238    .${LIBC_TARGET_OS}.symlink
239)
240
241add_entrypoint_object(
242  symlinkat
243  ALIAS
244  DEPENDS
245    .${LIBC_TARGET_OS}.symlinkat
246)
247
248add_entrypoint_object(
249  __llvm_libc_syscall
250  ALIAS
251  DEPENDS
252    .${LIBC_TARGET_OS}.__llvm_libc_syscall
253)
254
255add_entrypoint_object(
256  sysconf
257  ALIAS
258  DEPENDS
259    .${LIBC_TARGET_OS}.sysconf
260)
261
262add_entrypoint_object(
263  truncate
264  ALIAS
265  DEPENDS
266    .${LIBC_TARGET_OS}.truncate
267)
268
269add_entrypoint_object(
270  unlink
271  ALIAS
272  DEPENDS
273    .${LIBC_TARGET_OS}.unlink
274)
275
276add_entrypoint_object(
277  unlinkat
278  ALIAS
279  DEPENDS
280    .${LIBC_TARGET_OS}.unlinkat
281)
282
283add_entrypoint_object(
284  write
285  ALIAS
286  DEPENDS
287    .${LIBC_TARGET_OS}.write
288)
289
290add_entrypoint_object(
291  environ
292  SRCS
293    environ.cpp
294  HDRS
295    environ.h
296)
297
298add_entrypoint_object(
299  getopt
300  SRCS
301    getopt.cpp
302  HDRS
303    getopt.h
304  DEPENDS
305    libc.include.unistd
306    libc.src.__support.CPP.optional
307    libc.src.__support.CPP.string_view
308    libc.src.__support.File.file
309    libc.src.__support.File.platform_stderr
310    libc.src.stdio.fprintf
311)
312
313add_entrypoint_object(
314  swab
315  SRCS
316    swab.cpp
317  HDRS
318    swab.h
319  DEPENDS
320    libc.include.unistd
321    libc.src.__support.CPP.optional
322)
323
324# These aren't actual external per-se, but this is just an easy way to create
325# targets that don't do anything. They exist to be referenced in entrypoints.txt
326# so that the header will properly expose their definitions. Their declaration
327# is in getopt.cpp.
328add_entrypoint_external(
329  optarg
330)
331
332add_entrypoint_external(
333  optind
334)
335
336add_entrypoint_external(
337  optopt
338)
339
340add_entrypoint_external(
341  opterr
342)
343
344add_entrypoint_object(
345  gettid
346  SRCS
347    gettid.cpp
348  HDRS
349    gettid.h
350  DEPENDS
351    libc.src.__support.threads.identifier
352)
353
354add_entrypoint_object(
355  getentropy
356  ALIAS
357  DEPENDS
358    .${LIBC_TARGET_OS}.getentropy
359)
360