libslip-c

C SLIP-encoding library
git clone https://git.sinitax.com/sinitax/libslip-c
Log | Files | Refs | LICENSE | sfeed.txt

build.jst.tmpl (1291B)


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