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
|
|
|
|
2013-02-15 00:47:01 +01:00
|
|
|
check-objects=$(addprefix check-,$(objects))
|
2012-12-04 22:05:24 +01:00
|
|
|
install-objects=$(addprefix install-,$(objects))
|
2013-02-15 00:47:01 +01:00
|
|
|
reverse-objects=$(addprefix reverse-,$(objects))
|
2012-12-04 22:05:24 +01:00
|
|
|
uninstall-objects=$(addprefix uninstall-,$(objects))
|
|
|
|
|
2013-02-15 00:47:01 +01:00
|
|
|
check-modules=$(addprefix check-,$(modules))
|
2012-12-04 22:05:24 +01:00
|
|
|
install-modules=$(addprefix install-,$(modules))
|
2013-02-15 00:47:01 +01:00
|
|
|
reverse-modules=$(addprefix reverse-,$(modules))
|
2012-12-04 22:05:24 +01:00
|
|
|
uninstall-modules=$(addprefix uninstall-,$(modules))
|
|
|
|
|
2012-12-05 00:13:28 +01:00
|
|
|
.PHONY: all install uninstall check uninstall $(modules) \
|
|
|
|
$(install-objects) $(uninstall-objects) $(check-objects) \
|
2013-02-15 00:47:01 +01:00
|
|
|
$(install-modules) $(uninstall-modules) $(check-modules) \
|
|
|
|
$(reverse) $(reverse-objects) $(reverse-modules)
|
2012-12-04 22:05:24 +01:00
|
|
|
all: $(modules) $(objects)
|
2013-02-15 00:11:23 +01:00
|
|
|
|
|
|
|
ifeq ($(MAKEROOT),y)
|
2012-12-04 22:05:24 +01:00
|
|
|
check: $(check-modules) $(check-objects)
|
2013-02-15 00:11:23 +01:00
|
|
|
install: $(install-modules) $(install-objects)
|
2013-02-15 00:47:01 +01:00
|
|
|
reverse: $(reverse-modules) $(reverse-objects)
|
2012-12-04 22:05:24 +01:00
|
|
|
uninstall: $(uninstall-modules) $(uninstall-objects)
|
2013-02-15 00:11:23 +01:00
|
|
|
else
|
|
|
|
check:
|
2013-02-15 00:31:34 +01:00
|
|
|
@$(MAKE) -s -C ../ check
|
2013-02-15 00:11:23 +01:00
|
|
|
install:
|
2013-02-15 00:31:34 +01:00
|
|
|
@$(MAKE) -s -C ../ install
|
2013-02-15 00:47:01 +01:00
|
|
|
reverse:
|
|
|
|
@$(MAKE) -s -C ../ reverse
|
2013-02-15 00:11:23 +01:00
|
|
|
uninstall:
|
2013-02-15 01:05:06 +01:00
|
|
|
@$(MAKE) -s -C ../ uninstall
|
2013-02-15 00:11:23 +01:00
|
|
|
endif
|
2012-12-04 22:05:24 +01:00
|
|
|
|
|
|
|
$(modules): %:
|
2013-02-15 01:05:06 +01:00
|
|
|
$(MAKE) -C $*
|
2012-12-04 22:05:24 +01:00
|
|
|
|
|
|
|
$(install-objects): install-%: %
|
2013-02-15 00:31:34 +01:00
|
|
|
@$(if $(call newer,$*), \
|
2013-02-15 01:05:06 +01:00
|
|
|
echo -e "$(FG_GRE)installing $(FG_YEL)$(MKDPREFIX)$* $(CLR_RE)to $(DESTDIR) as $(MODE)"; \
|
2013-02-15 00:31:34 +01:00
|
|
|
install -pDm $(MODE) "$*" "$(DESTDIR)/$*", \
|
2013-02-15 01:05:06 +01:00
|
|
|
echo -e "$(FG_RED)not installing $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)")
|
2012-12-04 22:05:24 +01:00
|
|
|
|
|
|
|
$(install-modules): install-%:
|
2013-02-15 01:05:06 +01:00
|
|
|
@$(MAKE) -s -C $* install MKDPREFIX=$(MKDPREFIX)$*/
|
2012-12-04 22:05:24 +01:00
|
|
|
|
2013-02-15 00:47:01 +01:00
|
|
|
$(reverse-objects): reverse-%:
|
|
|
|
@$(if $(call older,$*), \
|
|
|
|
echo -e "$(FG_GRE)reversing $(FG_YEL)$(DESTDIR)/$* $(CLR_RE)"; \
|
|
|
|
cp -a "$(DESTDIR)/$*" "$*", \
|
|
|
|
echo -e "$(FG_RED)not reversing $(FG_YEL)$*$(CLR_RE)")
|
|
|
|
|
|
|
|
$(reverse-modules): reverse-%:
|
2013-02-15 01:05:06 +01:00
|
|
|
@$(MAKE) -s -C $* reverse MKDPREFIX=$(MKDPREFIX)$*/
|
2013-02-15 00:47:01 +01:00
|
|
|
|
2012-12-04 22:05:24 +01:00
|
|
|
$(uninstall-objects): uninstall-%:
|
2013-02-15 00:31:34 +01:00
|
|
|
@$(if $(call older,$*), \
|
2013-02-15 01:05:06 +01:00
|
|
|
echo -e "$(FG_RED)not uninstalling $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)", \
|
|
|
|
echo -e "$(FG_GRE)uninstalling $(FG_YEL)$(MKDPREFIX)$*$(CLR_RE)"; \
|
2013-02-15 00:31:34 +01:00
|
|
|
rm -f "$(DESTDIR)/$*")
|
2012-12-04 22:05:24 +01:00
|
|
|
|
|
|
|
$(uninstall-modules): uninstall-%:
|
2013-02-15 01:05:06 +01:00
|
|
|
@$(MAKE) -C $* uninstall MKDPREFIX=$(MKDPREFIX)$*/
|
2012-12-04 22:05:24 +01:00
|
|
|
|
|
|
|
$(check-objects): check-%:
|
|
|
|
@$(if $(call newer,$*), \
|
2013-02-15 01:05:06 +01:00
|
|
|
echo -e "$(FG_YEL)$(MKDPREFIX)$* $(FG_GRE)newer$(CLR_RE) than $(DESTDIR)$*!", \
|
2012-12-14 00:25:34 +01:00
|
|
|
$(if $(call older,$*), \
|
2013-02-15 01:05:06 +01:00
|
|
|
echo -e "$(FG_YEL)$(MKDPREFIX)$* $(FG_RED)older$(CLR_RE) than $(DESTDIR)$*.", \
|
|
|
|
echo -e "$(FG_YEL)$(MKDPREFIX)$* $(FG_BLU)up to date$(CLR_RE) with $(DESTDIR)$*."))
|
2012-12-04 22:05:24 +01:00
|
|
|
|
|
|
|
$(check-modules): check-%:
|
2013-02-15 01:05:06 +01:00
|
|
|
@$(MAKE) -s -C $* check MKDPREFIX=$(MKDPREFIX)$*/
|
2012-12-05 00:13:28 +01:00
|
|
|
|
|
|
|
$(filter %.elc,$(objects)): %.elc: %.el
|
|
|
|
$(call compile,$^)
|