title: (g)make subroutine or procedure?
body: <p>I have a (g)make script that covers a lot of microcontroller targets. A sequence of if blocks test for the various targets and set (or append) a lot of variables.</p>
  
  <pre><code>ifeq ($(CHIP),lpc1114fn28)
     CORE_FLAGS  := -mcpu=cortex-m0 -mthumb 
     CORE_FLAGS  += -nostartfiles -fno-exceptions 
     CORE_CPP_FLAGS  += -fno-threadsafe-statics -fno-use-cxa-get-exception-ptr
     XTAL        := 12000000
     . . . 
  endif
  </code></pre>
  
  <p>There is a lot of duplication, which I'd like to factor out. I tried </p>
  
  <pre><code>define Cortex-M0 =
    CORE_FLAGS  := -mcpu=cortex-m0 -mthumb 
    CORE_FLAGS  += -nostartfiles -fno-exceptions 
  endef
  
  ifeq ($(CHIP),lpc1114fn28)
     $(eval $(Cortex-M0))
     CORE_CPP_FLAGS  += -fno-threadsafe-statics -fno-use-cxa-get-exception-ptr
     XTAL        := 12000000
     . . . 
  endif
  </code></pre>
  
  <p>But this does not seem to work. Is there a way to execute a subroutine-like construct that can contain multiple lines? I know I could use include files but I'd like to keep everything in one file.</p>