bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

$(if C,A,B) seems to always select B


From: warnerme
Subject: $(if C,A,B) seems to always select B
Date: Mon, 26 Mar 2018 19:38:37 -0700 (MST)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]