libidx-c

C library for IDX file format
git clone https://git.sinitax.com/sinitax/libidx-c
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

build.jst.tmpl (1389B)


      1#default PREFIX /usr/local
      2#default INCLDIR /include
      3#default LIBDIR /lib
      4#default CC gcc
      5
      6#ifdef LIBIDX_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 = -std=c99 -Wunused-variable -Wunused-function -Wconversion -Wformat
     17		-I include -I lib/liballoc/include
     18		#{OPT_CFLAGS} #{LIBIDX_EXTRA_CFLAGS} #{EXTRA_CFLAGS}
     19
     20rule liba
     21	gcc -o $out.tmp.o $in $cflags -r
     22	objcopy --keep-global-symbols=libidx.api $out.tmp.o $out.fixed.o
     23	ar rcs $out $out.fixed.o
     24	rm $out.tmp.o $out.fixed.o
     25
     26rule libso
     27	gcc -o $out $in $cflags -shared -Wl,-version-script libidx.lds
     28
     29rule cc
     30	gcc -o $out $in $cflags
     31
     32rule mkdir
     33	mkdir $out
     34
     35target build
     36	mkdir
     37
     38target build/libidx.a
     39	liba src/idx.c | include/idx.h build
     40
     41target build/libidx.so
     42	liba src/idx.c | include/idx.h build
     43
     44target build/test
     45	cc src/test.c build/libidx.a | build
     46
     47command clean
     48	rm -rf build
     49
     50command cleanall
     51	just clean
     52	just -C lib/liballoc cleanall
     53
     54command install
     55	install -m755 include/idx.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}"
     56	install -m755 build/libidx.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
     57	install -m755 build/libidx.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
     58
     59command uninstall
     60	rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/idx.h"
     61	rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libidx.a"
     62	rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libidx.so"
     63
     64command all
     65	just build/libidx.a build/libidx.so
     66