Makefile
changeset 260 437507e141b4
parent 165 9f5dd505a4cf
child 261 16b1f9a3ee99
equal deleted inserted replaced
258:29533873ee3e 260:437507e141b4
     2 
     2 
     3 ifeq '' '$(HOME)'
     3 ifeq '' '$(HOME)'
     4   $(error Home env var not set!)
     4   $(error Home env var not set!)
     5 endif
     5 endif
     6 
     6 
     7 .PHONY: all install preinstall install-all preinstall-all update-dot-emacs-pre update-dot-emacs-post tar
     7 .PHONY: all
     8 
       
     9 all: install
     8 all: install
    10 
     9 
       
    10 .PHONY: install
    11 install: preinstall update-dot-emacs-pre update-dot-emacs-post
    11 install: preinstall update-dot-emacs-pre update-dot-emacs-post
    12 
    12 
       
    13 .PHONY: preinstall
    13 preinstall: .emacs .emacs-my .emacs-pre .emacs-post
    14 preinstall: .emacs .emacs-my .emacs-pre .emacs-post
    14 	for file in .emacs-pre .emacs-post; do \
    15 	for file in .emacs-pre .emacs-post; do \
    15 		if [ ! -f $(HOME)/$$file ]; then cp $$file $(HOME)/$$file; fi; \
    16 		if [ ! -f $(HOME)/$$file ]; then cp $$file $(HOME)/$$file; fi; \
    16 	done
    17 	done
    17 	cp .emacs $(HOME)/.emacs
    18 	cp .emacs $(HOME)/.emacs
    18 	cp .emacs-my $(HOME)/.emacs-my
    19 	cp .emacs-my $(HOME)/.emacs-my
    19 
    20 
       
    21 .PHONY: install-all
    20 install-all: preinstall-all update-dot-emacs-pre update-dot-emacs-post
    22 install-all: preinstall-all update-dot-emacs-pre update-dot-emacs-post
    21 
    23 
       
    24 .PHONY: preinstall-all
    22 preinstall-all: .emacs .emacs-my .emacs-pre .emacs-post
    25 preinstall-all: .emacs .emacs-my .emacs-pre .emacs-post
    23 	for file in $^; do \
    26 	for file in $^; do \
    24 		cp $$file $(HOME)/$$file; \
    27 		cp $$file $(HOME)/$$file; \
    25 	done
    28 	done
    26 
    29 
       
    30 .PHONY: update-dot-emacs-pre
    27 update-dot-emacs-pre:
    31 update-dot-emacs-pre:
    28 	for file in `cd template-pre; ls *.el`; do \
    32 	for file in `cd template-pre; ls *.el`; do \
    29 		tag=$${file%.el}; \
    33 		tag=$${file%.el}; \
    30 		if grep "DO NOT EDIT COMMENT! TAG: $$tag" $(HOME)/.emacs-pre; then \
    34 		if grep "DO NOT EDIT COMMENT! TAG: $$tag" $(HOME)/.emacs-pre; then \
    31 			:; \
    35 			:; \
    32 		else \
    36 		else \
    33 			cat template-pre/$$file >>$(HOME)/.emacs-pre; \
    37 			cat template-pre/$$file >>$(HOME)/.emacs-pre; \
    34 		fi; \
    38 		fi; \
    35 	done
    39 	done
    36 
    40 
       
    41 .PHONY: update-dot-emacs-post
    37 update-dot-emacs-post:
    42 update-dot-emacs-post:
    38 	for file in `cd template-post; ls *.el`; do \
    43 	for file in `cd template-post; ls *.el`; do \
    39 		tag=$${file%.el}; \
    44 		tag=$${file%.el}; \
    40 		if grep "DO NOT EDIT COMMENT! TAG: $$tag" $(HOME)/.emacs-post; then \
    45 		if grep "DO NOT EDIT COMMENT! TAG: $$tag" $(HOME)/.emacs-post; then \
    41 			:; \
    46 			:; \
    42 		else \
    47 		else \
    43 			cat template-post/$$file >>$(HOME)/.emacs-post; \
    48 			cat template-post/$$file >>$(HOME)/.emacs-post; \
    44 		fi; \
    49 		fi; \
    45 	done
    50 	done
    46 
    51 
       
    52 .PHONY: tar
    47 tar:
    53 tar:
    48 	tar cf dot-emacs.tar .emacs .emacs-my
    54 	tar cf dot-emacs.tar .emacs .emacs-my
    49 
    55 
       
    56 .PHONY: distclean
       
    57 distclean: clean
       
    58 
       
    59 .PHONY: clean
    50 clean:
    60 clean:
    51 	rm -f dot-emacs.tar
    61 	rm -f dot-emacs.tar