aoc-2019-c

Advent of Code 2019 Solutions in C
git clone https://git.sinitax.com/sinitax/aoc-2019-c
Log | Files | Refs | README | sfeed.txt

build.jst.tmpl (1504B)


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