libhmap-c

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

build.jst.tmpl (1505B)


      1#default PREFIX /usr/local
      2#default INCLDIR /include
      3#default LIBDIR /lib
      4#default CC gcc
      5
      6#ifdef LIBHMAP_DEBUG
      7#define DEBUG 1
      8#endif
      9
     10#ifdef DEBUG
     11#define OPT_CFLAGS -Og -g
     12#else
     13#define OPT_CFLAGS -O2
     14#endif
     15
     16cflags = -Wunused-function -Wunused-variable -Wconversion -Wformat
     17		-I include -I lib/liballoc/include #{OPT_CFLAGS}
     18		 #{EXTRA_CFLAGS} #{LIBHMAP_EXTRA_CFLAGS}
     19
     20rule mkdir
     21	mkdir $out
     22
     23rule liba
     24	#{CC} -o $out.tmp.o $in $cflags -r
     25	objcopy --keep-global-symbols=libhmap.api $out.tmp.o $out.fixed.o
     26	ar rcs $out $out.fixed.o
     27	rm $out.tmp.o $out.fixed.o
     28
     29rule libso
     30	#{CC} -o $out $in $cflags -shared -Wl,-version-script libhmap.lds
     31
     32rule cc
     33	#{CC} -o $out $in $cflags
     34
     35target build
     36	mkdir
     37
     38target lib/liballoc/build/liballoc.a
     39	just lib/liballoc
     40
     41target build/libhmap.a
     42	liba src/hmap.c | include/hmap.h build
     43
     44target build/libhmap.so
     45	libso src/hmap.c | include/hmap.h build
     46
     47target build/test
     48	cc src/test.c build/libhmap.a lib/liballoc/build/liballoc.a | build
     49
     50command clean
     51	rm -rf build
     52
     53command cleanall
     54	just clean
     55	just -C lib/liballoc cleanall
     56
     57command install
     58	install -m755 build/libhmap.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
     59	install -m755 build/libhmap.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
     60	install -m644 include/hmap.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}"
     61
     62command uninstall
     63	rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libhmap.a"
     64	rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libhmap.so"
     65	rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/hmap.h"
     66
     67command all
     68	just build/libhmap.a build/libhmap.so build/test
     69