config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

Makefile (2580B)


      1 CASK = cask
      2 EMACS ?= emacs
      3 # Handle the mess when inside Emacs.
      4 unexport INSIDE_EMACS		#cask not like this.
      5 ifeq ($(EMACS), t)
      6 EMACS = emacs
      7 endif
      8 
      9 emacs = $(EMACS)
     10 emacs_version = $(shell $(emacs) --batch --eval \
     11 		'(princ (format "%s.%s" emacs-major-version emacs-minor-version))')
     12 $(info Using Emacs $(emacs_version))
     13 
     14 version=$(shell sed -ne 's/^;\+ *Version: *\([0-9.]\)/\1/p' lisp/pdf-tools.el)
     15 pkgname=pdf-tools-$(version)
     16 pkgfile=$(pkgname).tar
     17 
     18 .PHONY: all clean distclean bytecompile test check melpa
     19 
     20 all: $(pkgfile)
     21 
     22 # Create a elpa package including the server
     23 $(pkgfile): .cask/$(emacs_version) server/epdfinfo lisp/*.el
     24 	$(CASK) package .
     25 
     26 # Compile the Lisp sources
     27 bytecompile: .cask/$(emacs_version)
     28 	$(CASK) exec $(emacs) --batch -L lisp -f batch-byte-compile lisp/*.el
     29 
     30 # Clean bytecompiled sources
     31 byteclean:
     32 	rm -f -- lisp/*.elc
     33 	rm -f -- lisp/*.eln
     34 
     35 # Run ERT tests
     36 test: all
     37 	PACKAGE_TAR=$(pkgfile) $(CASK) exec ert-runner
     38 
     39 check: test
     40 
     41 # Run the autobuild script tests in docker
     42 test-autobuild: server-test
     43 
     44 # Run all tests
     45 test-all: test test-autobuild
     46 
     47 # Init cask
     48 .cask/$(emacs_version):
     49 	$(CASK) install
     50 
     51 # Run the autobuild script (installing depends and compiling)
     52 autobuild:
     53 	cd server && ./autobuild
     54 
     55 # Soon to be obsolete targets
     56 melpa-build: autobuild
     57 	cp build/epdfinfo .
     58 install-server-deps: ;
     59 
     60 # Create a package like melpa would.
     61 melpa-package: $(pkgfile)
     62 	cp $(pkgfile) $(pkgname)-melpa.tar
     63 	tar -u --transform='s/server/$(pkgname)\/build\/server/' \
     64 		-f $(pkgname)-melpa.tar \
     65 		$$(git ls-files server)
     66 	tar -u --transform='s/Makefile/$(pkgname)\/build\/Makefile/' \
     67 		-f $(pkgname)-melpa.tar \
     68 		Makefile
     69 	tar -u --transform='s/README\.org/$(pkgname)\/README/' \
     70 		-f $(pkgname)-melpa.tar \
     71 		README.org
     72 	-tar --delete $(pkgname)/epdfinfo \
     73 		-f $(pkgname)-melpa.tar
     74 
     75 # Various clean targets
     76 clean: server-clean byteclean
     77 	rm -f -- $(pkgfile)
     78 	rm -f -- pdf-tools-readme.txt
     79 	rm -f -- pdf-tools-$(version).entry
     80 
     81 distclean: clean server-distclean
     82 	rm -rf -- .cask
     83 
     84 # Server targets
     85 server/epdfinfo: server/Makefile server/*.[ch]
     86 	$(MAKE) -C server
     87 
     88 server/Makefile: server/configure
     89 	cd server && ./configure -q
     90 
     91 server/configure: server/configure.ac
     92 	cd server && ./autogen.sh
     93 
     94 server-test: server/Makefile
     95 	$(MAKE) -C server check
     96 
     97 server-clean:
     98 	! [ -f server/Makefile ] || $(MAKE) -C server clean
     99 
    100 server-distclean:
    101 	! [ -f server/Makefile ] || $(MAKE) -C server distclean
    102 
    103 server-test-supported: server/test/Makefile
    104 	$(MAKE) -C server/test print
    105 
    106 server-test-unsupported: server/test/Makefile
    107 	$(MAKE) -C server/test print-failing