選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Makefile 2.9 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. home ?= $(HOME)
  2. dotfiles_dir ?= $(home)/10sr_dotfiles
  3. dotfiles_url_base=https://raw.githubusercontent.com/10sr/dotfiles/master/
  4. localdir = $(home)/.local
  5. vardir = $(home)/.var
  6. bindir = $(localdir)/bin
  7. current = $(shell date)
  8. ostype = $(shell uname)
  9. shrc_loadables = sh bash zsh
  10. shrc_common_tpl =
  11. emacs ?= emacs
  12. all: default
  13. # `make check` is just an alias for `make test`
  14. check: test
  15. # Similarly, check-syntax is test-syntax
  16. check-syntax: test-syntax
  17. tests = test-el
  18. test: test-syntax $(tests)
  19. test_syntaxes = test-syntax-el test-syntax-sh
  20. test-syntax: $(test_syntaxes)
  21. setups = setup-darwin setup-directories setup-emacs
  22. setup: $(setups)
  23. .PHONY: all default \
  24. test check $(tests) \
  25. test-syntax check-syntax $(test_syntaxes)\
  26. setup $(setups)
  27. # setups
  28. # ======
  29. # create directories
  30. # ------------------
  31. setup_directories = $(localdir) $(vardir) $(bindir)
  32. setup-directory: $(setup_directories)
  33. $(localdir) $(vardir) $(bindir):
  34. mkdir -vp $@
  35. # darwin
  36. # ------
  37. setup_darwins = setup-darwin-defaults setup-darwin-daemon
  38. setup-darwin: $(setup_darwins)
  39. .PHONY: $(setup_darwins)
  40. setup-darwin-defaults:
  41. # http://appdrill.net/60641/mac-boot-mute.html
  42. #sudo nvram SystemAudioVolume=%80
  43. # add quit entry in menu
  44. defaults write com.apple.finder QuitMenuItem -bool YES
  45. # show full path on titlebar
  46. defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES
  47. # do not show desktop icons
  48. defaults write com.apple.finder CreateDesktop -boolean false
  49. killall Finder
  50. # disable dashboard
  51. #defaults write com.apple.dashboard mcx-disabled -bool YES
  52. setup-darwin-daemon:
  53. test "`launchctl getenv LC_ALL`" = C || sudo launchctl setenv LC_ALL C
  54. if ! (launchctl list | grep com.apple.locate) >/dev/null ;\
  55. then \
  56. sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist ;\
  57. fi
  58. # emacs setup
  59. # -----------
  60. setup-emacs: emacs.el
  61. $(emacs) -q --debug-init --batch --load $< -f my-auto-install-package
  62. # test
  63. # ====
  64. test-el: emacs.el
  65. EMACS_EL_DRY_RUN=t $(emacs) -q --debug-init --batch \
  66. --eval "(setq debug-on-error t)" --load $< --kill
  67. # test syntax
  68. # ===========
  69. test_syntax_shs = test-syntax-shrc test-syntax-profile test-syntax-setup.sh \
  70. test-syntax-xinitrc test-syntax-xprograms
  71. test-syntax-sh: $(test_syntax_shs)
  72. .PHONY: $(test_syntax_shs)
  73. $(test_syntax_shs): test-syntax-%: %
  74. sh -ec 'for sh in $(shrc_loadables); do $$sh -n $<; done'
  75. test_syntax_els = test-syntax-emacs.el
  76. test-syntax-el: $(test_syntax_els)
  77. .PHONY: $(test_syntax_els)
  78. sexp_elisp_syntax_check = \
  79. (with-temp-buffer \
  80. (emacs-lisp-mode) \
  81. (insert-file-contents file) \
  82. (condition-case err \
  83. (check-parens) \
  84. (user-error \
  85. (error (format "%s:%d:%d:Unmatched brancet or quote" \
  86. file \
  87. (line-number-at-pos) \
  88. (- (point) (point-at-bol)))))))
  89. $(test_syntax_els): test-syntax-%: %
  90. $(emacs) -Q --debug-init --batch \
  91. --eval '(let ((file "$<")) $(sexp_elisp_syntax_check))' --kill