libhmd-c

C human-readable date string library
git clone https://git.sinitax.com/sinitax/libhmd-c
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

build.rmk.tmpl (1509B)


      1#default PREFIX /usr/local
      2#default INCLDIR /include
      3#default LIBDIR /lib
      4#default CC gcc
      5
      6#ifdef libhmd_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 -fPIC
     18		#{OPT_CFLAGS} #{libhmd_EXTRA_CFLAGS} #{EXTRA_CFLAGS}
     19
     20rule liba
     21	#{CC} -o $out.tmp.o $in $cflags -r
     22	objcopy --keep-global-symbols=libhmd.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 libhmd.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/libhmd.a
     42	liba src/hmd.c | include/hmd.h build libhmd.api
     43
     44target build/libhmd.so
     45	libso src/hmd.c | include/hmd.h build libhmd.lds
     46
     47target build/test
     48	cc src/test.c build/libhmd.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/libhmd.a -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
     59	install -m755 build/libhmd.so -t "#{DESTDIR}#{PREFIX}#{LIBDIR}"
     60	install -m644 include/hmd.h -t "#{DESTDIR}#{PREFIX}#{INCLDIR}"
     61
     62command uninstall
     63	rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libhmd.a"
     64	rm -f "#{DESTDIR}#{PREFIX}#{LIBDIR}/libhmd.so"
     65	rm -f "#{DESTDIR}#{PREFIX}#{INCLDIR}/hmd.h"
     66
     67command all
     68	rmk build/libhmd.a build/libhmd.so build/test
     69