Add vlibc scaffold, build system, and documentation
Establish the repository layout per Vox guidelines (layouts/C.md, building/C.md): Autotools build (GCC-only, C23), five compatibility profiles (--enable-onlyposix/--enable-muslmimic/--enable-muslext/ --enable-spoof, default vlibc), alongside/overwrite install methods, vlibc-gcc/vlibc-clang drivers, static-linking requirement (except spoof), benchmark harness, and tooling (.clang-format/.clang-tidy/ .clangd + compile_commands.json).
This commit is contained in:
+56
@@ -0,0 +1,56 @@
|
||||
# vlibc — top-level build (see building/C.md and layouts/C.md).
|
||||
|
||||
SUBDIRS = benchmarks
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
AM_CFLAGS = @VLIBC_CFLAGS@
|
||||
|
||||
# ---- Library -------------------------------------------------------------
|
||||
vlibc_include_HEADERS = include/vlibc.h
|
||||
vlibc_lib_LTLIBRARIES = libvlibc.la
|
||||
|
||||
libvlibc_la_SOURCES = src/vlibc.c
|
||||
libvlibc_la_LDFLAGS = -version-info 0:0:0 -no-undefined
|
||||
|
||||
# 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
|
||||
|
||||
# ---- Compiler drivers ----------------------------------------------------
|
||||
bin_SCRIPTS = tools/vlibc-gcc tools/vlibc-clang
|
||||
|
||||
# ---- 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/
|
||||
|
||||
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/
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user