endif
ObjRootDir := $(PROJ_OBJ_DIR)/$(BuildMode)
-ObjDir := $(ObjRootDir)/$(TargetMode)
+# It is very important that ObjDir not have an extra trailing
+# slash. This ends up changing the rules so that dependency file (.d)
+# information is not used at all!
+ifeq ($(TargetMode),)
+ ObjDir := $(ObjRootDir)
+else
+ ObjDir := $(ObjRootDir)/$(TargetMode)
+endif
LibDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/lib
ToolDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/bin
ExmplDir := $(PROJ_OBJ_ROOT)/$(BuildMode)/$(TargetMode)/examples
endif
LD.Flags += -L$(LibDir) -L$(LLVMLibDir)
-CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS
+CPP.BaseFlags += -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
# All -I flags should go here, so that they don't confuse llvm-config.
CPP.Flags += $(sort -I$(PROJ_OBJ_DIR) -I$(PROJ_SRC_DIR) \
$(patsubst %,-I%/include,\