Browse Source

Use SETUP_LOAD #4

pull/5/head
10sr 10 years ago
parent
commit
67f57101e8
5 changed files with 33 additions and 11 deletions
  1. +26
    -6
      Makefile
  2. +2
    -2
      emacs.el
  3. +1
    -0
      setup.sh
  4. +1
    -0
      tmux.conf
  5. +3
    -3
      vimrc

+ 26
- 6
Makefile View File

@@ -32,6 +32,7 @@ shrc_common_tpl =
emacs ?= $(shell which emacs 2>/dev/null)
git ?= $(shell which git 2>/dev/null)
curl ?= $(shell which curl 2>/dev/null)
grep ?= GREP_OPTIONS= $(shell which grep 2>/dev/null)

# Targets

@@ -44,8 +45,9 @@ test_syntaxes = test-syntax-el test-syntax-sh
test-syntax: $(test_syntaxes)

setups = setup-darwin setup-directories setup-emacs setup-gitconf \
setup-repository setup-util setup-tmux
setup: $(setups)
setup-repository setup-util setup-rc
# `make setup` to setup these all sounds to be too match
setup-all: $(setups)



@@ -112,7 +114,9 @@ endif
# setup repository
# ----------------

setup-repository:
setup-repository: $(dotfiles_dir)/.git

$(dotfiles_dir)/.git:
ifeq (,$(git))
false "Git not installed"
endif
@@ -264,13 +268,29 @@ endif



# tmux setup
# ----------
# setup rc files
# --------------

setup_rcs = setup-rc-vimrc setup-rc-tmux.conf setup-rc-emacs.el
setup-rc: $(setup_rcs)
.PHONY: $(setup_rcs)

setup-tmux:
command_extract_setup_load = $(grep) -e 'SETUP_LOAD: ' | \
sed -e 's/^.*SETUP_LOAD: //' -e 's|DOTFILES_DIR|$(dotfiles_dir)|'

$(setup_rcs): setup-rc-%: $(dotfiles_dir)/%
ifeq (,$(append_load))
@echo "\`append_load' is not defined. Just print load command."
cat "$<" | $(command_extract_setup_load)
else
cat "$<" | $(command_extract_setup_load) | tee -a "$(topfile)"
endif

setup-rc-vimrc: topfile = $(home)/.vimrc
setup-rc-tmux.conf: topfile = $(home)/.tmux.conf
setup-rc-emacs.el: topfile = $(home)/.emacs.d/init.el

$(dotfiles_dir)/%: setup-repository


# test


+ 2
- 2
emacs.el View File

@@ -4,8 +4,8 @@

;;; Code:

;; (and (file-readable-p "~/.dotfiles/emacs.el")
;; (load-file "~/.dotfiles/emacs.el"))
;; SETUP_LOAD: (and (file-readable-p "DOTFILES_DIR/emacs.el")
;; SETUP_LOAD: (load-file "DOTFILES_DIR/emacs.el"))

;; make directories
(unless (file-directory-p (expand-file-name user-emacs-directory))


+ 1
- 0
setup.sh View File

@@ -292,6 +292,7 @@ __EOC__
}

##############################

# setup scripts

_fetch_script(){


+ 1
- 0
tmux.conf View File

@@ -1,4 +1,5 @@
# tmux.conf
# SETUP_LOAD: source "DOTFILES_DIR/tmux.conf"

run-shell 'tmux set -g status-right "${USER}@`hostname` | #(tmux -V) "'



+ 3
- 3
vimrc View File

@@ -1,7 +1,7 @@
" "load external file
" if filereadable(expand('~/.dotfiles/vimrc'))
" source ~/.dotfiles/vimrc
" endif
" SETUP_LOAD: if filereadable(expand('DOTFILES_DIR/vimrc'))
" SETUP_LOAD: source DOTFILES_DIR/vimrc
" SETUP_LOAD: endif
if !isdirectory(expand('~/.vim'))
call mkdir(expand('~/.vim'))
endif


Loading…
Cancel
Save