commit 3fc6f5caa994dcb2b0118f2401831f7f67532d2f parent 1e83ca9427fbb138580bd7ff72bf3f6165df46a8 Author: Louis Burda <quent.burda@gmail.com> Date: Mon, 29 May 2023 14:16:09 +0200 Template build.jst for debug configuration Diffstat:
A | build.jst.tmpl | | | 64 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | configure | | | 3 | +++ |
2 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/build.jst.tmpl b/build.jst.tmpl @@ -0,0 +1,64 @@ +#default PREFIX /usr/local +#default INCLDIR /include +#default LIBDIR /lib +#default CC gcc + +#ifdef LIBLIST_DEBUG +#define DEBUG 1 +#endif + +#ifdef DEBUG +#define OPT_CFLAGS -Og -g +#else +#define OPT_CFLAGS -O2 +#endif + +cflags = -Wunused-function -Wunused-variable -Wconversion + -I include #{OPT_CFLAGS} #{EXTRA_CFLAGS} #{LIBLIST_EXTRA_CFLAGS} + +rule liba + #{CC} -o $out.tmp.o $in $cflags -r + objcopy --keep-global-symbols=liblist.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 liblist.lds + +rule cc + #{CC} -o $out $in $cflags + +rule mkdir + mkdir $out + +target build + mkdir + +target build/liblist.a + liba src/list.c | include/list.h build + +target build/liblist.so + libso src/list.c | include/list.h build + +target build/test + cc src/test.c build/liblist.a | build + +command clean + rm -rf build + +command cleanall + just clean + +command install + install -m755 build/liblist.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}" + install -m755 build/liblist.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}" + install -m755 include/list.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}" + +command uninstall + rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/liblist.a" + rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/liblist.so" + rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/list.h" + +command all + just build/liblist.a build/liblist.so build/test + diff --git a/configure b/configure @@ -0,0 +1,3 @@ +#!/bin/sh + +tmpl "$@" build.jst.tmpl > build.jst