libhmap-c

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

commit 32ab36cde0296515fce0884241abd4410199b4e6
parent 8f110e4f4caba424ea5ede2bf9531b9f09c5348e
Author: Louis Burda <quent.burda@gmail.com>
Date:   Mon, 29 May 2023 14:11:03 +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 = gcc - -cflags = -Wunused-function -Wunused-variable -Wconversion -Wformat - -I include -I lib/liballoc/include - -rule mkdir - mkdir $out - -rule liba - $CC -o $out.tmp.o $in $cflags -r - objcopy --keep-global-symbols=libhmap.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 libhmap.lds - -rule cc - $CC -o $out $in $cflags - -target build - mkdir - -target lib/liballoc/build/liballoc.a - just lib/liballoc - -target build/libhmap.a - liba src/hmap.c | include/hmap.h build - -target build/libhmap.so - libso src/hmap.c | include/hmap.h build - -target build/test - cc src/test.c build/libhmap.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/libhmap.a build/libhmap.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 LIBHMAP_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} + #{EXTRA_CFLAGS} #{LIBHMAP_EXTRA_CFLAGS} + +rule mkdir + mkdir $out + +rule liba + #{CC} -o $out.tmp.o $in $cflags -r + objcopy --keep-global-symbols=libhmap.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 libhmap.lds + +rule cc + #{CC} -o $out $in $cflags + +target build + mkdir + +target lib/liballoc/build/liballoc.a + just lib/liballoc + +target build/libhmap.a + liba src/hmap.c | include/hmap.h build + +target build/libhmap.so + libso src/hmap.c | include/hmap.h build + +target build/test + cc src/test.c build/libhmap.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/libhmap.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}" + install -m755 build/libhmap.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}" + install -m755 include/hmap.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}" + +command uninstall + rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libhmap.a" + rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libhmap.so" + rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/hmap.h" + +command all + just build/libhmap.a build/libhmap.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