summaryrefslogtreecommitdiff
path: root/Libraries/LibC/CMakeLists.txt
blob: feee96aa9716967f4e38f0370ed5789dd6c5a0b9 (plain)
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
set(LIBC_SOURCES
    arpa/inet.cpp
    assert.cpp
    crt0.cpp
    ctype.cpp
    cxaatexit.cpp
    dirent.cpp
    dlfcn.cpp
    fcntl.cpp
    getopt.cpp
    grp.cpp
    ioctl.cpp
    libcinit.cpp
    libgen.cpp
    locale.cpp
    malloc.cpp
    mman.cpp
    mntent.cpp
    netdb.cpp
    poll.cpp
    pwd.cpp
    qsort.cpp
    scanf.cpp
    sched.cpp
    serenity.cpp
    setjmp.S
    signal.cpp
    stat.cpp
    stdio.cpp
    stdlib.cpp
    string.cpp
    strings.cpp
    syslog.cpp
    sys/ptrace.cpp
    sys/select.cpp
    sys/socket.cpp
    sys/uio.cpp
    sys/wait.cpp
    termcap.cpp
    termios.cpp
    time.cpp
    times.cpp
    ulimit.cpp
    unistd.cpp
    utime.cpp
    utsname.cpp
    wchar.cpp
)

file(GLOB AK_SOURCES "../../AK/*.cpp")
file(GLOB ELF_SOURCES "../LibELF/*.cpp")
set(ELF_SOURCES ${ELF_SOURCES} ../LibELF/Arch/i386/plt_trampoline.S)

add_library(crt0 STATIC crt0.cpp)
# We need include headers from LibC in crt0. namely, <assert.h>
target_include_directories(crt0 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_custom_command(
    TARGET crt0
    COMMAND install -D $<TARGET_OBJECTS:crt0> ${CMAKE_INSTALL_PREFIX}/usr/lib/crt0.o
)

set(SOURCES ${LIBC_SOURCES} ${AK_SOURCES} ${ELF_SOURCES})
serenity_libc(LibC c)
target_link_libraries(LibC crt0)
add_dependencies(LibC LibM LibCxx)