build.rmk.tmpl (1642B)
1#default PREFIX /usr/local 2#default INCLDIR /include 3#default LIBDIR /lib 4#default CC gcc 5 6#ifdef LIBTABULAR_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} #{LIBTABULAR_EXTRA_CFLAGS} 19 20rule liba 21 #{CC} -o $out.tmp.o $in $cflags -r 22 objcopy --keep-global-symbols=libtabular.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 #{CC} -o $out $in $cflags -shared -Wl,-version-script libtabular.lds 28 29rule cc 30 #{CC} -o $out $in $cflags 31 32rule mkdir 33 mkdir $out 34 35target build 36 mkdir 37 38target lib/liballoc/build/liballoc.a 39 rmk lib/liballoc 40 41target build/libtabular.a 42 liba src/tabular.c src/util.c lib/liballoc/build/liballoc.a 43 | build include/tabular.h libtabular.api 44 45target build/libtabular.so 46 libso src/tabular.c src/util.c 47 | build include/tabular.h libtabular.lds 48 49target build/test 50 cc src/test.c build/libtabular.a lib/liballoc/build/liballoc.a | build 51 52command clean 53 rm -rf build 54 55command cleanall 56 rmk clean 57 rmk -C lib/liballoc cleanall 58 59command install 60 install -m644 include/tabular.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}" 61 install -m755 build/libtabular.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}" 62 install -m755 build/libtabular.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}" 63 64command uninstall 65 rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/tabular.h" 66 rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libtabular.a" 67 rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libtabular.so" 68 69command all 70 rmk build/libtabular.a build/libtabular.so build/test