equal
deleted
inserted
replaced
40 host_os = windows |
40 host_os = windows |
41 endif |
41 endif |
42 endif |
42 endif |
43 |
43 |
44 ################################################################ |
44 ################################################################ |
45 # Installation directories. |
45 # Installation directories and files. |
46 |
46 |
47 emacsdir := $(HOME)/.emacs.d |
47 emacsdir := $(HOME)/.emacs.d |
48 mylispdir := $(emacsdir)/my |
48 mylispdir := $(emacsdir)/my |
|
49 |
|
50 # Compatibility version. |
|
51 COMPAT_VER := 1 |
|
52 COMPAT_FILE := $(emacsdir)/.emacs-ver |
49 |
53 |
50 ################################################################ |
54 ################################################################ |
51 # Build tool definition/switches. |
55 # Build tool definition/switches. |
52 |
56 |
53 EMACS = emacs |
57 EMACS = emacs |
78 all: install |
82 all: install |
79 |
83 |
80 ################################################################ |
84 ################################################################ |
81 # Install/uninstall targets. |
85 # Install/uninstall targets. |
82 |
86 |
|
87 .PHONY: check-install-comapt |
|
88 check-install-comapt: |
|
89 [ -f $(COMPAT_FILE) ] || { echo $(COMPAT_FILE) missing, run '"make upgrade"' first; false; } |
|
90 read ver <$(COMPAT_FILE); if [ "$$ver" -ne $(COMPAT_VER) ]; then echo "*** "Run '"make upgrade"' first" ***"; exit 1; fi |
|
91 |
|
92 .PHONY: check-upgrade-comapt |
|
93 check-upgrade-comapt: |
|
94 \ |
|
95 if [ -f $(COMPAT_FILE) ]; then \ |
|
96 read ver <$(COMPAT_FILE); \ |
|
97 if [ "$$ver" -gt $(COMPAT_VER) ]; then \ |
|
98 echo "*** "Project is too old, downgrade is not possible..." ***"; \ |
|
99 exit 1; \ |
|
100 fi; \ |
|
101 fi |
|
102 |
83 .PHONY: upgrade |
103 .PHONY: upgrade |
84 upgrade: |
104 upgrade: check-upgrade-comapt |
85 \ |
105 \ |
86 mkdir -p $(mylispdir); \ |
106 mkdir -p $(mylispdir); \ |
87 rm -f $(emacsdir)/autoload-my.el; \ |
107 rm -f $(emacsdir)/autoload-my.el; \ |
88 rm -f ~/.emacs; \ |
108 rm -f ~/.emacs; \ |
89 [ -d $(emacsdir)/my-lisp ] && mv $(emacsdir)/my-lisp $(mylispdir); \ |
109 [ -d $(emacsdir)/my-lisp ] && mv $(emacsdir)/my-lisp $(mylispdir); \ |
93 done; \ |
113 done; \ |
94 for f in `find $(mylispdir) -maxdepth 1 -type f -name '.emacs?*'`; do \ |
114 for f in `find $(mylispdir) -maxdepth 1 -type f -name '.emacs?*'`; do \ |
95 fn=$${f##*/}; \ |
115 fn=$${f##*/}; \ |
96 [ -f $(emacsdir)/$$fn ] && mv $$f $(emacsdir)/$$fn.3 || mv $$f $(emacsdir); \ |
116 [ -f $(emacsdir)/$$fn ] && mv $$f $(emacsdir)/$$fn.3 || mv $$f $(emacsdir); \ |
97 done; \ |
117 done; \ |
|
118 echo $(COMPAT_VER) >$(COMPAT_FILE); \ |
98 make install |
119 make install |
99 |
120 |
100 .PHONY: install-all |
121 .PHONY: install-all |
101 install-all: install |
122 install-all: install |
102 cp .emacs-pre $(emacsdir)/.emacs-pre |
123 cp .emacs-pre $(emacsdir)/.emacs-pre |
105 define cleanup_mylispdir |
126 define cleanup_mylispdir |
106 find $(mylispdir) -type f '(' -name '*.el' -o -name '*.elc' ')' -delete |
127 find $(mylispdir) -type f '(' -name '*.el' -o -name '*.elc' ')' -delete |
107 endef |
128 endef |
108 |
129 |
109 .PHONY: install |
130 .PHONY: install |
110 install: |
131 install: check-install-comapt |
111 mkdir -p $(mylispdir) |
132 mkdir -p $(mylispdir) |
112 $(cleanup_mylispdir) |
133 $(cleanup_mylispdir) |
113 for file in .emacs-pre .emacs-post; do \ |
134 for file in .emacs-pre .emacs-post; do \ |
114 [ -f $(emacsdir)/$$file ] || cp $$file $(emacsdir)/$$file; \ |
135 [ -f $(emacsdir)/$$file ] || cp $$file $(emacsdir)/$$file; \ |
115 done |
136 done |