libdvec-c

C memory vector library
git clone https://git.sinitax.com/sinitax/libdvec-c
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

commit 7682f8fc716c5efb98f8efe6256ab72676a2aedf
parent 046c59cd98066bc1fe9e48a27e048213ea80dede
Author: Louis Burda <quent.burda@gmail.com>
Date:   Mon, 29 May 2023 13:51:31 +0200

Template build.jst for debug configuration

Diffstat:
M.gitignore | 1+
Dbuild.jst | 45---------------------------------------------
Abuild.jst.tmpl | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aconfigure | 8++++++++
4 files changed, 78 insertions(+), 45 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,5 +1,6 @@ compile_commands.json build +build.jst .cache vgcore* test diff --git a/build.jst b/build.jst @@ -1,45 +0,0 @@ -cc = clang - -cflags = -Wunused-function -Wunused-variable -Wconversion -Wformat - -I include -I lib/liballoc/include - -rule liba - $cc -o $out.tmp.o $in $cflags -r - objcopy --keep-global-symbols=libdvec.api $out.tmp.o $out.fixed.o - ar rcs $out $out.fixed.o - rm $out.tmp.o $out.fixed.o - -rule libso - $cc -o $out $in $cflags -shared -Wl,-version-script libdvec.lds - -rule cc - $cc -o $out $in $cflags - -rule mkdir - mkdir $out - -target build - mkdir - -target lib/liballoc/build/liballoc.a - just lib/liballoc - -target build/libdvec.a - liba src/dvec.c | include/dvec.h build - -target build/libdvec.so - libso src/dvec.c | include/dvec.h build - -target build/test - cc src/test.c build/libdvec.a lib/liballoc/build/liballoc.a | build - -command clean - rm -rf build - -command cleanall - just clean - just -C lib/liballoc cleanall - -command all - just build/libdvec.a build/libdvec.so build/test - diff --git a/build.jst.tmpl b/build.jst.tmpl @@ -0,0 +1,69 @@ +#default PREFIX /usr/local +#default INCLDIR /include +#default LIBDIR /lib +#default CC gcc + +#ifdef LIBDVEC_DEBUG +#define DEBUG 1 +#endif + +#ifdef DEBUG +#define OPT_CFLAGS -Og -g +#else +#define OPT_CFLAGS -O2 +#endif + +cflags = -Wunused-function -Wunused-variable -Wconversion -Wformat + -I include -I lib/liballoc/include + #{OPT_CFLAGS} #{LIBDVEC_EXTRA_CFLAGS} #{EXTRA_CFLAGS} + +rule liba + #{CC} -o $out.tmp.o $in $cflags -r + objcopy --keep-global-symbols=libdvec.api $out.tmp.o $out.fixed.o + ar rcs $out $out.fixed.o + rm $out.tmp.o $out.fixed.o + +rule libso + #{CC} -o $out $in $cflags -shared -Wl,-version-script libdvec.lds + +rule cc + #{CC} -o $out $in $cflags + +rule mkdir + mkdir $out + +target build + mkdir + +target lib/liballoc/build/liballoc.a + just lib/liballoc + +target build/libdvec.a + liba src/dvec.c | include/dvec.h build + +target build/libdvec.so + libso src/dvec.c | include/dvec.h build + +target build/test + cc src/test.c build/libdvec.a lib/liballoc/build/liballoc.a | build + +command clean + rm -rf build + +command cleanall + just clean + just -C lib/liballoc cleanall + +command install + install -m755 build/libdvec.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}" + install -m755 build/libdvec.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}" + install -m755 include/dvec.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}" + +command uninstall + rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libdvec.a" + rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libdvec.so" + rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/dvec.h" + +command all + just build/libdvec.a build/libdvec.so build/test + diff --git a/configure b/configure @@ -0,0 +1,8 @@ +#!/bin/sh + +tmpl "$@" build.jst.tmpl > build.jst +for lib in ./lib/*; do + pushd $lib + ./configure + popd +done