From 736cf0f37f1c566c07f5d2540438a89569f816a8 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Wed, 13 Jun 2018 11:15:49 -0700 Subject: [PATCH] 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. --- emacs/.emacs.d/GNUmakefile | 36 +++++++++++++++++++----------------- emacs/.emacs.d/windows.mk | 17 +++++++++++++++++ 2 files changed, 36 insertions(+), 17 deletions(-) mode change 100755 => 100644 emacs/.emacs.d/windows.mk diff --git a/emacs/.emacs.d/GNUmakefile b/emacs/.emacs.d/GNUmakefile index dbb8f78..20f6866 100644 --- a/emacs/.emacs.d/GNUmakefile +++ b/emacs/.emacs.d/GNUmakefile @@ -3,20 +3,18 @@ EMACS := emacs .SECONDARY: -AUTOLOADS_FILE = site-lisp/site-autoloads.el -UNWANTED = $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-% -SITE_LISPS = $(addsuffix c,$(filter-out $(UNWANTED),$(wildcard site-lisp/*.el))) -INIT_LISPS = init/oni-org-init.elc init/oni-js2-init.elc init/oni-gnus-init.elc \ - init/oni-cmake-init.elc init/oni-cpp-init.elc \ - $(addsuffix .elc,$(basename $(wildcard init/*.org))) -VENDOR_DIRS = $(wildcard vendor-lisp/*) - -ifeq ($(OS),Windows_NT) -include windows.mk -endif +AUTOLOADS_FILE := site-lisp/site-autoloads.el +UNWANTED := $(AUTOLOADS_FILE) site-lisp/flycheck_% site-lisp/flycheck-% +SITE_LISPS := $(filter-out $(UNWANTED),$(wildcard site-lisp/*.el)) +COMPILED_SITE_LISPS := $(addsuffix c,$(SITE_LISPS)) +INIT_LISPS := init/oni-org-init.el init/oni-js2-init.el init/oni-gnus-init.el \ + init/oni-cmake-init.el init/oni-cpp-init.el $(wildcard init/*.el) +COMPILED_INIT_LISPS := $(addsuffix c,$(INIT_LISPS)) +VENDOR_DIRS := $(wildcard vendor-lisp/*) +BASE_DIR := $(CURDIR) .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 @echo -e "\e[31mELC\e[0m $<" @@ -30,11 +28,11 @@ all: $(SITE_LISPS) init.elc $(INIT_LISPS) $(AUTOLOADS_FILE) snippets ### Site Lisp -$(AUTOLOADS_FILE): $(SITE_LISPS) +$(AUTOLOADS_FILE): $(COMPILED_SITE_LISPS) @echo -e "\e[32mGEN\e[0m $@" @$(EMACS) -batch \ - -eval "(setq generated-autoload-file \"$(CURDIR)/$@\")" \ - -eval "(update-directory-autoloads \"$(CURDIR)/site-lisp/\")" + -eval "(setq generated-autoload-file \"$(BASE_DIR)/$@\")" \ + -eval "(update-directory-autoloads \"$(BASE_DIR)/site-lisp/\")" ### Snippets @@ -42,10 +40,14 @@ SNIPPET_DIRS = $(wildcard snippets/*) COMPILED_SNIPPETS = $(addsuffix /.yas-compiled-snippets.el, $(SNIPPET_DIRS)) %/.yas-compiled-snippets.el: %/* - @echo -e "\e[36mYAS\e[0m $(CURDIR)/snippets" + @echo -e "\e[36mYAS\e[0m $(BASE_DIR)/snippets" @$(EMACS) -batch \ -eval "(package-initialize)" \ -l yasnippet \ - -eval "(yas-compile-directory \"$(CURDIR)/snippets\")" + -eval "(yas-compile-directory \"$(BASE_DIR)/snippets\")" snippets: $(COMPILED_SNIPPETS) + +ifeq ($(OS),Windows_NT) +include windows.mk +endif diff --git a/emacs/.emacs.d/windows.mk b/emacs/.emacs.d/windows.mk old mode 100755 new mode 100644 index 53d6f57..20e73c5 --- a/emacs/.emacs.d/windows.mk +++ b/emacs/.emacs.d/windows.mk @@ -1,2 +1,19 @@ EMACS := C:/msys64/mingw64/bin/emacs.exe 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