dotemacs

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

Makefile (3007B)


      1 ### Makefile for SLY
      2 #
      3 # This file is in the public domain.
      4 
      5 # Variables
      6 #
      7 EMACS=emacs
      8 LISP=sbcl
      9 
     10 LOAD_PATH=-L . -L contrib/
     11 
     12 ELFILES := sly.el sly-autoloads.el $(wildcard lib/*.el)
     13 ELCFILES := $(ELFILES:.el=.elc)
     14 
     15 CONTRIBS = $(patsubst contrib/sly-%.el,%,$(wildcard contrib/sly-*.el))
     16 
     17 CONTRIB_ELFILES := $(wildcard contrib/*.el)
     18 CONTRIB_ELCFILES := $(CONTRIB_ELFILES:.el=.elc)
     19 
     20 TEST_ELFILES := $(wildcard test/*.el)
     21 TEST_ELCFILES := $(TEST_ELFILES:.el=.elc)
     22 
     23 all: compile compile-contrib
     24 
     25 # Compilation
     26 #
     27 sly.elc: sly.el lib/hyperspec.elc
     28 
     29 %.elc: %.el
     30 	$(EMACS) -Q $(LOAD_PATH) --batch -f batch-byte-compile $<
     31 
     32 compile: $(ELCFILES)
     33 compile-contrib: $(CONTRIB_ELCFILES)
     34 compile-test: $(TEST_ELCFILES)
     35 
     36 # Automated tests
     37 #
     38 check: check-core check-fancy
     39 
     40 check-core: SELECTOR=t
     41 check-core: compile
     42 	$(EMACS) -Q --batch $(LOAD_PATH)				\
     43 		--eval "(require 'sly-tests \"lib/sly-tests\")"	\
     44 		--eval "(setq inferior-lisp-program \"$(LISP)\")"	\
     45 		--eval '(sly-batch-test (quote $(SELECTOR)))'
     46 
     47 check-%: CONTRIB_NAME=$(patsubst check-%,sly-%,$@)
     48 check-%: SELECTOR=(tag contrib)
     49 check-%: compile contrib/sly-%.elc test/sly-%-tests.elc
     50 	$(EMACS) -Q --batch $(LOAD_PATH) -L test			\
     51 		--eval "(require (quote sly))"				\
     52 		--eval "(setq sly-contribs (quote ($(CONTRIB_NAME))))"	\
     53 		--eval "(require					\
     54 			  (intern					\
     55 			    (format					\
     56 			       \"%s-tests\" (quote $(CONTRIB_NAME)))))" \
     57 		--eval "(setq inferior-lisp-program \"$(LISP)\")"	\
     58 		--eval '(sly-batch-test (quote $(SELECTOR)))'
     59 
     60 check-fancy: SELECTOR=(tag contrib)
     61 check-fancy: compile compile-contrib
     62 	$(EMACS) -Q --batch  $(LOAD_PATH) -L test			\
     63 		--eval "(require (quote sly))"				\
     64 		--eval "(sly-setup (quote (sly-fancy)))"		\
     65 		--eval "(mapc (lambda (sym)				\
     66 				 (require				\
     67 				   (intern (format \"%s-tests\" sym))	\
     68 				   nil t))				\
     69 			      (sly-contrib--all-dependencies		\
     70 				(quote sly-fancy)))"			\
     71 		--eval '(setq inferior-lisp-program "$(LISP)")'		\
     72 		--eval '(sly-batch-test (quote $(SELECTOR)))'	
     73 
     74 
     75 # Cleanup
     76 #
     77 FASLREGEX = .*\.\(fasl\|ufasl\|sse2f\|lx32fsl\|abcl\|fas\|lib\|trace\)$$
     78 
     79 clean-fasls:
     80 	find . -regex '$(FASLREGEX)' -exec rm -v {} \;
     81 	[ -d ~/.sly/fasl ] && rm -rf ~/.sly/fasl || true
     82 
     83 clean: clean-fasls
     84 	find . -iname '*.elc' -exec rm {} \;
     85 
     86 # Doc
     87 #
     88 doc-%:
     89 	$(MAKE) -C doc $(@:doc-%=%)
     90 doc: doc-help
     91 
     92 # Help
     93 #
     94 help:
     95 	@printf "\
     96 Main targets\n\
     97 all             -- compile all .el files\n\
     98 compile         -- compile just core SLY\n\
     99 compile-contrib -- compile just contribs\n\
    100 check           -- run tests in batch mode\n\
    101 clean           -- delete generated files\n\
    102 doc-help        -- print help about doc targets\n\
    103 help-vars       -- print info about variables\n\
    104 help            -- print this message\n"
    105 
    106 help-vars:
    107 	@printf "\
    108 Main make variables:\n\
    109 EMACS     -- program to start Emacs ($(EMACS))\n\
    110 LISP      -- program to start Lisp ($(LISP))\n\
    111 SELECTOR  -- selector for ERT tests ($(SELECTOR))\n"
    112 
    113 .PHONY: all clean compile compile-contrib check check-core \
    114 	check-fancy dochelp help-vars