// $Id: pin_base.mpb 2168 2013-11-18 16:13:04Z hillj $

project {
  requires += pin

  includes += $(PIN_ROOT)/source/include \
              $(PIN_ROOT)/source/include/pin \
              $(PIN_ROOT)/source/include/pin/gen \
              $(PIN_ROOT)/extras/components/include

  macros += BIGARRAY_MULTIPLIER=1 USING_XED

  specific (prop:windows) {
    macros += TARGET_WINDOWS _SECURE_SCL=0

    compile_flags += /Oy
    runtime_library = 0
    DisableSpecificWarning += 4530
    IgnoreAllDefaultLibraries = true
  } else {
    compile_flags += -O3 -fomit-frame-pointer -fno-strict-aliasing -Wunused-parameter -Wno-unknown-pragmas -fno-stack-protector -fPIC
    libs += xed
  }

  verbatim (make, macros) {
    ifeq ($(shell uname -s), Darwin)
      CPPFLAGS += -DTARGET_MAC
    else
      CPPFLAGS += -DTARGET_LINUX
    endif
  }

  verbatim (gnuace, macros) {
    ifeq ($(shell uname -s), Darwin)
      CPPFLAGS += -DTARGET_MAC
    else
      CPPFLAGS += -DTARGET_LINUX -Wl,--hash-style=sysv
    endif
  }
}

feature(ia32) {
  includes += $(PIN_ROOT)/extras/xed2-ia32/include

  libpaths += $(PIN_ROOT)/ia32/lib \
              $(PIN_ROOT)/ia32/lib-ext \
              $(PIN_ROOT)/extras/xed2-ia32/lib

  macros += TARGET_IA32 HOST_IA32
  avoids += intel64

  specific (prop:windows) {
    // DO NOT CHANGE ORDER
    pure_libs += "ntdll-32.lib libxed.lib pin.lib pinvm.lib libcmt.lib libcpmt.lib"

    libpaths += $(PIN_ROOT)/ia32/lib \
                $(PIN_ROOT)/ia32/lib-ext
  }
}

feature(intel64) {
  includes += $(PIN_ROOT)/extras/xed2-intel64/include

  libpaths += $(PIN_ROOT)/intel64/lib \
              $(PIN_ROOT)/intel64/lib-ext \
              $(PIN_ROOT)/extras/xed2-intel64/lib

  macros += TARGET_IA32E HOST_IA32E
  avoids += ia32

  specific (prop:windows) {
    // DO NOT CHANGE ORDER
    pure_libs += "ntdll-64.lib libxed.lib pin.lib pinvm.lib libcmt.lib libcpmt.lib"
  }
}
