1# Helper function to set up dependencies if they exist. 2function(add_macro_header name) 3 cmake_parse_arguments( 4 "MACRO_HEADER" 5 "" # Optional arguments 6 "HDR" # Single value arguments 7 "DEPENDS" # Multi-value arguments 8 ${ARGN} 9 ) 10 if(TARGET libc.include.llvm-libc-macros.${LIBC_TARGET_OS}.${name}) 11 add_header( 12 ${name} 13 HDR 14 ${MACRO_HEADER_HDR} 15 DEPENDS 16 .${LIBC_TARGET_OS}.${name} 17 ${MACRO_HEADER_DEPENDS} 18 ) 19 else() 20 add_header( 21 ${name} 22 HDR 23 ${MACRO_HEADER_HDR} 24 DEPENDS 25 ${MACRO_HEADER_DEPENDS} 26 ) 27 endif() 28endfunction(add_macro_header) 29 30if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) 31 add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/${LIBC_TARGET_OS}) 32endif() 33 34add_macro_header( 35 assert_macros 36 HDR 37 assert-macros.h 38) 39 40add_macro_header( 41 error_number_macros 42 HDR 43 error-number-macros.h 44) 45 46add_macro_header( 47 generic_error_number_macros 48 HDR 49 generic-error-number-macros.h 50) 51 52add_macro_header( 53 null_macro 54 HDR 55 null-macro.h 56) 57 58add_macro_header( 59 fcntl_macros 60 HDR 61 fcntl-macros.h 62) 63 64add_macro_header( 65 complex_macros 66 HDR 67 complex-macros.h 68) 69 70add_macro_header( 71 features_macros 72 HDR 73 features-macros.h 74) 75 76add_macro_header( 77 fenv_macros 78 HDR 79 fenv-macros.h 80) 81 82add_macro_header( 83 file_seek_macros 84 HDR 85 file-seek-macros.h 86) 87 88add_macro_header( 89 stdint_macros 90 HDR 91 stdint-macros.h 92) 93 94add_macro_header( 95 float_macros 96 HDR 97 float-macros.h 98) 99 100add_macro_header( 101 float16_macros 102 HDR 103 float16-macros.h 104) 105 106add_macro_header( 107 limits_macros 108 HDR 109 limits-macros.h 110) 111 112add_macro_header( 113 link_macros 114 HDR 115 link-macros.h 116) 117 118add_macro_header( 119 malloc_macros 120 HDR 121 malloc-macros.h 122) 123 124add_macro_header( 125 math_macros 126 HDR 127 math-macros.h 128 DEPENDS 129 .limits_macros 130) 131 132add_macro_header( 133 math_function_macros 134 HDR 135 math-function-macros.h 136 DEPENDS 137 .math_macros 138) 139 140add_macro_header( 141 offsetof_macro 142 HDR 143 offsetof-macro.h 144) 145 146add_macro_header( 147 containerof_macro 148 HDR 149 containerof-macro.h 150 DEPENDS 151 .offsetof_macro 152) 153 154add_macro_header( 155 sched_macros 156 HDR 157 sched-macros.h 158) 159 160add_macro_header( 161 signal_macros 162 HDR 163 signal-macros.h 164) 165 166add_macro_header( 167 stdbit_macros 168 HDR 169 stdbit-macros.h 170) 171 172add_macro_header( 173 stdio_macros 174 HDR 175 stdio-macros.h 176) 177 178add_macro_header( 179 stdlib_macros 180 HDR 181 stdlib-macros.h 182) 183 184add_macro_header( 185 sys_auxv_macros 186 HDR 187 sys-auxv-macros.h 188) 189 190add_macro_header( 191 sys_epoll_macros 192 HDR 193 sys-epoll-macros.h 194) 195 196add_macro_header( 197 sys_ioctl_macros 198 HDR 199 sys-ioctl-macros.h 200) 201 202add_macro_header( 203 sys_stat_macros 204 HDR 205 sys-stat-macros.h 206) 207 208add_macro_header( 209 sys_mman_macros 210 HDR 211 sys-mman-macros.h 212) 213 214add_macro_header( 215 sys_queue_macros 216 HDR 217 sys-queue-macros.h 218 DEPENDS 219 .null_macro 220 .containerof_macro 221) 222 223add_macro_header( 224 sys_random_macros 225 HDR 226 sys-random-macros.h 227) 228 229add_macro_header( 230 sys_resource_macros 231 HDR 232 sys-resource-macros.h 233) 234 235add_macro_header( 236 sys_select_macros 237 HDR 238 sys-select-macros.h 239) 240 241add_macro_header( 242 sys_socket_macros 243 HDR 244 sys-socket-macros.h 245) 246 247add_macro_header( 248 sys_time_macros 249 HDR 250 sys-time-macros.h 251) 252 253add_macro_header( 254 sys_wait_macros 255 HDR 256 sys-wait-macros.h 257) 258 259add_macro_header( 260 termios_macros 261 HDR 262 termios-macros.h 263) 264 265add_macro_header( 266 time_macros 267 HDR 268 time-macros.h 269) 270 271add_macro_header( 272 unistd_macros 273 HDR 274 unistd-macros.h 275) 276 277add_macro_header( 278 wchar_macros 279 HDR 280 wchar-macros.h 281) 282 283add_macro_header( 284 inttypes_macros 285 HDR 286 inttypes-macros.h 287) 288 289add_macro_header( 290 stdfix_macros 291 HDR 292 stdfix-macros.h 293) 294 295add_macro_header( 296 stdckdint_macros 297 HDR 298 stdckdint-macros.h 299) 300 301add_macro_header( 302 dlfcn_macros 303 HDR 304 dlfcn-macros.h 305) 306 307add_macro_header( 308 elf_macros 309 HDR 310 elf-macros.h 311) 312 313add_macro_header( 314 locale_macros 315 HDR 316 locale-macros.h 317) 318 319add_macro_header( 320 pthread_macros 321 HDR 322 pthread-macros.h 323) 324