dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

Makefile (4153B)


      1 export CASK ?= cask
      2 export EMACS ?= $(shell which emacs)
      3 export CASK_DIR := $(shell EMACS=$(EMACS) $(CASK) package-directory)
      4 
      5 PKBUILD=2.3
      6 TESTSSRC = $(shell ls tests/*.el)
      7 ELCTESTS = $(TESTSSRC:.el=.elc)
      8 .DEFAULT_GOAL := compile
      9 
     10 .PHONY: test
     11 test: cask compile test-3
     12 
     13 .PHONY: test-3
     14 test-3: test-3-tornado test-3-flask
     15 
     16 .PHONY: test-3-tornado
     17 test-3-tornado:
     18 	EL_REQUEST_TEST_SERVER=tornado $(MAKE) test-2
     19 
     20 .PHONY: test-3-flask
     21 test-3-flask:
     22 	EL_REQUEST_TEST_SERVER=flask $(MAKE) test-2
     23 
     24 .PHONY: test-2
     25 test-2: test-2-url-retrieve test-2-curl
     26 
     27 .PHONY: test-2-url-retrieve
     28 test-2-url-retrieve:
     29 	EL_REQUEST_BACKEND=url-retrieve $(MAKE) test-1
     30 
     31 .PHONY: test-2-curl
     32 test-2-curl:
     33 	EL_REQUEST_BACKEND=curl $(MAKE) test-1
     34 
     35 test-1:
     36 #  global-auto-revert-mode [github #132]
     37 	EL_REQUEST_NO_CAPTURE_MESSAGE=$(EL_REQUEST_NO_CAPTURE_MESSAGE) EL_REQUEST_MESSAGE_LEVEL=$(EL_REQUEST_MESSAGE_LEVEL) $(CASK) emacs -Q --batch -L . -L tests -l test-request.el --eval "(global-auto-revert-mode)" -f ert-run-tests-batch-and-exit
     38 
     39 .PHONY: cask
     40 cask: $(CASK_DIR)
     41 $(CASK_DIR): Cask
     42 	$(CASK) install
     43 
     44 .PHONY: compile
     45 compile: cask
     46 	! ($(CASK) eval \
     47 	      "(cl-letf (((symbol-function (quote cask-files)) (lambda (&rest _args) (mapcar (function symbol-name) (quote ($(TESTSSRC))))))) \
     48 	          (let ((byte-compile-error-on-warn t)) (cask-cli/build)))" 2>&1 | egrep -a "(Warning|Error):") ; (ret=$$? ; rm -f $(ELCTESTS) && exit $$ret)
     49 	! ($(CASK) eval "(let ((byte-compile-error-on-warn t)) (cask-cli/build))" 2>&1 | egrep -a "(Warning|Error):") ; (ret=$$? ; $(CASK) clean-elc && exit $$ret)
     50 
     51 .PHONY: clean
     52 clean:
     53 	$(CASK) clean-elc
     54 	make -C doc clean
     55 
     56 
     57 .PHONY: dist-clean
     58 dist-clean:
     59 	rm -rf dist
     60 
     61 .PHONY: dist
     62 dist: dist-clean
     63 	$(CASK) package
     64 
     65 .PHONY: install
     66 install: compile dist
     67 	$(EMACS) -Q --batch --eval "(package-initialize)" \
     68 	  --eval "(package-install-file \"dist/request-$(shell $(CASK) version).tar\")"
     69 
     70 define SET_GITHUB_REPOSITORY =
     71 ifeq ($(GITHUB_REPOSITORY),)
     72 	GITHUB_REPOSITORY := $(shell git config user.name)/$(shell basename `git rev-parse --show-toplevel`)
     73 endif
     74 endef
     75 
     76 define SET_GITHUB_HEAD_REF =
     77 ifeq ($(GITHUB_HEAD_REF),)
     78 GITHUB_HEAD_REF := $(shell git rev-parse --abbrev-ref HEAD)
     79 endif
     80 endef
     81 
     82 define SET_GITHUB_SHA =
     83 ifeq ($(GITHUB_SHA),)
     84 GITHUB_SHA := $(shell if git show-ref --quiet --verify origin/$(GITHUB_HEAD_REF) ; then git rev-parse origin/$(GITHUB_HEAD_REF) ; fi)
     85 endif
     86 endef
     87 
     88 .PHONY: test-install-vars
     89 test-install-vars:
     90 	$(eval $(call SET_GITHUB_REPOSITORY))
     91 	$(eval $(call SET_GITHUB_HEAD_REF))
     92 	$(eval $(call SET_GITHUB_SHA))
     93 	@true
     94 
     95 .PHONY: test-install
     96 test-install: test-install-vars
     97 	mkdir -p tests/test-install
     98 	if [ ! -s "tests/test-install/$(PKBUILD).tar.gz" ] ; then \
     99 	  cd tests/test-install ; curl -sLOk https://github.com/melpa/package-build/archive/$(PKBUILD).tar.gz ; fi
    100 	cd tests/test-install ; tar xfz $(PKBUILD).tar.gz
    101 	cd tests/test-install ; rm -f $(PKBUILD).tar.gz
    102 	cd tests/test-install/package-build-$(PKBUILD) ; make -s loaddefs
    103 	mkdir -p tests/test-install/recipes
    104 	cd tests/test-install/recipes ; curl -sfLOk https://raw.githubusercontent.com/melpa/melpa/master/recipes/request || cp -f ../../../tools/recipe ./request
    105 	! ( $(EMACS) -Q --batch -L tests/test-install/package-build-$(PKBUILD) \
    106 	--eval "(require 'package-build)" \
    107 	--eval "(require 'subr-x)" \
    108 	--eval "(package-initialize)" \
    109 	--eval "(add-to-list 'package-archives '(\"melpa\" . \"http://melpa.org/packages/\"))" \
    110 	--eval "(package-refresh-contents)" \
    111 	--eval "(setq rcp (package-recipe-lookup \"request\"))" \
    112 	--eval "(unless (file-exists-p package-build-archive-dir) \
    113 	           (make-directory package-build-archive-dir))" \
    114 	--eval "(let* ((my-repo \"$(GITHUB_REPOSITORY)\") \
    115 	               (my-branch \"$(GITHUB_HEAD_REF)\") \
    116 	               (my-commit \"$(GITHUB_SHA)\")) \
    117 	           (oset rcp :repo my-repo) \
    118 	           (oset rcp :branch my-branch) \
    119 	           (oset rcp :commit my-commit))" \
    120 	--eval "(package-build--package rcp (package-build--checkout rcp))" \
    121 	--eval "(package-install-file (car (file-expand-wildcards (concat package-build-archive-dir \"request*.tar\"))))" 2>&1 | egrep -ia "error: |fatal" )