]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - packages/ti/sdo/ipc/makefile.xdt
SDOCM00114110 IPC custom build failure with XDCtools core product
[ipc/ipcdev.git] / packages / ti / sdo / ipc / makefile.xdt
index 8b31571295c07bc469d6dc11c363739ad5bd14ae..4bfe67355256bf39f81b1edf61e9ec94ba9e0634 100644 (file)
@@ -1,6 +1,6 @@
 %%{
 /*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-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 BIOS = xdc.module("ti.sysbios.BIOS");
-
     var CGEN = TARGET.rootDir.replace(/\\/g, "/");
 
     function baseName(path) {
        return dirpath.substr(dirpath.lastIndexOf('/') + 1);
     }
     var OBJS = [];
+    var CFILES = Build.getCFiles(TARGET.$name);
 %%}
 vpath % `File.getDOSPath(this.$package.packageRepository) + "ti/sdo/"`
 vpath %.c `XDCROOT`
 
 XOPTS = `'-I"' + XDCROOT + '"' + " -Dxdc_target_types__=" + File.getDOSPath(TARGET.$package.packageRepository) + TARGET.stdInclude + " -Dxdc_target_name__=" + TARGET.name`
 
-CCOPTS ?= `BIOS.getCCOpts(TARGET.name)`
+CCOPTS = `Build.getCCOpts(TARGET.name)`
 
 XDC_ROOT  = `XDCROOT`
 
@@ -68,16 +65,21 @@ IPC_ROOT = `File.getDOSPath(this.$package.packageRepository) + "ti/sdo/"`
 BUILD_DEFS = `Build.getDefs()`
 
 BIOS_INC  = -I"`xdc.getPackageRepository("ti.sysbios")`"
-
+TARGET_INC  = -I"`xdc.getPackageRepository("ti.targets")`"
 IPC_INC    = -I"`xdc.getPackageRepository("ti.sdo.ipc")`"
-
 UTILS_INC    = -I"`xdc.getPackageRepository("ti.sdo.utils")`"
+INCS = $(BIOS_INC) $(TARGET_INC) $(IPC_INC) $(UTILS_INC)
 
-CC = `CGEN`/bin/`TARGET.cc.cmd` $(CCOPTS) -I `CGEN`/include
-
+%if (TARGET.$name.match(/gnu/)) {
+CC = `CGEN`/`TARGET.ccBin.cmd` $(CCOPTS) -I `CGEN`/arm-none-eabi/include
+ASM = `CGEN`/`TARGET.asmBin.cmd` $(CCOPTS) -I `CGEN`/arm-none-eabi/include
+AR = `CGEN`/`TARGET.arBin.cmd` `TARGET.ar.opts`
+%}
+%else {
+CC = `CGEN`/bin/`TARGET.cc.cmd` $(CCOPTS) --output_file=$@ -I `CGEN`/include
 ASM = `CGEN`/bin/`TARGET.asm.cmd` $(CCOPTS) -I `CGEN`/include
-
 AR = `CGEN`/bin/`TARGET.ar.cmd` `TARGET.ar.opts`
+%}
 
 %if (environment["os.name"].match(/Windows.*/i)) {
 %if (BIOS.buildingAppLib == false) {
@@ -85,10 +87,12 @@ AR = `CGEN`/bin/`TARGET.ar.cmd` `TARGET.ar.opts`
 %}
 DEL = cmd.exe /q /c del /f
 CP = cmd.exe /q /c copy /Y
+MKDIR = mkdir
 %}
 %else {
 DEL = rm -f
 CP = cp -f
+MKDIR = mkdir -p
 %}
 
 define RM
@@ -97,7 +101,7 @@ endef
 
 define ASSEMBLE
        @echo asm`TARGET.suffix` $< ...
-       @$(ASM) $(BUILD_DEFS) $(XOPTS) $(IPC_INC) $<
+       @$(ASM) $(BUILD_DEFS) $(XOPTS) $(INCS) $<
 endef
 
 %var LIB = "ipc.a" + TARGET.suffix;
@@ -110,32 +114,57 @@ all: `LIB`
 %}
 
 %var sources = Build.getAsmFiles(TARGET.$name);
-%for each (var s in sources) {
+%for (var i = 0; i <  sources.length; i++) {
+%    var s = sources[i];
+%if (TARGET.$name.match(/gnu/)) {
+%    var obj = packageName(s) + "_" + baseName(s) + ".o";
+%}
+%else {
 %    var obj = packageName(s) + "_" + baseName(s) + ".obj";
+%}
 %    OBJS.push(obj)
 `obj`: `s` makefile
        @-$(call RM, $@)
+%if (TARGET.$name.match(/gnu/)) {
+       $(ASSEMBLE) -o `obj`
+%}
+%else {
        $(ASSEMBLE) --output_file=`obj`
+%}
 
 %}
 
-Ipc.obj: `Build.getCFiles(TARGET.$name)` makefile
+%if (TARGET.$name.match(/gnu/)) {
+Ipc.o: `CFILES` makefile
+       @-$(call RM, Ipc.o)
+       @-$(call RM, Ipc.o.dep)
+%}
+%else {
+Ipc.obj: `CFILES` makefile
        @-$(call RM, $@)
+%}
        @echo cl`TARGET.suffix` $< ...
-       @$(CC) $(BUILD_DEFS) $(XOPTS) $(BIOS_INC) \
-       $(IPC_INC) $(UTILS_INC) \
-%var sources = Build.getCFiles(TARGET.$name).split(' ');
-%for each (var s in sources) {
+       @$(CC) $(BUILD_DEFS) $(XOPTS) $(INCS) \
+%var sources = CFILES.split(' ');
+%for (var i = 0; i < sources.length; i++) {
+%    var s = sources[i] + (i == (sources.length - 1) ? "" : " \\");
 %    if (s.substring(0,4) == "xdc/") {
-       $(XDC_ROOT)`s` \
+       $(XDC_ROOT)`s`
+%    } else if (s.substring(0,2) == "./") {
+       `s`
 %    } else {
-       $(IPC_ROOT)`s` \
+       $(IPC_ROOT)`s`
 %    }
 %}
 
+%if (TARGET.$name.match(/gnu/)) {
+`LIB`: Ipc.o `OBJS.join(" ")`
+%}
+%else {
 `LIB`: Ipc.obj `OBJS.join(" ")`
-       @echo ar`TARGET.suffix` $^ ...
+%}
        @-$(call RM, $@)
+       @echo ar`TARGET.suffix` $^ ...
        @$(AR) $@ $^
 
 %if (BIOS.buildingAppLib == false) {
@@ -150,7 +179,21 @@ clean:
 %if (BIOS.buildingAppLib == false) {
        @-$(call RM, "`Build.$private.libDir``LIB`")
 %}
+%if (TARGET.$name.match(/gnu/)) {
+       @-$(call RM, Ipc.o)
+%}
+%else {
        @-$(call RM, Ipc.obj)
+%}
 %for (var i = 0; i < OBJS.length; i++) {
        @-$(call RM, `OBJS[i]`)
 %}
+%if (Build.$private.libDir != null) {
+
+# create output directories
+ifneq ($(MAKECMDGOALS),clean)
+ifeq ($(wildcard `Build.$private.libDir`),)
+    $(shell $(MKDIR) `Build.$private.libDir`)
+endif
+endif
+%}