Fix compilation on Windows, add install target
Paths on Windows get confused since I use a strange combination of some 4 different GNU/Linux-like systems on Windows (cygwin, msys2, msys git, WSL). Since Windows doesn't support symlinks properly, I can't use GNU Stow to install my files. So for Windows I copy over all the necessary files.
This commit is contained in:
parent
701601ca86
commit
736cf0f37f
2 changed files with 36 additions and 17 deletions
|
@ -3,20 +3,18 @@ EMACS := emacs
|
||||||
|
|
||||||
.SECONDARY:
|
.SECONDARY:
|
||||||
|
|
||||||
AUTOLOADS_FILE = site-lisp/site-autoloads.el
|
AUTOLOADS_FILE := site-lisp/site-autoloads.el
|
||||||
UNWANTED = $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-%
|
UNWANTED := $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-%
|
||||||
SITE_LISPS = $(addsuffix c,$(filter-out $(UNWANTED),$(wildcard site-lisp/*.el)))
|
SITE_LISPS := $(filter-out $(UNWANTED),$(wildcard site-lisp/*.el))
|
||||||
INIT_LISPS = init/oni-org-init.elc init/oni-js2-init.elc init/oni-gnus-init.elc \
|
COMPILED_SITE_LISPS := $(addsuffix c,$(SITE_LISPS))
|
||||||
init/oni-cmake-init.elc init/oni-cpp-init.elc \
|
INIT_LISPS := init/oni-org-init.el init/oni-js2-init.el init/oni-gnus-init.el \
|
||||||
$(addsuffix .elc,$(basename $(wildcard init/*.org)))
|
init/oni-cmake-init.el init/oni-cpp-init.el $(wildcard init/*.el)
|
||||||
VENDOR_DIRS = $(wildcard vendor-lisp/*)
|
COMPILED_INIT_LISPS := $(addsuffix c,$(INIT_LISPS))
|
||||||
|
VENDOR_DIRS := $(wildcard vendor-lisp/*)
|
||||||
ifeq ($(OS),Windows_NT)
|
BASE_DIR := $(CURDIR)
|
||||||
include windows.mk
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: all snippets
|
.PHONY: all snippets
|
||||||
all: $(SITE_LISPS) init.elc $(INIT_LISPS) $(AUTOLOADS_FILE) snippets
|
all: $(COMPILED_SITE_LISPS) init.elc $(INIT_LISPS) $(AUTOLOADS_FILE) snippets
|
||||||
|
|
||||||
%.elc: %.el
|
%.elc: %.el
|
||||||
@echo -e "\e[31mELC\e[0m $<"
|
@echo -e "\e[31mELC\e[0m $<"
|
||||||
|
@ -30,11 +28,11 @@ all: $(SITE_LISPS) init.elc $(INIT_LISPS) $(AUTOLOADS_FILE) snippets
|
||||||
|
|
||||||
### Site Lisp
|
### Site Lisp
|
||||||
|
|
||||||
$(AUTOLOADS_FILE): $(SITE_LISPS)
|
$(AUTOLOADS_FILE): $(COMPILED_SITE_LISPS)
|
||||||
@echo -e "\e[32mGEN\e[0m $@"
|
@echo -e "\e[32mGEN\e[0m $@"
|
||||||
@$(EMACS) -batch \
|
@$(EMACS) -batch \
|
||||||
-eval "(setq generated-autoload-file \"$(CURDIR)/$@\")" \
|
-eval "(setq generated-autoload-file \"$(BASE_DIR)/$@\")" \
|
||||||
-eval "(update-directory-autoloads \"$(CURDIR)/site-lisp/\")"
|
-eval "(update-directory-autoloads \"$(BASE_DIR)/site-lisp/\")"
|
||||||
|
|
||||||
### Snippets
|
### Snippets
|
||||||
|
|
||||||
|
@ -42,10 +40,14 @@ SNIPPET_DIRS = $(wildcard snippets/*)
|
||||||
COMPILED_SNIPPETS = $(addsuffix /.yas-compiled-snippets.el, $(SNIPPET_DIRS))
|
COMPILED_SNIPPETS = $(addsuffix /.yas-compiled-snippets.el, $(SNIPPET_DIRS))
|
||||||
|
|
||||||
%/.yas-compiled-snippets.el: %/*
|
%/.yas-compiled-snippets.el: %/*
|
||||||
@echo -e "\e[36mYAS\e[0m $(CURDIR)/snippets"
|
@echo -e "\e[36mYAS\e[0m $(BASE_DIR)/snippets"
|
||||||
@$(EMACS) -batch \
|
@$(EMACS) -batch \
|
||||||
-eval "(package-initialize)" \
|
-eval "(package-initialize)" \
|
||||||
-l yasnippet \
|
-l yasnippet \
|
||||||
-eval "(yas-compile-directory \"$(CURDIR)/snippets\")"
|
-eval "(yas-compile-directory \"$(BASE_DIR)/snippets\")"
|
||||||
|
|
||||||
snippets: $(COMPILED_SNIPPETS)
|
snippets: $(COMPILED_SNIPPETS)
|
||||||
|
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
include windows.mk
|
||||||
|
endif
|
||||||
|
|
17
emacs/.emacs.d/windows.mk
Executable file → Normal file
17
emacs/.emacs.d/windows.mk
Executable file → Normal file
|
@ -1,2 +1,19 @@
|
||||||
EMACS := C:/msys64/mingw64/bin/emacs.exe
|
EMACS := C:/msys64/mingw64/bin/emacs.exe
|
||||||
HOME := $(APPDATA)
|
HOME := $(APPDATA)
|
||||||
|
INSTALLDIR := $(APPDATA)/.emacs.d
|
||||||
|
BASE_DIR := $(subst \,/,$(shell cygpath -w $(CURDIR)))
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
|
||||||
|
ALL_LISPS := init.el init.elc $(SITE_LISPS) $(COMPILED_SITE_LISPS) \
|
||||||
|
$(INIT_LISPS) $(COMPILED_INIT_LISPS)
|
||||||
|
|
||||||
|
install:
|
||||||
|
for file in $(ALL_LISPS); do \
|
||||||
|
[[ -e $$file ]] && install -Dm 644 $$file "$(INSTALLDIR)/$$file"; \
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir -p "$(INSTALLDIR)/vendor-lisp/"
|
||||||
|
for dir in $(VENDOR_DIRS); do \
|
||||||
|
cp --recursive $$dir "$(INSTALLDIR)/$$dir"; \
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in a new issue