aboutsummaryrefslogtreecommitdiffstats
path: root/GNUmakefile
blob: 5fa67ef8bc20f5131f63e308a75f1440bfe532f4 (plain)
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
FILES := $(wildcard oni-*.el)
DIRECTORIES := $(wildcard oni-*/)

PACKAGE_TARGETS := $(addprefix package-,$(FILES))
MULTIPACKAGE_TARGETS := $(addprefix multipackage-,$(subst /, ,$(DIRECTORIES)))

define upload =
	emacs --batch \
	    --load oni-package.el \
	    --funcall package-initialize \
	    --eval "(package-upload-file $1)"
endef

define upload-multi-file =
	$(call upload,(car (sort (file-expand-wildcards \"$1/dist/*.tar\") #'string>)))
	cp $1/dist/$1-readme.txt bin/
endef

package: $(PACKAGE_TARGETS) $(MULTIPACKAGE_TARGETS)

package-%: %
	$(call upload,\"$^\")

multipackage-%: %
	$(call upload-multi-file,$^)

install-%:
	emacs --batch \
	    --load oni-package.el \
	    --funcall package-initialize \
	    --eval "(add-to-list 'package-archives '(\"test\" . \"$(TEST_ARCHIVE)\"))" \
	    --eval '(package-refresh-contents)' \
	    --eval "(package-install '$*)"

unit-test-%: install-%
	emacs --batch \
	    --load oni-package.el \
	    --funcall package-initialize \
	    --load ert \
	    --load "test/$*-test.el" \
	    --eval "(setq ert-batch-backtrace-right-margin nil)" \
	    --funcall ert-run-tests-batch-and-exit

integration-test-%: install-%
	bats test/integration/$*.bats

clean:
	rm -fv $(FILES)