Tom Willemsen
55e386bf0c
This target takes files whose installed versions are newer than those in the current working directory and copies them there.
93 lines
2.7 KiB
Makefile
93 lines
2.7 KiB
Makefile
LOAD_PATH=. /usr/share/emacs/site-lisp $(HOME)/.emacs.d/site-lisp
|
|
EMACS=emacs $(addprefix -L ,$(LOAD_PATH))
|
|
MODE=644
|
|
|
|
FG_BLU=\033[0;34m
|
|
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
|
|
define older =
|
|
$(shell if [ "$(1)" -ot "$(DESTDIR)/$(1)" ]; then echo "older"; fi)
|
|
endef
|
|
|
|
check-objects=$(addprefix check-,$(objects))
|
|
install-objects=$(addprefix install-,$(objects))
|
|
reverse-objects=$(addprefix reverse-,$(objects))
|
|
uninstall-objects=$(addprefix uninstall-,$(objects))
|
|
|
|
check-modules=$(addprefix check-,$(modules))
|
|
install-modules=$(addprefix install-,$(modules))
|
|
reverse-modules=$(addprefix reverse-,$(modules))
|
|
uninstall-modules=$(addprefix uninstall-,$(modules))
|
|
|
|
.PHONY: all install uninstall check uninstall $(modules) \
|
|
$(install-objects) $(uninstall-objects) $(check-objects) \
|
|
$(install-modules) $(uninstall-modules) $(check-modules) \
|
|
$(reverse) $(reverse-objects) $(reverse-modules)
|
|
all: $(modules) $(objects)
|
|
|
|
ifeq ($(MAKEROOT),y)
|
|
check: $(check-modules) $(check-objects)
|
|
install: $(install-modules) $(install-objects)
|
|
reverse: $(reverse-modules) $(reverse-objects)
|
|
uninstall: $(uninstall-modules) $(uninstall-objects)
|
|
else
|
|
check:
|
|
@$(MAKE) -s -C ../ check
|
|
install:
|
|
@$(MAKE) -s -C ../ install
|
|
reverse:
|
|
@$(MAKE) -s -C ../ reverse
|
|
uninstall:
|
|
@$(MAKE) -C ../ uninstall
|
|
endif
|
|
|
|
$(modules): %:
|
|
@echo $(MAKEFILES)
|
|
@$(MAKE) -C $*
|
|
|
|
$(install-objects): install-%: %
|
|
@$(if $(call newer,$*), \
|
|
echo -e "$(FG_GRE)installing $(FG_YEL)$* $(CLR_RE)to $(DESTDIR) as $(MODE)"; \
|
|
install -pDm $(MODE) "$*" "$(DESTDIR)/$*", \
|
|
echo -e "$(FG_RED)not installing $(FG_YEL)$*$(CLR_RE)")
|
|
|
|
$(install-modules): install-%:
|
|
@$(MAKE) -s -C $* install
|
|
|
|
$(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-%:
|
|
@$(MAKE) -s -C $* reverse
|
|
|
|
$(uninstall-objects): uninstall-%:
|
|
@$(if $(call older,$*), \
|
|
echo -e "$(FG_RED)not uninstalling $(FG_YEL)$*$(CLR_RE)", \
|
|
echo -e "$(FG_GRE)uninstalling $(FG_YEL)$*$(CLR_RE)"; \
|
|
rm -f "$(DESTDIR)/$*")
|
|
|
|
$(uninstall-modules): uninstall-%:
|
|
@$(MAKE) -C $* uninstall
|
|
|
|
$(check-objects): check-%:
|
|
@$(if $(call newer,$*), \
|
|
echo -e "$(FG_YEL)$* $(FG_GRE)newer$(CLR_RE) than $(DESTDIR)$*!", \
|
|
$(if $(call older,$*), \
|
|
echo -e "$(FG_YEL)$* $(FG_RED)older$(CLR_RE) than $(DESTDIR)$*.", \
|
|
echo -e "$(FG_YEL)$* $(FG_BLU)up to date$(CLR_RE) with $(DESTDIR)$*."))
|
|
|
|
$(check-modules): check-%:
|
|
@$(MAKE) -s -C $* check
|
|
|
|
$(filter %.elc,$(objects)): %.elc: %.el
|
|
$(call compile,$^)
|