Random Tech Thoughts

The title above is not random

Make

Detecting OS in makefile

From [OS detecting makefile][http://stackoverflow.com/a/714135/306935]

UNAME := $(shell uname)

ifeq ($(UNAME), Linux)
# do something Linux-y
endif
ifeq ($(UNAME), Darwin)
# do something Solaris-y
endif
ifeq ($(UNAME), Solaris)
# do something Solaris-y
endif

Variable assignment

From Stack Overflow

  • Normal setting of a variable – values within it are recursively expanded when the variable is used, not when it’s declared

    VARIABLE = value
    
  • Setting of a variable with simple expansion of the values inside – values within it are expanded at declaration time.

    VARIABLE := value
    
  • Setting of a variable only if it doesn’t have a value

    VARIABLE ?= value
    
  • Appending the supplied value to the existing value

    VARIABLE += value