2012-12-04 22:05:24 +01:00
|
|
|
LOAD_PATH=. /usr/share/emacs/site-lisp $(HOME)/.emacs.d/site-lisp
|
|
|
|
EMACS=emacs $(addprefix -L ,$(LOAD_PATH))
|
2012-12-05 09:21:35 +01:00
|
|
|
MODE=644
|
2012-12-04 22:05:24 +01:00
|
|
|
|
2012-12-14 00:25:34 +01:00
|
|
|
FG_BLU=\033[0;34m
|
2012-12-04 22:05:24 +01:00
|
|
|
FG_YEL=\033[0;33m
|
|
|
|
FG_GRE=\033[0;32m
|
|
|
|
FG_RED=\033[0;31m
|
|
|
|
CLR_RE=\033[0;00m
|
|
|
|
|
|
|
|
compile = $(EMACS) -Q -batch -eval "(byte-compile-file \"$(1)\")"
|
|
|
|
define newer =
|
|
|
|
$(shell if [ "$(1)" -nt "$(DESTDIR)/$(1)" ]; then echo "newer"; fi)
|
|
|
|
endef
|
2012-12-14 00:25:34 +01:00
|
|
|
define older =
|
|
|
|
$(shell if [ "$(1)" -ot "$(DESTDIR)/$(1)" ]; then echo "older"; fi)
|
|
|
|
endef
|
2012-12-04 22:05:24 +01:00
|
|
|
|
|
|
|
install-objects=$(addprefix install-,$(objects))
|
|
|
|
uninstall-objects=$(addprefix uninstall-,$(objects))
|
|
|
|
check-objects=$(addprefix check-,$(objects))
|
|
|
|
|
|
|
|
install-modules=$(addprefix install-,$(modules))
|
|
|
|
uninstall-modules=$(addprefix uninstall-,$(modules))
|
|
|
|
check-modules=$(addprefix check-,$(modules))
|
|
|
|
|
2012-12-05 00:13:28 +01:00
|
|
|
.PHONY: all install uninstall check uninstall $(modules) \
|
|
|
|
$(install-objects) $(uninstall-objects) $(check-objects) \
|
|
|
|
$(install-modules) $(uninstall-modules) $(check-modules)
|
2012-12-04 22:05:24 +01:00
|
|
|
all: $(modules) $(objects)
|
|
|
|
install: $(install-modules) $(install-objects)
|
|
|
|
check: $(check-modules) $(check-objects)
|
|
|
|
uninstall: $(uninstall-modules) $(uninstall-objects)
|
|
|
|
|
|
|
|
$(modules): %:
|
2012-12-05 00:13:28 +01:00
|
|
|
@echo $(MAKEFILES)
|
2012-12-04 22:05:24 +01:00
|
|
|
@$(MAKE) -C $*
|
|
|
|
|
|
|
|
$(install-objects): install-%: %
|
2012-12-06 13:05:31 +01:00
|
|
|
$(if $(call newer,$*), \
|
|
|
|
install -pDm $(MODE) "$*" "$(DESTDIR)/$*", \
|
|
|
|
@echo -e "$(FG_YEL)$*$(CLR_RE) is $(FG_RED)not newer$(CLR_RE)")
|
2012-12-04 22:05:24 +01:00
|
|
|
|
|
|
|
$(install-modules): install-%:
|
|
|
|
@$(MAKE) -C $* install
|
|
|
|
|
|
|
|
$(uninstall-objects): uninstall-%:
|
|
|
|
$(if $(call newer,$*),rm -f "$(DESTDIR)/$*")
|
|
|
|
|
|
|
|
$(uninstall-modules): uninstall-%:
|
|
|
|
@$(MAKE) -C $* uninstall
|
|
|
|
|
|
|
|
$(check-objects): check-%:
|
|
|
|
@$(if $(call newer,$*), \
|
|
|
|
echo -e "$(FG_YEL)$* $(FG_GRE)newer$(CLR_RE)!", \
|
2012-12-14 00:25:34 +01:00
|
|
|
$(if $(call older,$*), \
|
|
|
|
echo -e "$(FG_YEL)$* $(FG_RED)older$(CLR_RE)."))
|
2012-12-04 22:05:24 +01:00
|
|
|
|
|
|
|
$(check-modules): check-%:
|
|
|
|
@$(MAKE) -C $* check
|
2012-12-05 00:13:28 +01:00
|
|
|
|
|
|
|
$(filter %.elc,$(objects)): %.elc: %.el
|
|
|
|
$(call compile,$^)
|