Running the makefile below should generate identical values of TEST_COREx
TEST_COREy and TEST_COREz but doesn't when running "make test" on Ubuntu
16.04 with make 4.1
TEST_COREz is always correct.
Oddly, this used to work about 6 months ago.

#############################################################################

TEST_CORE ?= 68         # 0 to $(NUM_CORES)-1
NUM_CORES := $(shell nproc --all)
#TEST_COREx := $(if $(shell expr '$(TEST_CORE)' '<'
'$(NUM_CORES)'),$(TEST_CORE),$(shell expr $(NUM_CORES) - 1)) 
#TEST_COREy := $(if $(shell expr '$(TEST_CORE)' '>=' '$(NUM_CORES)'),$(shell
expr $(NUM_CORES) - 1),$(TEST_CORE)) 
TEST_COREx := $(if ifeq ($(shell expr $(TEST_CORE) \< $(NUM_CORES)), 1),
$(TEST_CORE), $(shell expr $(NUM_CORES) - 1))
TEST_COREy := $(if ifeq ($(shell expr $(TEST_CORE) \>= $(NUM_CORES)), 1),
$(shell expr $(NUM_CORES) - 1), $(TEST_CORE))

ifeq ($(shell expr $(TEST_CORE) \< $(NUM_CORES)), 1)
TEST_COREz := $(TEST_CORE)
else
TEST_COREz := $(shell expr $(NUM_CORES) - 1)
endif

#############################################################################

test:
        @echo TEST_CORE $(TEST_CORE)  NUM_CORES $(NUM_CORES)  TEST_COREx
$(TEST_COREx)  TEST_COREy $(TEST_COREy)  TEST_COREz $(TEST_COREz)

#############################################################################




--
Sent from: http://gnu-make.2324884.n4.nabble.com/Gnu-Make-Bugs-f3.html

_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to