summaryrefslogtreecommitdiffstats
path: root/build.jst.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'build.jst.tmpl')
-rw-r--r--build.jst.tmpl74
1 files changed, 74 insertions, 0 deletions
diff --git a/build.jst.tmpl b/build.jst.tmpl
new file mode 100644
index 0000000..833bd57
--- /dev/null
+++ b/build.jst.tmpl
@@ -0,0 +1,74 @@
+#default PREFIX /usr/local
+#default INCLDIR /include
+#default LIBDIR /lib
+#default CC gcc
+
+#ifdef LIBSTRVEC_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 -I lib/libdvec/include
+ #{OPT_CFLAGS} #{EXTRA_CFLAGS} #{LIBSTRVEC_EXTRA_CFLAGS}
+
+rule liba
+ #{CC} -o $out.tmp.o $in $cflags -r
+ objcopy --keep-global-symbols=libstrvec.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 libstrvec.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 lib/libdvec/build/libdvec.a
+ just lib/libdvec
+
+target build/libstrvec.a
+ liba src/strvec.c lib/liballoc/build/liballoc.a | build
+
+target build/libstrvec.so
+ libso src/strvec.c | build
+
+target build/test
+ cc src/test.c build/libstrvec.a lib/liballoc/build/liballoc.a
+ lib/libdvec/build/libdvec.a | build
+
+command clean
+ rm -rf build
+
+command cleanall
+ just clean
+ just -C lib/libdvec cleanall
+ just -C lib/liballoc cleanall
+
+command install
+ install -m755 build/libstrvec.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
+ install -m755 build/libstrvec.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
+ install -m755 include/strvec.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}"
+
+command uninstall
+ rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libstrvec.a"
+ rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libstrvec.so"
+ rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/strvec.h"
+
+command all
+ just build/libstrvec.a build/libstrvec.so build/test
+