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.
This commit is contained in:
Tom Willemsen 2013-02-15 00:11:23 +01:00
parent a1808fd44e
commit f6598f5469
2 changed files with 14 additions and 2 deletions

View file

@ -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

View file

@ -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,$^)