tests/var-set.mk
author Benjamin Smedberg <benjamin@smedbergs.us>
Thu, 26 Feb 2009 20:32:19 -0500
branchresolve-perf
changeset 191 7a8dc41115d6
parent 101 ce89bcf91bf6
permissions -rw-r--r--
I noticed Expansion.resolve still comes up really high on perf charts. This patch makes it much easier to resolve expansions which are just literals, which is very common for variable names. Unfortunately, this makes the code a fair bit more complex, and doesn't help nearly as much as I'd like. I'm beginning to wonder if getting gmake performance parity is impossible, or at least improbable given the current architecture: but I can't think of an alternate architecture that is better.

#T commandline: ['OBASIC=oval']

BASIC = val

TEST = $(TEST)

TEST2 = $(TES
TEST2 += T)

TES T = val

RECVAR = foo
RECVAR += var baz 

IMMVAR := bloo
IMMVAR += $(RECVAR)

BASIC ?= notval

all: BASIC = valall
all: RECVAR += $(BASIC)
all: IMMVAR += $(BASIC)
all: UNSET += more
all: OBASIC += allmore

CHECKLIT = $(NULL) check
all: CHECKLIT += appendliteral

RECVAR = blimey

TESTEMPTY = \
	$(NULL)

all: other
	test "$(TEST2)" = "val"
	test '$(value TEST2)' = '$$(TES T)'
	test "$(RECVAR)" = "blimey valall"
	test "$(IMMVAR)" = "bloo foo var baz  valall"
	test "$(UNSET)" = "more"
	test "$(OBASIC)" = "oval"
	test "$(CHECKLIT)" = " check appendliteral"
	test "$(TESTEMPTY)" = ""
	@echo TEST-PASS

OVAR = oval
OVAR ?= onotval

other: OVAR ?= ooval
other: LATERVAR ?= lateroverride

LATERVAR = olater

other:
	test "$(OVAR)" = "oval"
	test "$(LATERVAR)" = "lateroverride"