From f6598f546995b025349702b0572d0308e45e78a4 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 15 Feb 2013 00:11:23 +0100 Subject: [PATCH] Make install, uninstall, check work from subdirs By going up to the above level if needed and having the top-level define a special variable this works. --- Makefile | 2 ++ dotfiles.mk | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e032b22..2c76217 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,8 @@ objects=.bash_profile .beetsconfig .conky_box.lua .conkyrc .gitconfig \ .slrnrc .stumpwmrc .tmux.conf .urlview .xbindkeysrc.scm .Xdefaults \ .xinitrc .Xmodmap .xsession .zprofile .zshrc +export MAKEROOT=y + include dotfiles.mk install-.xinitrc: MODE=744 diff --git a/dotfiles.mk b/dotfiles.mk index 77afcee..6018dd2 100644 --- a/dotfiles.mk +++ b/dotfiles.mk @@ -28,9 +28,19 @@ check-modules=$(addprefix check-,$(modules)) $(install-objects) $(uninstall-objects) $(check-objects) \ $(install-modules) $(uninstall-modules) $(check-modules) all: $(modules) $(objects) -install: $(install-modules) $(install-objects) + +ifeq ($(MAKEROOT),y) check: $(check-modules) $(check-objects) +install: $(install-modules) $(install-objects) uninstall: $(uninstall-modules) $(uninstall-objects) +else +check: + $(MAKE) -s -C ../ check +install: + $(MAKE) -C ../ install +uninstall: + $(MAKE) -C ../ uninstall +endif $(modules): %: @echo $(MAKEFILES) @@ -56,7 +66,7 @@ $(check-objects): check-%: echo -e "$(FG_YEL)$* $(FG_RED)older$(CLR_RE).")) $(check-modules): check-%: - @$(MAKE) -C $* check + @$(MAKE) -s -C $* check $(filter %.elc,$(objects)): %.elc: %.el $(call compile,$^)