-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
123 lines (99 loc) · 3.74 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# ql-to-deb build tool
APP_NAME = pgcharts
# use either sbcl or ccl
CL = sbcl
SRC = pgcharts.asd \
$(wildcard src/*lisp) \
$(wildcard src/utils/*lisp) \
$(wildcard src/sql/*lisp) \
$(wildcard src/sql/*sql)
BUILDDIR = build
LIBS = $(BUILDDIR)/libs.stamp
QLDIR = $(BUILDDIR)/quicklisp
QUICKLISP = $(BUILDDIR)/quicklisp.lisp
MANIFEST = $(BUILDDIR)/manifest.ql
PGCHARTS = $(BUILDDIR)/bin/$(APP_NAME)
BUILDAPP_CCL = $(BUILDDIR)/bin/buildapp.ccl
BUILDAPP_SBCL = $(BUILDDIR)/bin/buildapp.sbcl
ifeq ($(CL),sbcl)
BUILDAPP = $(BUILDAPP_SBCL)
CL_OPTS = --no-sysinit --no-userinit
else
BUILDAPP = $(BUILDAPP_CCL)
CL_OPTS = --no-init
endif
COMPRESS_CORE ?= yes
ifeq ($(CL),sbcl)
ifeq ($(COMPRESS_CORE),yes)
COMPRESS_CORE_OPT = --compress-core
else
COMPRESS_CORE_OPT =
endif
endif
# ifeq ($(CL),sbcl)
# BUILDAPP_OPTS = --require sb-posix
# endif
DEBUILD_ROOT = /tmp/pgcharts
all: $(PGCHARTS)
docs:
ronn -roff pgcharts.1.md
clean:
rm -rf $(LIBS) $(QUICKLISP) $(QLDIR) $(MANIFEST) $(BUILDAPP) $(PGCHARTS)
$(QLDIR)/setup.lisp:
mkdir -p $(BUILDDIR)
curl -o $(QUICKLISP) http://beta.quicklisp.org/quicklisp.lisp
$(CL) $(CL_OPTS) --load $(QUICKLISP) \
--eval '(quicklisp-quickstart:install :path "$(BUILDDIR)/quicklisp")' \
--eval '(quit)'
quicklisp: $(QLDIR)/setup.lisp ;
$(LIBS): $(QLDIR)/setup.lisp
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(push "$(CURDIR)/" asdf:*central-registry*)' \
--eval '(ql:quickload "pgcharts")' \
--eval '(quit)'
touch $@
libs: $(LIBS) ;
$(MANIFEST): $(LIBS)
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(ql:write-asdf-manifest-file "$(MANIFEST)")' \
--eval '(quit)'
manifest: $(MANIFEST) ;
$(BUILDAPP_CCL): $(QLDIR)/setup.lisp
mkdir -p $(BUILDDIR)/bin
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(ql:quickload "buildapp")' \
--eval '(buildapp:build-buildapp "$@")' \
--eval '(quit)'
$(BUILDAPP_SBCL): $(QLDIR)/setup.lisp
mkdir -p $(BUILDDIR)/bin
$(CL) $(CL_OPTS) --load $(QLDIR)/setup.lisp \
--eval '(ql:quickload "buildapp")' \
--eval '(buildapp:build-buildapp "$@")' \
--eval '(quit)'
buildapp: $(BUILDAPP) ;
$(PGCHARTS): $(MANIFEST) $(BUILDAPP) $(SRC)
mkdir -p $(BUILDDIR)/bin
$(BUILDAPP) --logfile /tmp/build.log \
$(BUILDAPP_OPTS) \
--sbcl $(CL) \
--require asdf \
--load-system asdf \
--asdf-tree $(QLDIR)/dists \
--asdf-path . \
--load-system $(APP_NAME) \
--load src/image.lisp \
--entry pgcharts:main \
--dynamic-space-size 4096 \
$(COMPRESS_CORE_OPT) \
--output $@
pgcharts: $(PGCHARTS) ;
deb:
# intended for use on a debian system
mkdir -p $(DEBUILD_ROOT) && rm -rf $(DEBUILD_ROOT)
rsync -Ca --exclude=build \
--exclude=.vagrant \
--exclude=web/*zip \
./ $(DEBUILD_ROOT)/
cd $(DEBUILD_ROOT) && make -f debian/rules orig
cd $(DEBUILD_ROOT) && debuild -us -uc -sa
cp -a /tmp/pgcharts_* build/