]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - packages/ti/sdo/ipc/makefile_gccArmLto.xdt
SDOCM00114108 IPC custom build failure with XDCtools core product
[ipc/ipcdev.git] / packages / ti / sdo / ipc / makefile_gccArmLto.xdt
index 1390dec0d7dcd85f9e1821f8e17aeea49988f6b5..a482c8cb77aec6d74b1279154c250cffb626556a 100644 (file)
@@ -1,6 +1,6 @@
 %%{
 /*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 %%}
 %%{
     var File = xdc.module("xdc.services.io.File");
-
     var BIOS = xdc.module("ti.sysbios.BIOS");
-
     var Build = xdc.module("ti.sdo.ipc.Build");
-
     var TARGET = $args[0];
-
     var XDCROOT = String(environment['xdc.rootDir'] + '/packages/').replace(/\\/g, "/");
 
-    var XOPTS = '-I "' + XDCROOT + '"'
-       + " -Dxdc_target_types__=" + File.getDOSPath(TARGET.$package.packageRepository) + TARGET.stdInclude
+    var XOPTS = '-I "' + XDCROOT + '"' + " -Dxdc_target_types__="
+        + File.getDOSPath(TARGET.$package.packageRepository) + TARGET.stdInclude
        + " -Dxdc_target_name__=" + TARGET.name;
 
     var CGEN = TARGET.rootDir.replace(/\\/g, "/");
 vpath % `File.getDOSPath(this.$package.packageRepository) + "ti/sdo/"`
 vpath %.c `XDCROOT`
 
-CCOPTS    = `BIOS.getCCOpts(TARGET.$name)`
-
-XDC_ROOT  = `XDCROOT`
+CCOPTS = `Build.getCCOpts(TARGET.$name)`
 
 BUILD_DEFS = `Build.getDefs()`
 
-BIOS_INC  = -I"`xdc.getPackageRepository("ti.sysbios")`"
-
-IPC_INC    = -I"`xdc.getPackageRepository("ti.sdo.ipc")`"
-
-UTILS_INC    = -I"`xdc.getPackageRepository("ti.sdo.utils")`"
-
+%%{
+    /* convert package path into include path */
+    var incs = new Array();
+    incs.push("-I" + this.$package.packageRepository.replace(/\/$/, ""));
+
+    for each (var repo in xdc.curPath().split(';')) {
+        /* skip empty repo, relative paths, and xdctools itself */
+        if ((repo == "") || repo.match(/^\./) || repo.match(/xdctools/)) {
+            continue;
+        }
+
+        /* add repo if not already present in array */
+        var i;
+        for (i = 0; i < incs.length; i++) {
+            if (incs[i] == "-I" + repo) {
+                break;
+            }
+        }
+        if (i == incs.length) {
+            incs.push("-I" + repo);
+        }
+    }
+%%}
+INCS = `incs.join(" ")`
 
 CC = `CGEN`/`TARGET.ccBin.cmd` $(CCOPTS) -I `CGEN`/arm-none-eabi/include
 ASM = `CGEN`/`TARGET.asmBin.cmd` $(CCOPTS) -I `CGEN`/arm-none-eabi/include
@@ -96,17 +108,22 @@ endef
 
 define ASSEMBLE
        @echo asm`TARGET.suffix` $< ...
-       @$(ASM) $(BUILD_DEFS) `XOPTS` $(BIOS_INC) $<
+       @$(ASM) $(BUILD_DEFS) `XOPTS` $(INCS) $<
 endef
 
 define COMPILE
        @echo cl`TARGET.suffix` $< ...
-       @$(CC) $(BUILD_DEFS) `XOPTS` $(BIOS_INC) $(IPC_INC) $(UTILS_INC) $<
+       @$(CC) $(BUILD_DEFS) `XOPTS` $(INCS) $<
 endef
 
 %var LIB = "ipc.a" + TARGET.suffix;
 
+%if (BIOS.buildingAppLib == false) {
+all: `Build.$private.libDir``LIB`
+%}
+%else {
 all: `LIB`
+%}
 
 %var sources = Build.getAsmFiles(TARGET.$name);
 %for each (var s in sources) {
@@ -131,9 +148,12 @@ all: `LIB`
        @echo ar`TARGET.suffix` $^ ...
        @-$(call RM, $@)
        @$(AR) $@ $^
+
 %if (BIOS.buildingAppLib == false) {
+`Build.$private.libDir``LIB`: `LIB`
+       @echo cp `LIB`
        @-$(call RM, "`Build.$private.libDir``LIB`")
-       $(CP) `LIB` "`Build.$private.libDir``LIB`"
+       @$(CP) `LIB` "`Build.$private.libDir``LIB`"
 %}
 
 clean: