-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
74 lines (56 loc) · 2.18 KB
/
makefile
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
build := $(if $(build),$(build),build)
default: liboidadb/build/liboidadb.so
# Testing
test:
$(MAKE) test -C liboidadb
# the library
liboidadb/build/liboidadb.so:
$(MAKE) build/liboidadb.so -C liboidadb
# odb (s)hell
odbs/build/odbs:
$(MAKE) build/odbs -C odbs.src
# The manual
man/build/man.tar.xz:
$(MAKE) build/man.tar.xz -C man
# PACKAGING
# (builds + manual)
includesrc = $(wildcard src/include/*.h)
build/oidadb-package.tar.gz: $(manual_src) $(manual_html) build/build/liboidadb.so $(includesrc)
@mkdir -p build/packaged/include
@mkdir -p build/packaged/manual-html
@mkdir -p build/packaged/manual-org
cp build/release/liboidadb.so build/packaged
cp $(includesrc) build/packaged/include
cp $(manual_html) build/packaged/manual-html
cp $(manual_src) build/packaged/manual-org
cd build/ && tar -czf oidadb-package.tar.gz -C packaged .
release: $(test_exec) build/oidadb-package.tar.gz
@echo "OidaDB successfully tested, built, and packaged into 'build/oidadb-package.tar.gz'"
# PUBLISHING
# TODO: remove publishing scripts from here. I'd like to have all publishing handled by external scripts.
publish: build/publish-index.html
@mkdir -p build
cd build && timeout 30 ../scripts/ftp-publish.sh publish-index.html
PUBLISHDATE=$(shell date '+%F')
BUILDVERSION := $(shell git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
COMMITS=$(shell git rev-list --all --count)
LASTCOMMIT=$(shell git log -1 --format=%cI)
REVISION=$(shell git log -1 --format=%H)
TODOCOUNT=$(shell grep -rne 'todo:' | wc -l)
LINECOUNT=$(shell ( find ./spec ./src ./man -type f -print0 | xargs -0 cat ) | wc -l)
build/metrics.m4: .force
@mkdir -p build
echo 'dnl' > $@
echo 'define(PUBLISHDATE, $(PUBLISHDATE))dnl' >> $@
echo 'define(COMMITS, $(COMMITS))dnl' >> $@
echo 'define(LASTCOMMIT, $(LASTCOMMIT))dnl' >> $@
echo 'define(BUILDVERSION, $(BUILDVERSION))dnl' >> $@
echo 'define(REVISION, $(REVISION))dnl' >> $@
echo 'define(LINECOUNT, $(LINECOUNT))dnl' >> $@
echo 'define(TODOCOUNT, $(TODOCOUNT))dnl' >> $@
build/publish-index.html: spec/publish-index.m4.html build/metrics.m4
@mkdir -p build
m4 build/metrics.m4 $< > $@
clean:
-rm -r build
.PHONY: .force clean manual test release build doc