1add_subdirectory(llvm-libc-macros)
2add_subdirectory(llvm-libc-types)
3
4add_header(
5  llvm_libc_common_h
6  HDR
7    __llvm-libc-common.h
8)
9
10add_gen_header(
11  ctype
12  DEF_FILE ctype.h.def
13  GEN_HDR ctype.h
14  DEPENDS
15    .llvm_libc_common_h
16)
17
18add_gen_header(
19  fcntl
20  DEF_FILE fcntl.h.def
21  GEN_HDR fcntl.h
22  DEPENDS
23    .llvm_libc_common_h
24    .llvm-libc-macros.fcntl_macros
25    .llvm-libc-types.mode_t
26)
27
28add_gen_header(
29  fenv
30  DEF_FILE fenv.h.def
31  GEN_HDR fenv.h
32  DEPENDS
33    .llvm_libc_common_h
34    .llvm-libc-types.fenv_t
35    .llvm-libc-types.fexcept_t
36)
37
38add_gen_header(
39  inttypes
40  DEF_FILE inttypes.h.def
41  GEN_HDR inttypes.h
42  DEPENDS
43    .llvm_libc_common_h
44    .llvm-libc-types.imaxdiv_t
45)
46
47add_gen_header(
48  math
49  DEF_FILE math.h.def
50  GEN_HDR math.h
51  DEPENDS
52    .llvm_libc_common_h
53    .llvm-libc-types.double_t
54    .llvm-libc-types.float_t
55)
56
57add_gen_header(
58  assert_h
59  DEF_FILE assert.h.def
60  GEN_HDR assert.h
61  DEPENDS
62    .llvm_libc_common_h
63)
64
65add_gen_header(
66  string
67  DEF_FILE string.h.def
68  GEN_HDR string.h
69  DEPENDS
70    .llvm_libc_common_h
71    .llvm-libc-types.size_t
72)
73
74add_gen_header(
75  time
76  DEF_FILE time.h.def
77  GEN_HDR time.h
78  DEPENDS
79    .llvm_libc_common_h
80    .llvm-libc-types.time_t
81    .llvm-libc-types.struct_tm
82)
83
84add_gen_header(
85  threads
86  DEF_FILE threads.h.def
87  GEN_HDR threads.h
88  DEPENDS
89    .llvm_libc_common_h
90    .llvm-libc-types.__call_once_func_t
91    .llvm-libc-types.cnd_t
92    .llvm-libc-types.mtx_t
93    .llvm-libc-types.once_flag
94    .llvm-libc-types.thrd_start_t
95    .llvm-libc-types.thrd_t
96)
97
98add_gen_header(
99  errno
100  DEF_FILE errno.h.def
101  PARAMS
102    platform_errno=../config/${LIBC_TARGET_OS}/errno.h.in
103  GEN_HDR errno.h
104  DATA_FILES
105    ../config/${LIBC_TARGET_OS}/errno.h.in
106)
107
108add_gen_header(
109  signal
110  DEF_FILE signal.h.def
111  PARAMS
112    platform_signal=../config/${LIBC_TARGET_OS}/signal.h.in
113  GEN_HDR signal.h
114  DATA_FILES
115    ../config/${LIBC_TARGET_OS}/signal.h.in
116  DEPENDS
117    .llvm-libc-types.struct_sigaction
118    .llvm-libc-types.__sighandler_t
119)
120
121add_gen_header(
122  stdio
123  DEF_FILE stdio.h.def
124  GEN_HDR stdio.h
125  DEPENDS
126    .llvm_libc_common_h
127    .llvm-libc-macros.file_seek_macros
128    .llvm-libc-types.cookie_io_functions_t
129    .llvm-libc-types.FILE
130    .llvm-libc-types.size_t
131)
132
133add_gen_header(
134  stdlib
135  DEF_FILE stdlib.h.def
136  GEN_HDR stdlib.h
137  DEPENDS
138    .llvm_libc_common_h
139    .llvm-libc-types.__bsearchcompare_t
140    .llvm-libc-types.__qsortcompare_t
141    .llvm-libc-types.div_t
142    .llvm-libc-types.ldiv_t
143    .llvm-libc-types.lldiv_t
144    .llvm-libc-types.size_t
145    .llvm-libc-types.__atexithandler_t
146)
147
148add_gen_header(
149  unistd
150  DEF_FILE unistd.h.def
151  GEN_HDR unistd.h
152  DEPENDS
153    .llvm_libc_common_h
154    .llvm-libc-macros.file_seek_macros
155    .llvm-libc-types.size_t
156    .llvm-libc-types.ssize_t
157)
158
159add_gen_header(
160  pthread
161  DEF_FILE pthread.h.def
162  GEN_HDR pthread.h
163  DEPENDS
164    .llvm_libc_common_h
165    .llvm-libc-types.pthread_attr_t
166    .llvm-libc-types.pthread_mutexattr_t
167)
168
169# TODO: Not all platforms will have a include/sys directory. Add the sys
170# directory and the targets for sys/*.h files conditional to the OS requiring
171# them.
172file(MAKE_DIRECTORY "sys")
173
174add_gen_header(
175  sys_mman
176  DEF_FILE sys/mman.h.def
177  GEN_HDR sys/mman.h
178  DEPENDS
179    .llvm_libc_common_h
180    .llvm-libc-types.off_t
181    .llvm-libc-types.ssize_t
182)
183
184add_gen_header(
185  sys_stat
186  DEF_FILE sys/stat.h.def
187  GEN_HDR sys/stat.h
188  DEPENDS
189    .llvm_libc_common_h
190    .llvm-libc-types.mode_t
191)
192
193add_gen_header(
194  sys_syscall
195  DEF_FILE sys/syscall.h.def
196  GEN_HDR sys/syscall.h
197  PARAMS
198    syscall_numbers=../config/${LIBC_TARGET_OS}/syscall_numbers.h.inc
199  DATA_FILES
200    ../config/${LIBC_TARGET_OS}/syscall_numbers.h.inc
201)
202