diff --git a/mk/hdr.mk b/mk/hdr.mk index 4bfe7889..8f5bd205 100644 --- a/mk/hdr.mk +++ b/mk/hdr.mk @@ -22,11 +22,6 @@ FILTER = cat EXCFLAGS = $(INCLUDES) -D_XOPEN_SOURCE=600 -# Try to avoid bash if possible. It slows the build considerably. -SHELL := $(shell which /bin/dash 2>/dev/null || echo /bin/sh) -SHELL != which /bin/dash 2>/dev/null || echo /bin/sh -.SHELL: name=sh path=$(SHELL) - COMPILE_FLAGS = $(EXCFLAGS) $(CFLAGS) COMPILE = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(PACKAGES)" "$(COMPILE_FLAGS)" COMPILEPIC = $(SHELL) $(ROOT)/util/compile "$(CC)" "$(PACKAGES)" "$(COMPILE_FLAGS) $(SOCFLAGS)" @@ -43,28 +38,24 @@ CTAGS=ctags PACKAGES = -# and this: # Try to find a sane shell. /bin/sh is a last resort, because it's # usually bash on Linux, which means it's painfully slow. -BINSH := $(shell \ - if [ -x /bin/dash ]; then echo /bin/dash; \ - elif [ -x /bin/ksh ]; then echo /bin/ksh; \ - else echo /bin/sh; fi) -BINSH != echo /bin/sh +SHELLSEARCH = for sh in /bin/dash /bin/ksh /bin/sh; do \ + if test -x $$sh; then echo $$sh; exit; fi; done + +BINSH:= $(shell $(SHELLSEARCH)) +BINSH!= $(SHELLSEARCH) +SHELL := $(BINSH) +.SHELL: name=sh path=$(SHELL) include $(ROOT)/config.mk - -# I hate this. -MKCFGSH=if test -f $(ROOT)/config.local.mk; then echo $(ROOT)/config.local.mk; else echo /dev/null; fi -MKCFG:=$(shell $(MKCFGSH)) -MKCFG!=$(MKCFGSH) -include $(MKCFG) +sinclude $(ROOT)/config.local.mk +sinclude $(shell echo .)depend .SILENT: .SUFFIXES: .$(SOEXT) .1 .3 .awk .build .c .clean .depend .install .man1 .man3 .o .o_pic .out .pdf .py .rc .sh .uninstall all: -MAKEFILES=.depend .c.depend: echo MKDEP $< $(DEBUG) eval "$(MKDEP) $(COMPILE_FLAGS)" $< | sed '1s|.*:|$(<:%.c=%.o):|' >>.depend diff --git a/mk/man.mk b/mk/man.mk index 40f28c85..5baceece 100644 --- a/mk/man.mk +++ b/mk/man.mk @@ -1,7 +1,7 @@ targ = for k in $(MANPAGES); do echo $$k | sed 's/ .*//'; done -TARG := $(shell $(targ)) -TARG != $(targ) +TARG:= $(shell $(targ)) +TARG!= $(targ) all: $(TARG) install: $(TARG:.1=.install) $(TARG:.3=.install) maninstall diff --git a/mk/wmii.mk b/mk/wmii.mk index 5d8e6be5..4bd8b177 100644 --- a/mk/wmii.mk +++ b/mk/wmii.mk @@ -4,8 +4,9 @@ VERS = $$(test -n "$$WMII_HGVERSION" && echo $$WMII_HGVERSION || \ echo -n "hg$$(hg id -n 2>/dev/null)") WMII_HGVERSION = $(VERS) -WMII_HGVERSION := $(shell echo $(VERS)) -WMII_HGVERSION != echo $(VERS) +WMII_HGVERSION:= $(shell echo $(VERS)) +WMII_HGVERSION!= echo $(VERS) + VERSION = $(WMII_HGVERSION) COPYRIGHT = ©2010 Kris Maglione