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.
 
 
 
 
 
 

122 lines
2.6 KiB

  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. $(test_syntax_els): test-syntax-%: %
  79. $(emacs) -Q --debug-init --batch \
  80. --eval '(with-temp-buffer(emacs-lisp-mode)(insert-file-contents "$<")(check-parens))' --kill