This repository has been archived by the owner on Feb 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ninja
50 lines (41 loc) · 1.77 KB
/
build.ninja
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
ver = 0.0.1
major = 0
name = stackonfigure
rule cxx
command = clang++ -c -g -fPIC -Wall -Wextra -Fall -Fextra -pedantic -Iheaders -Iheaders/stackonfigure -o$out $in -std=c++0x
rule link
command = clang++ -shared -o$out $in -Wl,-soname,$soname -Wl,-z,now -fstack-protector
rule ln
command = ln -sf $in $out
bd = ./build
sd = ./src
build $bd/value.o: cxx $sd/value.cc
build $bd/config.o: cxx $sd/config.cc
build lib$name.so.$ver: link $bd/value.o $bd/config.o
soname = lib$name.so.$major
build lib$name.so.$major: ln lib$name.so.$ver
build lib$name.so: ln lib$name.so.$ver
packfiles = stackonfigure/headers stackonfigure/src stackonfigure/stackonfigure.pc stackonfigure/build.ninja stackonfigure/LICENSE
packname = $name.$ver.tar.gz
rule pack
command = tar -C .. -cf `pwd`/$packname --gzip $packfiles
build $packname: pack | lib$name.so lib$name.so.$major
build pack: phony $packname
incdir = /usr/include/stackonfigure
rule n_install
command = if [ ! -d $incdir ] ; then mkdir $incdir ; fi ; install headers/stackonfigure/*.hh -C $incdir
rule n_install_lib
command = install lib$name* -C /usr/lib ; install stackonfigure.pc -C /usr/lib/pkgconfig/
rule n_install_lib64
command = install lib$name* -C /usr/lib64 ; install stackonfigure.pc -C /usr/lib64/pkgconfig
rule n_install_warn
command = echo "Please use install_lib64 on x64 systems with /usr/lib64 folder, otherwise please use install_lib"
rule n_links
command = if [ ! -e lib$name.so ] ; then ln $lname -s lib$name.so ; fi
build install: n_install_warn
build _install: n_install | lib$name.so lib$name.so.$major
build links: n_links
build install_lib64: n_install_lib64 links _install
build install_lib: n_install_lib links _install
build all: phony lib$name.so lib$name.so.$major
default all