-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathMakefile
116 lines (94 loc) · 3.25 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
-include .config.mk
PKG = emacsql
ELS = $(PKG)-compiler.el
ELS += $(PKG).el
ELS += $(PKG)-sqlite.el
ELS += $(PKG)-sqlite-common.el
ELS += $(PKG)-sqlite-builtin.el
ELS += $(PKG)-sqlite-module.el
ELS += $(PKG)-mysql.el
ELS += $(PKG)-psql.el
ELS += $(PKG)-pg.el
ELCS = $(ELS:.el=.elc)
TEST_ELS = tests/emacsql-compiler-tests.el
TEST_ELS += tests/emacsql-external-tests.el
TEST_ELCS = $(TEST_ELS:.el=.elc)
DEPS = pg
DEPS += peg
DEPS += sqlite3
EMACS ?= emacs
ifeq ($(CI), true)
# Workaround for bug#58252 on Emacs 28.x.
override EMACS_ARGS += --eval "(setq byte-compile-docstring-max-column 120)"
else
EMACS_ARGS ?=
endif
ifdef NIX_PATH
export SQLITE3_API_BUILD_COMMAND = nix-shell -p sqlite.dev --run "make all"
endif
LOAD_PATH ?= $(addprefix -L ../,$(DEPS))
LOAD_PATH += -L .
LOAD_PATH += -L ./tests
all: lisp
help:
$(info make all - generate byte-code and autoloads)
$(info make lisp - generate byte-code and autoloads)
$(info make redo - re-generate byte-code and autoloads)
$(info make test - run tests)
$(info make clean - remove byte-code and autoloads)
@printf "\n"
redo: clean lisp
lisp: $(ELCS) loaddefs
loaddefs: $(PKG)-autoloads.el
%.elc: %.el
@printf "Compiling $<\n"
@$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) -f batch-byte-compile $<
check-declare:
@printf " Checking function declarations\n"
@$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) \
--eval "(check-declare-directory default-directory)"
CLEAN = $(ELCS) $(TEST_ELCS) $(PKG)-autoloads.el
clean:
@printf " Cleaning...\n"
@rm -rf $(CLEAN)
$(PKG)-autoloads.el: $(ELS)
@printf " Creating $@\n"
@$(EMACS) -Q --batch -l autoload -l cl-lib --eval "\
(let ((file (expand-file-name \"$@\"))\
(autoload-timestamps nil) \
(backup-inhibited t)\
(version-control 'never)\
(coding-system-for-write 'utf-8-emacs-unix))\
(write-region (autoload-rubric file \"package\" nil) nil file nil 'silent)\
(cl-letf (((symbol-function 'progress-reporter-do-update) (lambda (&rest _)))\
((symbol-function 'progress-reporter-done) (lambda (_))))\
(let ((generated-autoload-file file))\
(update-directory-autoloads default-directory))))" \
2>&1 | sed "/^Package autoload is deprecated$$/d"
test: all $(TEST_ELCS)
@printf "Running compiler tests...\n"
@$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) -L tests \
-l tests/emacsql-compiler-tests.elc -f ert-run-tests-batch-and-exit
@printf "Running connector tests...\n"
@$(EMACS) -Q --batch $(EMACS_ARGS) $(LOAD_PATH) -L tests \
-l tests/emacsql-external-tests.elc -f ert-run-tests-batch-and-exit
ifeq ($(CI), true)
override GITSTATS = ../_gitstats/gitstats
endif
GITSTATS ?= gitstats
GITSTATS_DIR ?= stats
GITSTATS_ARGS ?= -c style=https://magit.vc/assets/stats.css -c max_authors=999
DOMAIN ?= magit.vc
CFRONT_DIST ?= E2LUHBKU1FBV02
S3_BUCKET ?= s3://$(DOMAIN)
.PHONY: stats
stats:
@printf "Generating statistics\n"
@$(GITSTATS) $(GITSTATS_ARGS) . $(GITSTATS_DIR)
stats-upload:
@printf "Uploading statistics...\n"
@aws s3 sync $(GITSTATS_DIR) $(S3_BUCKET)/stats/$(PKG)
@printf "Uploaded to $(S3_BUCKET)/stats/$(PKG)\n"
@printf "Generating CDN invalidation\n"
@aws cloudfront create-invalidation \
--distribution-id $(CFRONT_DIST) --paths "/stats/*" > /dev/null