Makefile
changeset 836 034e9cfcc17c
parent 833 023190b14d77
child 908 e3b3e9f4d759
equal deleted inserted replaced
732:139665dd6ada 836:034e9cfcc17c
    26   $(error Home env var not set!)
    26   $(error Home env var not set!)
    27 endif
    27 endif
    28 
    28 
    29 host_os = unix
    29 host_os = unix
    30 ifneq '' '$(COMSPEC)'
    30 ifneq '' '$(COMSPEC)'
    31   host_os = windows
    31   ifneq '' '$(WINDIR)'
       
    32     # Probably under Windows.
       
    33     host_os = windows
       
    34   endif
    32 endif
    35 endif
       
    36 
       
    37 ################################################################
       
    38 # Build tool definition/switches.
    33 
    39 
    34 EMACS = emacs
    40 EMACS = emacs
    35 # I prefer native Windows Emacs, so use it if available.
    41 # I prefer native Windows Emacs, so use it if available.
    36 ifeq 'windows' '$(host_os)'
    42 ifeq 'windows' '$(host_os)'
    37   ifneq '' '$(call which,runemacs.exe)'
    43   ifneq '' '$(call which,runemacs.exe)'
    38     EMACS = runemacs
    44     EMACS = runemacs
    39   endif
    45   endif
    40 endif
    46 endif
    41 
    47 
       
    48 RST2HTML = rst2html
       
    49 ifeq '$(host_os)' 'windows'
       
    50   RST2HTML = rst2html.py
       
    51 endif
       
    52 
       
    53 ################################################################
       
    54 # Proj dirs/files.
       
    55 
       
    56 FILES_MODE_EL := $(wildcard *-mode.el)
       
    57 
       
    58 RST_FILES := $(wildcard *.rst)
       
    59 HTML_FILES := $(RST_FILES:.rst=.html)
       
    60 
    42 ################################################################
    61 ################################################################
    43 # Targets.
    62 # Targets.
    44 
    63 
    45 FILES_MODE_EL := $(wildcard *-mode.el)
       
    46 
       
    47 .PHONY: all
    64 .PHONY: all
    48 all: install
    65 all: install
       
    66 
       
    67 ################################################################
       
    68 # Install/uninstall targets.
    49 
    69 
    50 .PHONY: install-all
    70 .PHONY: install-all
    51 install-all: install
    71 install-all: install
    52 	cp .emacs-pre $(HOME)/.emacs-pre
    72 	cp .emacs-pre $(HOME)/.emacs-pre
    53 	cp .emacs-post $(HOME)/.emacs-post
    73 	cp .emacs-post $(HOME)/.emacs-post
    54 
    74 
    55 .PHONY: install
    75 .PHONY: install
    56 install: .emacs .emacs-my .emacs-pre .emacs-post $(FILES_MODE_EL)
    76 install: .emacs .emacs-my .emacs-pre .emacs-post $(FILES_MODE_EL)
    57 	for file in .emacs-pre .emacs-post; do \
    77 	for file in .emacs-pre .emacs-post; do \
    58 		if [ ! -f $(HOME)/$$file ]; then cp $$file $(HOME)/$$file; fi; \
    78 		[ -f $(HOME)/$$file ] || cp $$file $(HOME)/$$file; \
    59 	done
    79 	done
    60 	cp .emacs $(HOME)/.emacs
    80 	cp .emacs $(HOME)/.emacs
    61 	cp .emacs-my $(HOME)/.emacs-my
    81 	cp .emacs-my $(HOME)/.emacs-my
    62 	rm -f -r $(HOME)/.emacs.d/my-lisp
    82 	rm -f -r $(HOME)/.emacs.d/my-lisp
    63 	mkdir -p $(HOME)/.emacs.d/my-lisp
    83 	mkdir -p $(HOME)/.emacs.d/my-lisp
    68 		--eval='(let ( (generated-autoload-file "~/.emacs.d/my-lisp/autoload-my.el") ) (update-directory-autoloads "~/.emacs.d/my-lisp") )'
    88 		--eval='(let ( (generated-autoload-file "~/.emacs.d/my-lisp/autoload-my.el") ) (update-directory-autoloads "~/.emacs.d/my-lisp") )'
    69 	./.emacs-autogen.sh $(HOME)/.emacs-autogen
    89 	./.emacs-autogen.sh $(HOME)/.emacs-autogen
    70 
    90 
    71 .PHONY: uninstall
    91 .PHONY: uninstall
    72 uninstall:
    92 uninstall:
    73 	@echo !!! Nothing done !!!
    93 	rm -f $(HOME)/.emacs $(HOME)/.emacs-my $(HOME)/.emacs-autogen
       
    94 	rm -f -r $(HOME)/.emacs.d/my-lisp
    74 
    95 
    75 .PHONY: tar
    96 .PHONY: tar
    76 tar:
    97 tar:
    77 	tar cf dot-emacs.tar .emacs .emacs-my
    98 	tar cf dot-emacs.tar .emacs .emacs-my
       
    99 
       
   100 ################################################################
       
   101 # Documentation targets.
       
   102 
       
   103 .PHONY: html
       
   104 html: $(HTML_FILES)
       
   105 
       
   106 $(HTML_FILES): %.html: %.rst
       
   107 	$(RST2HTML) --stylesheet=rst.css $*.rst $@
       
   108 
       
   109 ################################################################
       
   110 # Clean targets.
    78 
   111 
    79 .PHONY: distclean
   112 .PHONY: distclean
    80 distclean: clean
   113 distclean: clean
    81 
   114 
    82 .PHONY: clean
   115 .PHONY: clean
    83 clean:
   116 clean:
    84 	rm -f dot-emacs.tar
   117 	rm -f dot-emacs.tar $(HTML_FILES)