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)