You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 年之前
10 年之前
10 年之前
10 年之前
10 年之前
10 年之前
10 年之前
10 年之前
10 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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_els = test-el-emacs.el
  65. test-el: $(test_els)
  66. .PHONY: $(test_els)
  67. $(test_els): test-el-%: %
  68. $(emacs) -Q -batch -f batch-byte-compile $<
  69. EMACS_EL_DRY_RUN=t $(emacs) -q --debug-init --batch \
  70. --eval "(setq debug-on-error t)" --load $<c --kill
  71. # test syntax
  72. # ===========
  73. test_syntax_shs = test-syntax-shrc test-syntax-profile test-syntax-setup.sh \
  74. test-syntax-xinitrc test-syntax-xprograms
  75. test-syntax-sh: $(test_syntax_shs)
  76. .PHONY: $(test_syntax_shs)
  77. $(test_syntax_shs): test-syntax-%: %
  78. sh -ec 'for sh in $(shrc_loadables); do $$sh -n $<; done'
  79. test_syntax_els = test-syntax-emacs.el
  80. test-syntax-el: $(test_syntax_els)
  81. .PHONY: $(test_syntax_els)
  82. sexp_elisp_syntax_check = \
  83. (with-temp-buffer \
  84. (emacs-lisp-mode) \
  85. (insert-file-contents file) \
  86. (condition-case err \
  87. (check-parens) \
  88. (user-error \
  89. (error (format "%s:%d:%d:Unmatched brancet or quote" \
  90. file \
  91. (line-number-at-pos) \
  92. (- (point) (point-at-bol)))))))
  93. $(test_syntax_els): test-syntax-%: %
  94. $(emacs) -Q --debug-init --batch \
  95. --eval '(let ((file "$<")) $(sexp_elisp_syntax_check))' --kill