Files

717 lines
26 KiB
Makefile

# vlibc — top-level build (see building/C.md and layouts/C.md).
SUBDIRS = benchmarks
# Build-dir include FIRST: configure generates include/vlibc/features.h
# (from the .in template) into the BUILD tree, and a VPATH build must find
# the generated header before the source tree's checked-in headers.
AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
AM_CFLAGS = @VLIBC_CFLAGS@
# ---- Library -------------------------------------------------------------
# Authoritative source-dir inventory (todo 6). Every directory a later plan
# todo creates is enumerated here ONCE, so no area can be forgotten; each is
# appended to libvlibc_la_SOURCES WHEN ITS TODO LANDS — the list grows
# incrementally and never references a directory that does not exist yet:
#
# Wired so far (W1-W3 + W5/W6 slices, each wired when its todo landed):
# src/internal, src/start, src/errno,
# src/setjmp/x86_64, src/string, crt/ (crt1.o),
# src/malloc (todo 7), src/ctype (todo 9,51),
# src/stdlib (todo 11-14, incl. the 13 env slice),
# src/unistd (todo 19), src/process (todo 20,23),
# src/fcntl (todo 21), src/stat (todo 22),
# src/dirent (todo 24), src/select (todo 25),
# src/time (todo 26 + todo 27's sys/time
# slice — gettimeofday/settimeofday/
# getitimer/setitimer/utimes.c + sys/time.h —
# all wired), src/stdio (todo 15-18 FILE core
# + popen; vfprintf.c/vfprintf_float.c now
# wired with the printf test),
# src/math (todo 39-42 basic set — all L1,
# wired with the consolidated math test)
# todo 39-42 src/math todo 50 src/multibyte
# todo 11-14 src/stdlib todo 43 src/complex todo 53-54 src/regex
# todo 15-18 src/stdio todo 9,51 src/ctype todo 57-58 src/network
# todo 19,38 src/unistd todo 55 src/search todo 59 src/mq
# todo 20,23,56 src/process todo 66 src/crypt todo 60 src/aio
# todo 21 src/fcntl todo 44-48 src/thread todo 61 src/ipc
# todo 22,34 src/stat todo 49,52 src/locale todo 62-63 src/ldso
# todo 24 src/dirent todo 42 src/fenv/x86_64
# todo 25 src/select
# todo 26-27 src/time
# todo 28 src/signal
# todo 29 src/termios
# todo 30 src/uio
# todo 31 src/resource
# todo 32,36,54,61,67 src/misc
# todo 33 src/mman
# todo 35 src/sys
# todo 37 src/passwd
# todo 37 src/group
#
# NOTE: crt/x86_64/crt1.s is NOT a library source — it is assembled into the
# standalone crt1.o below (the sole crt owner; todo 64 reuses, never rebuilds).
# Level-independent L1 core (wired today + the pre-plan string slice).
# W5/W6 additions follow the established split rule: whole-content-L2 TUs
# (lockf, mknod, readdir_r/scandir/alphasort, ppoll, strptime/timer) go to
# VLIBC_LEVEL2_SRCS; L1 bodies with L2 sections self-gated inside the .c
# (fork.c vfork, groups.c setgroups, session.c tail, wait.c wait3/wait4,
# time ctime/mktime/nanosleep/strftime/tzset L2 tails, stdio.c L2 tail,
# unistd lseek64/dup3/pipe2/truncate) stay in CORE. task-19's unistd dir is
# CORE throughout (self-gated L2 sections, no whole-file gate). T27's
# sys/time slice (gettimeofday/settimeofday/getitimer/setitimer/utimes) is
# whole-file L2, so it lives in VLIBC_LEVEL2_SRCS.
VLIBC_CORE_SRCS = \
src/vlibc.c \
src/internal/assert_fail.c \
src/internal/errno.c \
src/internal/syscall_ret.c \
src/start/libc_start_main.c \
src/start/exit.c \
src/start/environ.c \
src/start/tls.c \
src/thread/futex.c \
src/thread/pthread_self.c \
src/thread/tls.c \
src/thread/x86_64/__set_thread_area.s \
src/errno/strerror.c \
src/setjmp/x86_64/setjmp.s \
src/setjmp/x86_64/longjmp.s \
src/setjmp/x86_64/sigsetjmp.s \
src/setjmp/x86_64/siglongjmp.s \
src/string/strlen.c \
src/string/strcmp.c \
src/string/memcpy.c \
src/string/memmove.c \
src/string/memset.c \
src/string/strcat.c \
src/string/strchr.c \
src/string/strcoll.c \
src/string/strcpy.c \
src/string/strdup.c \
src/string/memchr.c \
src/string/memcmp.c \
src/string/strncmp.c \
src/string/strncpy.c \
src/string/strnlen.c \
src/string/strsignal.c \
src/string/strspn.c \
src/string/strstr.c \
src/string/strtok.c \
src/malloc/malloc.c \
src/ctype/ctype.c \
src/stdlib/strtox.c \
src/stdlib/strtox_impl.c \
src/stdlib/strtod.c \
src/stdlib/rand.c \
src/stdlib/qsort.c \
src/stdlib/div.c \
src/stdlib/inttypes.c \
src/stdlib/env.c \
src/stdlib/multibyte.c \
src/stdlib/mkstemp.c \
src/stdio/stdio.c \
src/stdio/fmemopen.c \
src/stdio/getline.c \
src/stdio/locking.c \
src/stdio/popen.c \
src/stdio/vfscanf.c \
src/stdio/vfprintf.c \
src/unistd/access.c \
src/unistd/close.c \
src/unistd/dup.c \
src/unistd/fsync.c \
src/unistd/lseek.c \
src/unistd/open.c \
src/unistd/pipe.c \
src/unistd/pread.c \
src/unistd/rw.c \
src/unistd/sync.c \
src/unistd/truncate.c \
src/unistd/chdir.c \
src/unistd/getcwd.c \
src/unistd/getlogin.c \
src/unistd/isatty.c \
src/unistd/link.c \
src/unistd/readlink.c \
src/unistd/renameat.c \
src/unistd/rmdir.c \
src/unistd/symlink.c \
src/unistd/ttyname.c \
src/unistd/unlink.c \
src/unistd/getopt.c \
src/process/atfork.c \
src/process/execl.c \
src/process/execle.c \
src/process/execlp.c \
src/process/execv.c \
src/process/execve.c \
src/process/execvp.c \
src/process/fork.c \
src/process/groups.c \
src/process/pid.c \
src/process/session.c \
src/process/system.c \
src/process/uid.c \
src/process/wait.c \
src/fcntl/creat.c \
src/fcntl/fcntl.c \
src/fcntl/posix_fadvise.c \
src/fcntl/posix_fallocate.c \
src/stat/chmod.c \
src/stat/chown.c \
src/stat/fstatat.c \
src/stat/mkdir.c \
src/stat/mkfifo.c \
src/stat/umask.c \
src/stat/utimensat.c \
src/dirent/closedir.c \
src/dirent/dirfd.c \
src/dirent/fdopendir.c \
src/dirent/opendir.c \
src/dirent/readdir.c \
src/dirent/rewinddir.c \
src/dirent/seekdir.c \
src/dirent/telldir.c \
src/select/poll.c \
src/select/pselect.c \
src/select/select.c \
src/time/time.c \
src/time/clock.c \
src/time/timespec_get.c \
src/time/sleep.c \
src/time/nanosleep.c \
src/time/mktime.c \
src/time/ctime.c \
src/time/tzset.c \
src/time/strftime.c \
src/mman/mmap.c \
src/passwd/passwd.c \
src/group/group.c \
src/math/cbrt.c \
src/math/ceil.c \
src/math/copysign.c \
src/math/exp.c \
src/math/fabs.c \
src/math/fdim.c \
src/math/floor.c \
src/math/fmax.c \
src/math/fmin.c \
src/math/fmod.c \
src/math/frexp.c \
src/math/hypot.c \
src/math/ilogb.c \
src/math/ldexp.c \
src/math/llrint.c \
src/math/llround.c \
src/math/log.c \
src/math/log1p.c \
src/math/logb.c \
src/math/lrint.c \
src/math/lround.c \
src/math/modf.c \
src/math/nearbyint.c \
src/math/pow.c \
src/math/remainder.c \
src/math/remquo.c \
src/math/rint.c \
src/math/round.c \
src/math/scalbn.c \
src/math/sqrt.c \
src/math/trunc.c
# Profile-gated sources, EXISTING gates preserved (strlcpy/strlcat stay L2
# BSD, strcasestr stays L3 GNU — NOT promoted). Task 8/9 additions: stpcpy.c
# (stpcpy/stpncpy) and memccpy.c are WHOLE-FILE L2-gated (#if VLIBC_LEVEL_GE(2)
# around the entire body), and isascii.c/toascii.c hold only L2 symbols
# (the header gates their declarations) — all four must be omitted from a
# level-1 profile, so they join the GE_2 conditional list. Task 10's
# strings_impl.c is likewise whole-file L2-gated (strcasecmp/strncasecmp/ffs/
# ffsl/ffsll/bcmp/bcopy/bzero/index/rindex — nothing is POSIX.1-2008 base), so
# it also joins the GE_2 conditional list. Files with L1
# bodies plus small L2 sections (strcoll.c, strdup.c) stay in VLIBC_CORE_SRCS
# and self-gate at level 1. Likewise rand.c (its L2 rand_r/drand48 section)
# and the strtox/strtod/inttypes/div/qsort C files (their L2 gates live in
# include/stdlib.h / include/inttypes.h declarations) stay in VLIBC_CORE_SRCS.
# W5/W6 whole-file-L2 joins (verified by reading each .c — the #if
# VLIBC_LEVEL_GE(2) wraps the whole body after the includes): lockf.c (XSI),
# mknod.c (XSI), readdir_r.c/scandir.c/alphasort.c (XSI dirent), ppoll.c
# (Linux), strptime.c/timer.c (POSIX timers), plus task 27's sys/time slice
# (gettimeofday.c/settimeofday.c/getitimer.c/setitimer.c/utimes.c — each
# whole-file L2, wired with the systime test), plus the earlier strings
# slice.
VLIBC_LEVEL2_SRCS = src/string/strlcpy.c src/string/strlcat.c \
src/string/stpcpy.c src/string/memccpy.c \
src/ctype/isascii.c src/ctype/toascii.c \
src/string/strings_impl.c \
src/stdlib/pty.c src/stdlib/getsubopt.c \
src/fcntl/lockf.c \
src/stat/mknod.c \
src/dirent/readdir_r.c src/dirent/scandir.c src/dirent/alphasort.c \
src/select/ppoll.c \
src/time/strptime.c src/time/timer.c \
src/time/gettimeofday.c src/time/settimeofday.c \
src/time/getitimer.c src/time/setitimer.c src/time/utimes.c \
src/stat/statvfs.c src/sys/times.c src/misc/syslog.c \
src/unistd/basename.c src/unistd/dirname.c src/unistd/realpath.c \
src/unistd/chroot.c src/unistd/swab.c src/unistd/confstr.c \
src/unistd/getwd.c
VLIBC_LEVEL3_SRCS = src/string/strcasestr.c
vlibc_lib_LTLIBRARIES = libvlibc.la
libvlibc_la_SOURCES = $(VLIBC_CORE_SRCS)
if PROFILE_GE_2
libvlibc_la_SOURCES += $(VLIBC_LEVEL2_SRCS)
endif
if PROFILE_GE_3
libvlibc_la_SOURCES += $(VLIBC_LEVEL3_SRCS)
endif
libvlibc_la_LDFLAGS = -version-info 0:0:0 -no-undefined
# ---- Public headers ------------------------------------------------------
# The whole public header inventory (the 3 scaffold headers plus todo 5's
# skeleton); the profile-gated generated features.h is installed separately
# below.
vlibc_include_HEADERS = \
include/vlibc.h \
include/stddef.h \
include/string.h \
include/strings.h \
include/errno.h \
include/setjmp.h \
include/assert.h \
include/ctype.h \
include/cpio.h \
include/float.h \
include/iso646.h \
include/limits.h \
include/stdalign.h \
include/stdarg.h \
include/stdatomic.h \
include/stdbit.h \
include/stdbool.h \
include/stdckdint.h \
include/stdint.h \
include/inttypes.h \
include/stdlib.h \
include/stdnoreturn.h \
include/tar.h \
include/math.h \
include/tgmath.h \
include/threads.h \
include/uchar.h \
include/dirent.h \
include/fcntl.h \
include/poll.h \
include/stdio.h \
include/time.h \
include/unistd.h \
include/syslog.h \
include/pwd.h \
include/grp.h \
include/libgen.h
# sys/* headers use their own primary so the sys/ subpath survives install:
# automake's flat _HEADERS install strips directory components, which would
# both drop the sys/ prefix for <sys/*.h> consumers AND collide on shared
# basenames (time.h vs sys/time.h, GNU install refuses the second copy).
vlibc_include_sys_HEADERS = \
include/sys/select.h \
include/sys/stat.h \
include/sys/time.h \
include/sys/types.h \
include/sys/wait.h \
include/sys/mman.h \
include/sys/statvfs.h \
include/sys/times.h
# Install location depends on the install method (see configure.ac).
if INSTALL_OVERWRITE
vlibc_includedir = $(includedir)
vlibc_libdir = $(libdir)
else
vlibc_includedir = $(prefix)/lib/vlibc/include
vlibc_libdir = $(prefix)/lib/vlibc/lib
endif
# sys/* headers live under $(vlibc_includedir)/sys (see the sys primary
# above; must follow the INSTALL_OVERWRITE conditional to inherit the
# resolved vlibc_includedir).
vlibc_include_sysdir = $(vlibc_includedir)/sys
# Generated per-profile feature header (see configure.ac); installed under
# $(vlibc_includedir)/vlibc/. A dedicated primary is used because
# nodist_nobase_vlibc_include_HEADERS is rejected by automake (the "nobase"
# prefix is unsupported for this directory) and loses the vlibc/ path.
vlibc_featuresdir = $(vlibc_includedir)/vlibc
nodist_vlibc_features_HEADERS = include/vlibc/features.h
# ---- Compiler drivers ----------------------------------------------------
bin_SCRIPTS = tools/vlibc-gcc tools/vlibc-clang
# ---- crt objects ---------------------------------------------------------
# crt1.o (from crt/x86_64/crt1.s) is built here and ONLY here: todo 64
# reuses these objects for the shared build and must NOT rebuild them.
# Built by `make all` via all-local so a static vlibc link always has its
# entry object available next to the archive.
crt1.o: crt/x86_64/crt1.s
$(AM_V_GEN)$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) -c -o $@ $<
all-local: crt1.o
# ---- Targets -------------------------------------------------------------
# layouts/C.md requires `make debug`, `make release`, `make bench` and
# `make clean`; build outputs land in bin/{release,debug}.
DEBUG_CFLAGS = -O0 -g3 -DDEBUG
RELEASE_CFLAGS = -O3 -DNDEBUG
debug:
$(MAKE) clean
$(MAKE) all AM_CFLAGS="$(AM_CFLAGS) $(DEBUG_CFLAGS)"
$(MKDIR_P) bin/debug
-cp -P .libs/libvlibc.so* bin/debug/
-cp .libs/libvlibc.a bin/debug/
-cp crt1.o bin/debug/
release:
$(MAKE) clean
$(MAKE) all AM_CFLAGS="$(AM_CFLAGS) $(RELEASE_CFLAGS)"
$(MKDIR_P) bin/release
-cp -P .libs/libvlibc.so* bin/release/
-cp .libs/libvlibc.a bin/release/
-cp crt1.o bin/release/
bench: all
$(MAKE) -C benchmarks bench
# Regenerate compile_commands.json (requires `bear`). Captures both the
# library sources and the on-demand benchmark harness.
compile-commands: clean
bear -- $(MAKE) all
bear --append -- $(MAKE) -C benchmarks bench_vlibc
.PHONY: debug release bench compile-commands
# ---- make check ----------------------------------------------------------
#
# Every test binary is a STATIC VLIBC EXECUTABLE: linked with -nostdlib
# -static -no-pie against crt1.o + a dedicated level-2 test archive. No
# glibc symbol can resolve, so each test genuinely proves self-hosting.
#
# The test archive (libvlibc-check.a) is compiled from the FULL source list
# (all levels included) at VLIBC_LEVEL=2 — the complete L1+L2 surface —
# INDEPENDENT of the configured profile. Rationale: some tests exercise
# L2-gated functions (test_strerror calls strerror_r, future tests call
# bcopy etc.), which a level-1 configured archive does not provide; the
# shipped libvlibc.a keeps the profile gating configured at build time.
# Object files are plain `ar` members compiled directly with $(CC) — no
# libtool (libtool's build-dir libvlibc.a is a wrapper script, and only
# .libs/libvlibc.a is linkable, which is a level-gated profile archive).
#
# Mechanics (extend here for future tests):
# - Add the binary to check_PROGRAMS + TESTS with
# `<bin>_SOURCES = tests/test_x.c`,
# `<bin>_CFLAGS = $(VLIBC_TEST_CFLAGS)` (renames the object to
# `<bin>-<src>.o` automatically),
# `<bin>_LINK = $(VLIBC_TEST_LINK)` and
# `<bin>_LDADD = $(VLIBC_TEST_LDADD)` (static vlibc link; the crt
# object + archive must be in LDADD so they follow the test object).
# - Multi-mode tests run through tests/startup_modes.sh (see that file).
VLIBC_TEST_LEVEL = 2
VLIBC_CHECK_SRCS = $(VLIBC_CORE_SRCS) $(VLIBC_LEVEL2_SRCS) \
$(VLIBC_LEVEL3_SRCS)
VLIBC_CHECK_OBJECTS_FROM_C = $(VLIBC_CHECK_SRCS:.c=.check.o)
VLIBC_CHECK_OBJECTS = $(VLIBC_CHECK_OBJECTS_FROM_C:.s=.check.o)
VLIBC_CHECK_CFLAGS = @VLIBC_CFLAGS@ -DVLIBC_LEVEL=$(VLIBC_TEST_LEVEL) -fno-pic
# The archive itself (plain ar: members compiled at the test level).
libvlibc-check.a: $(VLIBC_CHECK_OBJECTS)
$(AR) $(ARFLAGS) $@ $^
# Library sources compiled at the test level. Deliberately no
# -DHAVE_CONFIG_H and no $(DEFS): config.h pins the PROFILE level, which
# would override -DVLIBC_LEVEL (last definition wins), so the check objects
# must get their level from <vlibc/features.h> alone.
%.check.o: %.c
$(AM_V_CC)$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) $(VLIBC_CHECK_CFLAGS) -c -o $@ $<
%.check.o: %.s
$(AM_V_CCAS)$(CC) $(AM_CPPFLAGS) $(CPPFLAGS) -c -o $@ $<
# Static vlibc link for every check program. automake links
# "$(<bin>_LINK) $(<bin>_OBJECTS) $(<bin>_LDADD) $(LIBS)", so the entry
# object, the level-2 archive and libgcc go in LDADD — they MUST follow the
# test object or the archive would see no undefined symbols and stay
# unextracted. -nostdlib means -lgcc is not auto-added, so it is spelled
# out (permitted libgcc helpers).
VLIBC_TEST_LINK = $(CC) -nostdlib -static -no-pie -o $@
VLIBC_TEST_LDADD = crt1.o libvlibc-check.a -lgcc
# Test TUs: no stack protector (the library is protector-free at this stage),
# non-PIC, level overridden to the test level so L2 declarations are visible.
VLIBC_TEST_CFLAGS = -DVLIBC_LEVEL=$(VLIBC_TEST_LEVEL) -fno-stack-protector \
-fno-pic -fno-pie
check_PROGRAMS = test_syscall test_strerror test_setjmp test_headers \
test_startup test_malloc test_string test_ctype test_strings \
test_strtol test_qsort test_inttypes test_env \
test_process test_fcntl test_stat test_wait test_dirent \
test_poll test_time test_scanf test_getline \
test_systime test_printf test_stdio test_unistd_file \
test_mman test_statvfs test_times test_syslog test_pwdgrp \
test_unistd_misc test_math_basic
test_syscall_SOURCES = tests/syscall_test.c
test_syscall_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_syscall_DEPENDENCIES = crt1.o libvlibc-check.a
test_syscall_LINK = $(VLIBC_TEST_LINK)
test_syscall_LDADD = $(VLIBC_TEST_LDADD)
test_strerror_SOURCES = tests/test_strerror.c
test_strerror_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_strerror_DEPENDENCIES = crt1.o libvlibc-check.a
test_strerror_LINK = $(VLIBC_TEST_LINK)
test_strerror_LDADD = $(VLIBC_TEST_LDADD)
test_setjmp_SOURCES = tests/test_setjmp.c
test_setjmp_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_setjmp_DEPENDENCIES = crt1.o libvlibc-check.a
test_setjmp_LINK = $(VLIBC_TEST_LINK)
test_setjmp_LDADD = $(VLIBC_TEST_LDADD)
test_headers_SOURCES = tests/test_headers.c
test_headers_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_headers_DEPENDENCIES = crt1.o libvlibc-check.a
test_headers_LINK = $(VLIBC_TEST_LINK)
test_headers_LDADD = $(VLIBC_TEST_LDADD)
test_startup_SOURCES = tests/test_startup.c
test_startup_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_startup_DEPENDENCIES = crt1.o libvlibc-check.a
test_startup_LINK = $(VLIBC_TEST_LINK)
test_startup_LDADD = $(VLIBC_TEST_LDADD)
test_malloc_SOURCES = tests/test_malloc.c
test_malloc_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_malloc_DEPENDENCIES = crt1.o libvlibc-check.a
test_malloc_LINK = $(VLIBC_TEST_LINK)
test_malloc_LDADD = $(VLIBC_TEST_LDADD)
test_string_SOURCES = tests/test_string.c
test_string_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_string_DEPENDENCIES = crt1.o libvlibc-check.a
test_string_LINK = $(VLIBC_TEST_LINK)
test_string_LDADD = $(VLIBC_TEST_LDADD)
test_ctype_SOURCES = tests/test_ctype.c
test_ctype_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_ctype_DEPENDENCIES = crt1.o libvlibc-check.a
test_ctype_LINK = $(VLIBC_TEST_LINK)
test_ctype_LDADD = $(VLIBC_TEST_LDADD)
test_strings_SOURCES = tests/test_strings.c
test_strings_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_strings_DEPENDENCIES = crt1.o libvlibc-check.a
test_strings_LINK = $(VLIBC_TEST_LINK)
test_strings_LDADD = $(VLIBC_TEST_LDADD)
test_strtol_SOURCES = tests/test_strtol.c
test_strtol_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_strtol_DEPENDENCIES = crt1.o libvlibc-check.a
test_strtol_LINK = $(VLIBC_TEST_LINK)
test_strtol_LDADD = $(VLIBC_TEST_LDADD)
test_qsort_SOURCES = tests/test_qsort.c
test_qsort_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_qsort_DEPENDENCIES = crt1.o libvlibc-check.a
test_qsort_LINK = $(VLIBC_TEST_LINK)
test_qsort_LDADD = $(VLIBC_TEST_LDADD)
test_inttypes_SOURCES = tests/test_inttypes.c
test_inttypes_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_inttypes_DEPENDENCIES = crt1.o libvlibc-check.a
test_inttypes_LINK = $(VLIBC_TEST_LINK)
test_inttypes_LDADD = $(VLIBC_TEST_LDADD)
test_env_SOURCES = tests/test_env.c
test_env_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_env_DEPENDENCIES = crt1.o libvlibc-check.a
test_env_LINK = $(VLIBC_TEST_LINK)
test_env_LDADD = $(VLIBC_TEST_LDADD)
test_process_SOURCES = tests/test_process.c
test_process_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_process_DEPENDENCIES = crt1.o libvlibc-check.a
test_process_LINK = $(VLIBC_TEST_LINK)
test_process_LDADD = $(VLIBC_TEST_LDADD)
test_fcntl_SOURCES = tests/test_fcntl.c
test_fcntl_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_fcntl_DEPENDENCIES = crt1.o libvlibc-check.a
test_fcntl_LINK = $(VLIBC_TEST_LINK)
test_fcntl_LDADD = $(VLIBC_TEST_LDADD)
test_stat_SOURCES = tests/test_stat.c
test_stat_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_stat_DEPENDENCIES = crt1.o libvlibc-check.a
test_stat_LINK = $(VLIBC_TEST_LINK)
test_stat_LDADD = $(VLIBC_TEST_LDADD)
test_wait_SOURCES = tests/test_wait.c
test_wait_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_wait_DEPENDENCIES = crt1.o libvlibc-check.a
test_wait_LINK = $(VLIBC_TEST_LINK)
test_wait_LDADD = $(VLIBC_TEST_LDADD)
test_dirent_SOURCES = tests/test_dirent.c
test_dirent_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_dirent_DEPENDENCIES = crt1.o libvlibc-check.a
test_dirent_LINK = $(VLIBC_TEST_LINK)
test_dirent_LDADD = $(VLIBC_TEST_LDADD)
test_poll_SOURCES = tests/test_poll.c
test_poll_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_poll_DEPENDENCIES = crt1.o libvlibc-check.a
test_poll_LINK = $(VLIBC_TEST_LINK)
test_poll_LDADD = $(VLIBC_TEST_LDADD)
test_time_SOURCES = tests/test_time.c
test_time_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_time_DEPENDENCIES = crt1.o libvlibc-check.a
test_time_LINK = $(VLIBC_TEST_LINK)
test_time_LDADD = $(VLIBC_TEST_LDADD)
test_scanf_SOURCES = tests/test_scanf.c
test_scanf_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_scanf_DEPENDENCIES = crt1.o libvlibc-check.a
test_scanf_LINK = $(VLIBC_TEST_LINK)
test_scanf_LDADD = $(VLIBC_TEST_LDADD)
test_getline_SOURCES = tests/test_getline.c
test_getline_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_getline_DEPENDENCIES = crt1.o libvlibc-check.a
test_getline_LINK = $(VLIBC_TEST_LINK)
test_getline_LDADD = $(VLIBC_TEST_LDADD)
test_systime_SOURCES = tests/test_systime.c
test_systime_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_systime_DEPENDENCIES = crt1.o libvlibc-check.a
test_systime_LINK = $(VLIBC_TEST_LINK)
test_systime_LDADD = $(VLIBC_TEST_LDADD)
test_printf_SOURCES = tests/test_printf.c
test_printf_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_printf_DEPENDENCIES = crt1.o libvlibc-check.a
test_printf_LINK = $(VLIBC_TEST_LINK)
test_printf_LDADD = $(VLIBC_TEST_LDADD)
test_stdio_SOURCES = tests/test_stdio.c
test_stdio_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_stdio_DEPENDENCIES = crt1.o libvlibc-check.a
test_stdio_LINK = $(VLIBC_TEST_LINK)
test_stdio_LDADD = $(VLIBC_TEST_LDADD)
test_unistd_file_SOURCES = tests/test_unistd_file.c
test_unistd_file_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_unistd_file_DEPENDENCIES = crt1.o libvlibc-check.a
test_unistd_file_LINK = $(VLIBC_TEST_LINK)
test_unistd_file_LDADD = $(VLIBC_TEST_LDADD)
test_mman_SOURCES = tests/test_mman.c
test_mman_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_mman_DEPENDENCIES = crt1.o libvlibc-check.a
test_mman_LINK = $(VLIBC_TEST_LINK)
test_mman_LDADD = $(VLIBC_TEST_LDADD)
test_statvfs_SOURCES = tests/test_statvfs.c
test_statvfs_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_statvfs_DEPENDENCIES = crt1.o libvlibc-check.a
test_statvfs_LINK = $(VLIBC_TEST_LINK)
test_statvfs_LDADD = $(VLIBC_TEST_LDADD)
test_times_SOURCES = tests/test_times.c
test_times_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_times_DEPENDENCIES = crt1.o libvlibc-check.a
test_times_LINK = $(VLIBC_TEST_LINK)
test_times_LDADD = $(VLIBC_TEST_LDADD)
test_syslog_SOURCES = tests/test_syslog.c
test_syslog_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_syslog_DEPENDENCIES = crt1.o libvlibc-check.a
test_syslog_LINK = $(VLIBC_TEST_LINK)
test_syslog_LDADD = $(VLIBC_TEST_LDADD)
test_pwdgrp_SOURCES = tests/test_pwdgrp.c
test_pwdgrp_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_pwdgrp_DEPENDENCIES = crt1.o libvlibc-check.a
test_pwdgrp_LINK = $(VLIBC_TEST_LINK)
test_pwdgrp_LDADD = $(VLIBC_TEST_LDADD)
test_unistd_misc_SOURCES = tests/test_unistd_misc.c
test_unistd_misc_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_unistd_misc_DEPENDENCIES = crt1.o libvlibc-check.a
test_unistd_misc_LINK = $(VLIBC_TEST_LINK)
test_unistd_misc_LDADD = $(VLIBC_TEST_LDADD)
test_math_basic_SOURCES = tests/test_math_basic.c
test_math_basic_CFLAGS = $(VLIBC_TEST_CFLAGS)
test_math_basic_DEPENDENCIES = crt1.o libvlibc-check.a
test_math_basic_LINK = $(VLIBC_TEST_LINK)
test_math_basic_LDADD = $(VLIBC_TEST_LDADD)
# test_startup's default mode exits 42 by design, so it is NOT a bare TESTS
# entry; tests/startup_modes.sh runs its full mode matrix and the -f failure
# scenarios of the other binaries. test_malloc/test_string/test_ctype/
# test_strings/test_strtol/test_qsort/test_inttypes/test_env and the W5/W6
# wave tests (test_process/test_fcntl/test_stat/test_wait/test_dirent/
# test_poll/test_time/test_scanf/test_getline) default to the happy mode
# (exit 0 on all-pass) and are bare TESTS entries; their -f/-p modes stay
# runnable by hand.
TESTS = test_syscall test_strerror test_setjmp test_headers \
test_malloc test_string test_ctype test_strings \
test_strtol test_qsort test_inttypes test_env \
test_process test_fcntl test_stat test_wait test_dirent \
test_poll test_time test_scanf test_getline \
test_systime test_printf test_stdio test_unistd_file \
test_mman test_statvfs test_times test_syslog test_pwdgrp \
test_unistd_misc \
test_math_basic \
tests/startup_modes.sh
CLEANFILES = crt1.o libvlibc-check.a $(VLIBC_CHECK_OBJECTS)
# Distributed but not installed / not otherwise picked up by automake.
# (TESTS scripts are not auto-distributed, so the mode runner is explicit.)
EXTRA_DIST = \
crt/x86_64/crt1.s \
include/vlibc/internal/test.h \
tests/conformance/symbols.list \
tests/startup_modes.sh \
arch/x86_64/syscall_arch.h \
src/internal/atomic.h \
src/internal/errno.h \
src/internal/futex.h \
src/internal/libc.h \
src/internal/malloc.h \
src/internal/strtox.h \
src/internal/syscall.h \
src/internal/types.h \
src/start/start.h \
src/start/tcb.h \
src/thread/pthread_impl.h \
src/dirent/dirent_impl.h \
src/process/atfork_impl.h \
src/stat/stat_impl.h \
src/stdio/stdio_impl.h \
src/stdio/vfprintf_float.c \
src/time/time_impl.h \
src/unistd/unistd_impl.h \
src/math/math_impl.h