Skip to content

Commit

Permalink
install: fix use of ifeq/wildcard in Makefile
Browse files Browse the repository at this point in the history
Prefer 'rmdir --ignore-fail-on-non-empty' which is evaluated at runtime.
ifeq is evaluated at Makefile read.
  • Loading branch information
xdelaruelle committed Nov 1, 2017
1 parent b7e474c commit 29fb374
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions init/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,8 @@ install-testconfig:
uninstall-testconfig:
rmdir $(DESTDIR)$(prefix)/test/modulefiles $(DESTDIR)$(prefix)/test/etc $(DESTDIR)$(prefix)/test
rm -f $(addprefix $(DESTDIR)$(modulefilesdir)/,$(EXAMPLE_TESTCONFIG_MODFILES))
ifeq ($(wildcard $(DESTDIR)$(modulefilesdir)/*),)
rmdir $(DESTDIR)$(modulefilesdir)
endif
ifeq ($(wildcard $(DESTDIR)$(initdir)/*),)
rmdir $(DESTDIR)$(initdir)
endif
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(modulefilesdir)
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(initdir)

install: all
mkdir -p $(DESTDIR)$(initdir)
Expand Down Expand Up @@ -147,22 +143,12 @@ ifeq ($(compatversion),y)
endif
rm -f $(DESTDIR)$(initdir)/zsh-functions/_module
rm -f $(addprefix $(DESTDIR)$(initdir)/,$(ALL_CONFIG))
ifeq ($(wildcard $(DESTDIR)$(modulefilesdir)/*),)
rmdir $(DESTDIR)$(modulefilesdir)
else
@echo
@echo "WARNING: $(DESTDIR)$(modulefilesdir) is not empty so skip removal" >&2
@echo
endif
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(modulefilesdir)
@if [ -d $(DESTDIR)$(modulefilesdir) ]; then echo -e "\nWARNING: $(DESTDIR)$(modulefilesdir) is not empty so skip removal\n" >&2; fi
rmdir $(DESTDIR)$(initdir)/ksh-functions
rmdir $(DESTDIR)$(initdir)/zsh-functions
ifeq ($(wildcard $(DESTDIR)$(initdir)/*),)
rmdir $(DESTDIR)$(initdir)
else
@echo
@echo "WARNING: $(DESTDIR)$(initdir) is not empty so skip removal" >&2
@echo
endif
rmdir --ignore-fail-on-non-empty $(DESTDIR)$(initdir)
@if [ -d $(DESTDIR)$(initdir) ]; then echo -e "\nWARNING: $(DESTDIR)$(initdir) is not empty so skip removal\n" >&2; fi

clean:
rm -f $(ALL_SHELLS) modulerc .modulespath $(EXAMPLE_MODFILES_SRCDIR)/modules

0 comments on commit 29fb374

Please sign in to comment.