libtabular-c

C tabular formatting library
git clone https://git.sinitax.com/sinitax/libtabular-c
Log | Files | Refs | Submodules | sfeed.txt

build.rmk.tmpl (1326B)


      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 #{OPT_CFLAGS} #{EXTRA_CFLAGS}
     14
     15rule liba
     16	gcc -o $out.tmp.o $in $cflags -r
     17	objcopy --keep-global-symbols=liballoc.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 liballoc.lds
     23
     24rule cc
     25	gcc -o $out $in $cflags
     26
     27rule mkdir
     28	mkdir $out
     29
     30target build
     31	mkdir
     32
     33target build/liballoc.a
     34	liba src/allocator.c | include/allocator.h build
     35
     36target build/liballoc.so
     37	libso src/allocator.c | include/allocator.h build
     38
     39target build/test
     40	cc src/test.c build/liballoc.a | build
     41
     42command clean
     43	rm -rf build
     44
     45command cleanall
     46	just clean
     47
     48command install
     49	install -m755 build/liballoc.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
     50	install -m755 build/liballoc.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
     51	install -m644 include/allocator.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}"
     52
     53command uninstall
     54	rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/liballoc.a"
     55	rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/liballoc.so"
     56	rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/allocator.h"
     57
     58command all
     59	just build/liballoc.a build/liballoc.so build/test
     60