summaryrefslogtreecommitdiffstats
path: root/lib/libtabular/build.rmk.tmpl
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2024-10-02 03:59:21 +0200
committerLouis Burda <quent.burda@gmail.com>2024-10-02 03:59:21 +0200
commit36c8d24c07ef3c6658f397fd156396f83b35ac27 (patch)
tree1b3293264dca677a8d8e1ca44061aa7af191f839 /lib/libtabular/build.rmk.tmpl
parenteff49100e4fca394a23973abd5001a4fde15d6e8 (diff)
downloadtabular-master.tar.gz
tabular-master.zip
Vendor subgit modulesHEADmaster
Diffstat (limited to 'lib/libtabular/build.rmk.tmpl')
-rw-r--r--lib/libtabular/build.rmk.tmpl70
1 files changed, 70 insertions, 0 deletions
diff --git a/lib/libtabular/build.rmk.tmpl b/lib/libtabular/build.rmk.tmpl
new file mode 100644
index 0000000..5f874ed
--- /dev/null
+++ b/lib/libtabular/build.rmk.tmpl
@@ -0,0 +1,70 @@
+#default PREFIX /usr/local
+#default INCLDIR /include
+#default LIBDIR /lib
+#default CC gcc
+
+#ifdef LIBTABULAR_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} #{LIBTABULAR_EXTRA_CFLAGS}
+
+rule liba
+ #{CC} -o $out.tmp.o $in $cflags -r
+ objcopy --keep-global-symbols=libtabular.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 libtabular.lds
+
+rule cc
+ #{CC} -o $out $in $cflags
+
+rule mkdir
+ mkdir $out
+
+target build
+ mkdir
+
+target lib/liballoc/build/liballoc.a
+ rmk lib/liballoc
+
+target build/libtabular.a
+ liba src/tabular.c src/util.c lib/liballoc/build/liballoc.a
+ | build include/tabular.h libtabular.api
+
+target build/libtabular.so
+ libso src/tabular.c src/util.c
+ | build include/tabular.h libtabular.lds
+
+target build/test
+ cc src/test.c build/libtabular.a lib/liballoc/build/liballoc.a | build
+
+command clean
+ rm -rf build
+
+command cleanall
+ rmk clean
+ rmk -C lib/liballoc cleanall
+
+command install
+ install -m644 include/tabular.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}"
+ install -m755 build/libtabular.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
+ install -m755 build/libtabular.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
+
+command uninstall
+ rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/tabular.h"
+ rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libtabular.a"
+ rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libtabular.so"
+
+command all
+ rmk build/libtabular.a build/libtabular.so build/test