build.rmk.tmpl (1503B)
1#default PREFIX /usr/local 2#default INCLDIR /include 3#default LIBDIR /lib 4#default CC gcc 5 6#ifdef LIBSTR_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} #{LIBSTR_EXTRA_CFLAGS} 19 20rule liba 21 #{CC} -o $out.tmp.o $in $cflags -r 22 objcopy --keep-global-symbols=libstr.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 libstr.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/libstr.a 42 liba src/str.c | include/str.h libstr.api build 43 44target build/libstr.so 45 libso src/str.c | include/str.h libstr.lds build 46 47target build/test 48 cc src/test.c build/libstr.a lib/liballoc/build/liballoc.a | build 49 50command clean 51 rm -rf build 52 53command cleanall 54 rmk clean 55 rmk -C lib/liballoc cleanall 56 57command install 58 install -m755 build/libstr.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}" 59 install -m755 build/libstr.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}" 60 install -m644 include/str.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}" 61 62command uninstall 63 rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libstr.a" 64 rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libstr.so" 65 rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/str.h" 66 67command all 68 rmk build/libstr.a build/libstr.so build/test 69