LCC uses a makefile template as VS
Allan CORNET [Sat, 2 May 2009 08:59:32 +0000 (10:59 +0200)]
scilab/CHANGES_5.2.X
scilab/contrib/toolbox_skeleton/sci_gateway/builder_gateway.sce
scilab/modules/dynamic_link/dynamic_link.iss
scilab/modules/dynamic_link/macros/ilib_for_link.sci
scilab/modules/dynamic_link/macros/ilib_gen_Make.sci
scilab/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC [new file with mode: 0644]

index 225a7b6..b2453e6 100644 (file)
@@ -51,6 +51,9 @@ Dynamic link:
  - Windows : temporary files (objects) are generated in a intermediate subdirectory (Release or Debug)
    ilib_for_link and ilib_gen_Make (with Visual studio) use a same makefile template.
    (SCI/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.VC)
+  
+ - ilib_for_link and ilib_gen_Make with lcc-win32 use a same makefile template.
+   (SCI/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC)
 
  - ilib_verbose (SEP #17) Set level of display returned by dynamic link functions.
  
index 6f8e2b5..ab1367a 100644 (file)
@@ -8,8 +8,16 @@ sci_gateway_dir = get_absolute_file_path('builder_gateway.sce');
 
 tbx_builder_gateway_lang('fortran', sci_gateway_dir);
 tbx_builder_gateway_lang('c', sci_gateway_dir);
-tbx_builder_gateway_lang('cpp', sci_gateway_dir);
-tbx_build_gateway_loader(['c', 'fortran','cpp'], sci_gateway_dir);
+
+// LCC does not manage C++
+if ~with_lcc() then
+  tbx_builder_gateway_lang('cpp', sci_gateway_dir); 
+  languages = ['c', 'fortran','cpp'];
+else
+  languages = ['c', 'fortran'];
+end
+
+tbx_build_gateway_loader(languages, sci_gateway_dir);
 
 clear tbx_builder_gateway_lang tbx_build_gateway_loader;
 clear sci_gateway_dir;
index eaaf983..aefaad1 100644 (file)
@@ -36,6 +36,7 @@ Source: modules\{#DYNAMIC_LINK}\help\addchapter.sce; DestDir: {app}\modules\{#DY
 ;
 Source: modules\{#DYNAMIC_LINK}\src\scripts\Makedll.incl; DestDir: {app}\modules\{#DYNAMIC_LINK}\src\scripts; Components: {#COMPN_SCILAB}
 Source: modules\{#DYNAMIC_LINK}\src\scripts\TEMPLATE_MAKEFILE.VC; DestDir: {app}\modules\{#DYNAMIC_LINK}\src\scripts; Components: {#COMPN_SCILAB}
+Source: modules\{#DYNAMIC_LINK}\src\scripts\TEMPLATE_MAKEFILE.LCC; DestDir: {app}\modules\{#DYNAMIC_LINK}\src\scripts; Components: {#COMPN_SCILAB}
 Source: modules\{#DYNAMIC_LINK}\src\scripts\Makefile.incl.mak; DestDir: {app}\modules\{#DYNAMIC_LINK}\src\scripts; Components: {#COMPN_SCILAB}
 ;
 Source: modules\{#DYNAMIC_LINK}\includes\*.h; DestDir: {app}\modules\{#DYNAMIC_LINK}\includes; Components: {#COMPN_SCILAB}
index 501fe21..8bfea41 100644 (file)
@@ -1,5 +1,6 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) INRIA/ENPC
+// Copyright (C) DIGITEO - 2009 - Allan CORNET
 // 
 // This file must be used under the terms of the CeCILL.
 // This source file is licensed as described in the file COPYING, which
@@ -108,8 +109,7 @@ function ilib_link_gen_Make(names, ..
                                   ldflags, ..
                                   cflags, ..
                                   fflags, ..
-                                  cc, ..
-                                  flag);
+                                  cc);
       else
       // TO DO : Add another compiler here
       end
@@ -345,88 +345,105 @@ function ilib_link_gen_Make_lcc(names, ..
                                 ldflags, ..
                                 cflags, ..
                                 fflags, ..
-                                cc, ..
-                                flag)
+                                cc)
                                 
-  // TO DO rewrite with a template 
-  
-  if libname == "" then libname = names(1);end 
-  fd = mopen(Makename,"wt");
-  mfprintf(fd,"# ------------------------------------------------------------\n");
-  mfprintf(fd,"# generated by builder.sce (lcc): Please do not edit this file\n");
-  mfprintf(fd,"# ------------------------------------------------------------\n\n");
-  mfprintf(fd,"SCIDIR = %s\n",SCI);
-  mfprintf(fd,"SCIDIR1 = %s\n",pathconvert(SCI,%f,%f,'w'));
-  mfprintf(fd,"LCCLIBDIR =%s\n",getshortpathname(SCIHOME+filesep()+'lcclib'));
-  mfprintf(fd,"DUMPEXTS = ""$(SCIDIR1)\\bin\\dumpexts""\n");
-  mfprintf(fd,"SCIIMPLIB=$(LCCLIBDIR)\\LibScilab.lib $(LCCLIBDIR)\\blasplus.lib $(LCCLIBDIR)\\libf2c.lib $(LCCLIBDIR)\\intersci.lib $(LCCLIBDIR)\\lapack.lib $(LCCLIBDIR)\\scicos.lib\n\n");
-  mfprintf(fd,"CC = lcc\n");
-  mfprintf(fd,"LINKER = lcclnk\n");
-  mfprintf(fd,"CFLAGS= -ansic msvcrt.lib -I""$(SCIDIR)/modules/core/includes"" -I""$(SCIDIR)/modules/output_stream/includes"" -I""$(SCIDIR)/libs/f2c"" -I""$(SCIDIR)/modules/mexlib/includes"" -Dmexfunction_=mex$*_ -DmexFunction=mex_$* -DWIN32 -DSTRICT -DFORDLL -D__STDC__  -DHAVE_EXP10"+ cflags +" \n"); 
-  mfprintf(fd,"LINKER_FLAGS = -dll -nounderscores\n");
-  mfprintf(fd,"EXTRA_LDFLAGS = "+ ldflags+"\n");
-  mfprintf(fd,"O=.obj\n");
-  mfprintf(fd,"# name of the dll to be built\n"); 
-  mfprintf(fd,"LIBRARY = lib%s\n",libname);
-  mfprintf(fd,"\n# list of objects file\n");
-  
-  if (flag =='c') then
-       mfprintf(fd,"OBJSC =");
-       for x = files(:)' ;
-         [ptmp,ftmp,fext] = fileparts(x);
-               x = ptmp + ftmp;
-               mfprintf(fd," %s$(O)",x);
-       end
-  
-       mfprintf(fd,"\nOBJSF=\n");
-  else
-       mfprintf(fd,"OBJSC =\n");
-       mfprintf(fd,"\nOBJSF=");
-       for x = files(:)' ;
-      [ptmp,ftmp,fext] = fileparts(x);
-               x = ptmp + ftmp;
-               mfprintf(fd," %s$(O)",x);
-       end
+  managed_ext = ['.c', '.f'];
+  obj_ext = ['.o', '.obj', ''];
+  
+  CFLAGS = cflags;
+  MEXCFLAGS = '';
+  FFLAGS = fflags;
+  MEXFFLAGS = '';
+  LDFLAGS = ldflags;
+  SCIDIR = SCI;
+  SCIDIR1 = pathconvert(SCI,%f,%f,'w');
+  LCCLIBDIR = SCIHOME + filesep() + 'lcclib';
+  LIBRARY = '';
+  FILES_SRC = '';
+  OBJS = '';
+  OTHERLIBS = '';
+  
+  FILES_SRC_MATRIX = [];
+  
+  [path_Make, file_Make, ext_Make] = fileparts(Makename);
+  
+  for i=1:size(files,'*') 
+    [path_f, file_f, ext_f] = fileparts(files(i));
+    
+    if or(obj_ext == ext_f) then
+      FILENAME = [];
+      FILE_FOUNDED = %f;
+      for y = managed_ext(:)'
+        if (FILE_FOUNDED == %f) then
+          if (fileinfo(path_f + file_f + y) <> []) | (fileinfo(path_Make + file_f + y) <> []) then
+            FILENAME = path_f + file_f + y;
+            FILE_FOUNDED = %t;
+          end
+        end
+      end
+    else
+      FILENAME = files(i);
+    end
+    FILES_SRC_MATRIX = [FILES_SRC_MATRIX , FILENAME];
   end
   
-  mfprintf(fd,"\nOBJS = $(OBJSC) $(OBJSF)\n");
+  FILES_SRC = strcat(FILES_SRC_MATRIX,' ');
+
+  OBJS_MATRIX = [];
   
-  mfprintf(fd,"\n# added libraries \n");
-  mfprintf(fd,"OTHERLIBS =");
-  for x = libs(:)' ;
-       mfprintf(fd," ""%s.lib""",x);
+  for y = 1:size(FILES_SRC_MATRIX,'*')
+    [path_f, file_f, ext_f] = fileparts(FILES_SRC_MATRIX(y));
+    OBJS_MATRIX = [OBJS_MATRIX, path_f + file_f + '.obj'];
   end
-  mfprintf(fd,"\n");
   
-  mfprintf(fd,"\nall :: $(LIBRARY).dll\n");
-  mfprintf(fd,"\n$(LIBRARY).dll: $(OBJS)\n");
-  mfprintf(fd,"\t"+"$(DUMPEXTS) -o ""$(LIBRARY).def"" ""$*"" $(OBJS)\n");
-  mfprintf(fd,"\t"+"$(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCIIMPLIB) $(EXTRA_LDFLAGS) $*.def -o $(LIBRARY).dll\n\n");
-  for x = files(:)' 
-    [ptmp,ftmp,fext] = fileparts(x);
-    x = ptmp + ftmp;
-       mfprintf(fd,"%s$(O):\n",x);
-       if (flag =='c') then
-               mfprintf(fd,"\t"+"$(CC) $(CFLAGS) $*.c\n\n");
-       else
-               mfprintf(fd,"\t"+"@$(SCIDIR1)\\bin\\f2c.exe $*.f \n");
-                 mfprintf(fd,"\t"+"@$(CC) $(CFLAGS) $*.c \n");
-                 mfprintf(fd,"\t"+"del $*.c \n");
-         end
+  OBJS = strcat(OBJS_MATRIX, ' ');
+  
+  if (libname == '') then
+    LIBRARY = 'lib' + names(1);
+  else
+    LIBRARY = 'lib' + libname;
   end
-       
-  mfprintf(fd,"clean:\n");
-  mfprintf(fd,"\t"+"del *.obj\n");
-  mfprintf(fd,"\t"+"del *.dll\n");
-  mfprintf(fd,"\t"+"del *.lib\n");
-  mfprintf(fd,"\t"+"del *.def\n");
-  mclose(fd);
   
-  if ilib_verbose() > 1 then
-    disp(mgetl(Makename));
+  if (libs <> []) then
+    for x = libs(:)'
+      if x <> '' then
+        OTHERLIBS = OTHERLIBS + ' ' + x + '.lib';
+      end
+    end
   end
+  OTHERLIBS = strsubst(OTHERLIBS,'/',filesep());
+
+  try
+    MAKEFILE_LCC = mgetl(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC');
+  catch
+    MAKEFILE_LCC = '';
+  end
+  
+
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LDFLAGS__" , LDFLAGS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__SCI__" , SCIDIR);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__SCIDIR1__" , SCIDIR1);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LCCLIBDIR__" , LCCLIBDIR);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LIBRARY__" , LIBRARY);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__FILES_SRC__" , FILES_SRC);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__OTHERSLIBS__" , OTHERLIBS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__CFLAGS__" , CFLAGS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__MEXCFLAGS__" , MEXCFLAGS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__FFLAGS__" , FFLAGS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__MEXFFLAGS__" , MEXFFLAGS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__OBJS__" , OBJS);
+  
+  if ( MAKEFILE_LCC <> '') then
+    fd = mopen(Makename, "wt");
+    mputl(MAKEFILE_LCC, fd);
+    mclose(fd);
+    if ilib_verbose() > 1 then
+      disp(mgetl(Makename));
+    end
+  else
+    // TEMPLATE_MAKEFILE.LCC not found
+    warning(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC'+ _('not found.') );
+  end
+  
 endfunction
 //==========================================    
index 088028d..8e23bee 100644 (file)
@@ -1,5 +1,6 @@
 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 // Copyright (C) ENPC
+// Copyright (C) DIGITEO - 2009 - Allan CORNET
 // 
 // This file must be used under the terms of the CeCILL.
 // This source file is licensed as described in the file COPYING, which
@@ -8,7 +9,6 @@
 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
 
 function Makename=ilib_gen_Make(name,tables,files,libs,makename,with_gateway,ldflags,cflags,fflags,cc)
-// flag 'c' or 'f' used with lcc 
 //------------------------------------
 // generate a Makefile for gateway
 
@@ -47,7 +47,7 @@ function Makename=ilib_gen_Make(name,tables,files,libs,makename,with_gateway,ldf
   comp_target = COMPILER;
   if with_lcc() == %T then
        Makename = makename+'.lcc'
-       ilib_gen_Make_lcc(name,tables,files,libs,Makename,with_gateway,ldflags,cflags,fflags,'c')
+       ilib_gen_Make_lcc(name,tables,files,libs,Makename,with_gateway,ldflags,cflags,fflags)
   else if getenv('WIN32','NO')=='OK' then
     select comp_target
      case 'VC++'   then Makename = makename+'.mak'
@@ -213,123 +213,131 @@ function ilib_gen_Make_win32(name,table,files,libs,Makename,with_gateway,ldflags
 endfunction
 //---------------------------------------------------------------------------------------
          
-function ilib_gen_Make_lcc(name,table,files,libs,Makename,with_gateway,ldflags,cflags,fflags,flag)
-// Allan CORNET
-//INRIA 2004
+function ilib_gen_Make_lcc(name,table,files,libs,Makename,with_gateway,ldflags,cflags,fflags)
+  managed_ext = ['.c', '.f'];
+  obj_ext = ['.o', '.obj', ''];
+  
+  CFLAGS = cflags;
+  MEXCFLAGS = '';
+  FFLAGS = fflags;
+  MEXFFLAGS = '';
+  LDFLAGS = ldflags;
+  SCIDIR = SCI;
+  SCIDIR1 = pathconvert(SCI,%f,%f,'w');
+  LCCLIBDIR = SCIHOME + filesep() + 'lcclib';
+  LIBRARY = name;
+  FILES_SRC = '';
+  OBJS = '';
+  OTHERLIBS = '';
 
-  managed_ext = ['.cxx','.cpp','.c','.f'];
-  for i=1:size(files,'*') // compatibility scilab 4.x
+  
+  FILES_SRC_MATRIX = [];
+  
+  [path_Make, file_Make, ext_Make] = fileparts(Makename);
+  
+  for i=1:size(files,'*') 
     [path_f, file_f, ext_f] = fileparts(files(i));
-    if or(managed_ext == ext_f) then
-      files(i) = path_f + file_f;
+    
+    if or(obj_ext == ext_f) then
+      FILENAME = [];
+      FILE_FOUNDED = %f;
+      for y = managed_ext(:)'
+        if (FILE_FOUNDED == %f) then
+          if (fileinfo(path_f + file_f + y) <> []) | (fileinfo(path_Make + file_f + y) <> []) then
+            FILENAME = path_f + file_f + y;
+            FILE_FOUNDED = %t;
+          end
+        end
+      end
     else
-      files(i) = path_f + file_f + ext_f;
+      FILENAME = files(i);
     end
+    FILES_SRC_MATRIX = [FILES_SRC_MATRIX , FILENAME];
   end
-  
-  if with_module('scicos') then
-    scicoslib = '$(LCCLIBDIR)\\scicoslcc.lib $(LCCLIBDIR)\\scicos_flcc.lib $(LCCLIBDIR)\\scicos_blockslcc.lib  $(LCCLIBDIR)\\scicos_blocks_flcc.lib';
-  else
-    scicoslib = '';
-  end
-
-  fd=mopen(Makename,"wt");
-  mfprintf(fd,"# ------------------------------------------------------------\n");
-  mfprintf(fd,"# generated by builder.sce (lcc 1): Please do not edit this file\n");
-  mfprintf(fd,"# ------------------------------------------------------------\n\n");
-  mfprintf(fd,"SCIDIR =%s\n",SCI);
-  mfprintf(fd,"LCCLIBDIR =%s\n",getshortpathname(SCIHOME+filesep()+'lcclib'));
-  mfprintf(fd,"SCIDIR1 =%s\n",pathconvert(SCI,%f,%f,'w'));
-  mfprintf(fd,"DUMPEXTS=""$(SCIDIR1)\\bin\\dumpexts""\n");
-       mfprintf(fd,"SCIIMPLIB=$(LCCLIBDIR)\\LibScilablcc.lib $(LCCLIBDIR)\\blaspluslcc.lib $(LCCLIBDIR)\\libf2clcc.lib $(LCCLIBDIR)\\interscilcc.lib $(LCCLIBDIR)\\lapacklcc.lib " + scicoslib +"\n\n");
-  mfprintf(fd,"CC=lcc\n");
-  mfprintf(fd,"LINKER=lcclnk\n");
-  mfprintf(fd,"CFLAGS= -ansic msvcrt.lib -I""$(SCIDIR)/modules/core/includes"" -I""$(SCIDIR)/modules/output_stream/includes"" -I""$(SCIDIR)/libs/f2c"" -I""$(SCIDIR)/modules/mexlib/includes"" -Dmexfunction_=mex$*_ -DmexFunction=mex_$* -DWIN32 -DSTRICT -DFORDLL -D__STDC__ "+ cflags +" \n"); 
-  mfprintf(fd,"LINKER_FLAGS=-dll -nounderscores\n");
-  mfprintf(fd,"EXTRA_LDFLAGS = "+ ldflags+"\n");
-  mfprintf(fd,"O=.obj\n");
-  mfprintf(fd,"# name of the dll to be built\n"); 
-  mfprintf(fd,"LIBRARY = %s\n",name);
-  mfprintf(fd,"# list of objects file\n");
-  mfprintf(fd,"OBJS =");
-  for x=files(:)' ; mfprintf(fd," %s$(O)",x);end
 
-  if typeof(table)<>'list' then 
-    tables= list(table)
+  if typeof(tables) <> 'list' then 
+    tables = list(tables);
   end
-  
-  L=length(table); 
+  L = length(tables); 
 
   if with_gateway then 
-    if L==1 then 
-      mfprintf(fd," %s$(O)",name);
+    if L == 1 then 
+      FILES_SRC_MATRIX = [FILES_SRC_MATRIX , name + '.c'];
     else
-       for i=1:L , mfprintf(fd," %s$(O)",name+string(i));end 
+       for i=1:L
+        FILES_SRC_MATRIX = [FILES_SRC_MATRIX , name + string(i) + '.c'];
+       end 
     end
   end
   
   for it=1:L 
-    table = tables(it)
-    [mt,nt]=size(table);
+    table = tables(it);
+    [mt,nt] = size(table);
  
     for i=1:mt ; 
       // mex files to be added 
       if table(i,3)=='cmex' | table(i,3)=='fmex' | table(i,3)=='Fmex' 
-        mfprintf(fd," %s$(O)",table(i,2));
+        FILES_SRC_MATRIX = [FILES_SRC_MATRIX , table(i,2)];
       end
     end
   end
   
+  FILES_SRC = strcat(FILES_SRC_MATRIX,' ');
   
-  mfprintf(fd,"\n\n# added libraries \n");
-  mfprintf(fd,"OTHERLIBS =");
-  
-  for x=libs(:)' ; mfprintf(fd," %s.lib",x);end
-  mfprintf(fd,"\n");
+  if table(i,3)=='cmex' | table(i,3)=='fmex' | table(i,3)=='Fmex' then
+    MEXCFLAGS = "-Dmexfunction_=mex$*_ -DmexFunction=mex_$*";
+    MEXFFLAGS = "-Dmexfunction=mex$*";
+  end 
+
+  OBJS_MATRIX = [];
   
-  mfprintf(fd,"\n");
+  for y = 1:size(FILES_SRC_MATRIX,'*')
+    [path_f, file_f, ext_f] = fileparts(FILES_SRC_MATRIX(y));
+    OBJS_MATRIX = [OBJS_MATRIX, path_f + file_f + '.obj'];
+  end
   
-  mfprintf(fd,"\nall :: $(LIBRARY).dll\n");
-  mfprintf(fd,"\n$(LIBRARY).dll: $(OBJS)\n");
-  mfprintf(fd,"\t"+"$(DUMPEXTS) -o ""$(LIBRARY).def"" ""$*"" $(OBJS)\n");
-  mfprintf(fd,"\t"+"$(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCIIMPLIB) $(SCILAB_LIBS) $(EXTRA_LDFLAGS) $*.def -o $(LIBRARY).dll\n\n");
+  OBJS = strcat(OBJS_MATRIX, ' ');
 
-  for x=files(:)' ;
-    managed_ext_obj = ['.obj','.o'];
-    [path_f, file_f, ext_f] = fileparts(x);
-    if or(managed_ext == ext_f) then
-      files(i) = path_f + file_f;
-    else
-      files(i) = path_f + file_f + ext_f;
-    end
-       mfprintf(fd,"%s$(O):\n",x);
-       mfprintf(fd,"\t"+"$(CC) $(CFLAGS) $*.c\n\n");
+  for x=libs(:)'
+     if OTHERLIBS <> '' then
+       OTHERLIBS = OTHERLIBS + ' ' + x + '.lib';
+     else
+       OTHERLIBS = x + '.lib';
+     end 
   end
+  OTHERLIBS = strsubst(OTHERLIBS,'/',filesep());
 
-  if with_gateway then 
-    if L==1 then 
-      mfprintf(fd,"\n%s$(O):\n",name);
-      mfprintf(fd,"\t"+"$(CC) $(CFLAGS) $*.c\n");
-    else
-       for i=1:L ;
-       mfprintf(fd,"\n%s$(O):\n",name+string(i));
-       mfprintf(fd,"\t"+"$(CC) $(CFLAGS) $*.c\n");
-       end 
-    end
+  try
+    MAKEFILE_LCC = mgetl(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC');
+  catch
+    MAKEFILE_LCC = '';
   end
+
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LDFLAGS__" , LDFLAGS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__SCI__" , SCIDIR);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__SCIDIR1__" , SCIDIR1);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LCCLIBDIR__" , LCCLIBDIR);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__LIBRARY__" , LIBRARY);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__FILES_SRC__" , FILES_SRC);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__OTHERSLIBS__" , OTHERLIBS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__CFLAGS__" , CFLAGS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__MEXCFLAGS__" , MEXCFLAGS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__FFLAGS__" , FFLAGS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__MEXFFLAGS__" , MEXFFLAGS);
+  MAKEFILE_LCC = strsubst(MAKEFILE_LCC , "__OBJS__" , OBJS);
   
-  mfprintf(fd,"\nclean:\n");
-  mfprintf(fd,"\t"+"del *.obj\n");
-  mfprintf(fd,"\t"+"del *.dll\n");
-  mfprintf(fd,"\t"+"del *.lib\n");
-  mfprintf(fd,"\t"+"del *.def\n");
- mclose(fd);
+  if ( MAKEFILE_LCC <> '') then
+    fd = mopen(Makename, "wt");
+    mputl(MAKEFILE_LCC, fd);
+    mclose(fd);
+    
+    if ilib_verbose() > 1 then
+      disp(mgetl(Makename));
+    end
+  else
+    // TEMPLATE_MAKEFILE.LCC not found
+    warning(SCI+'/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC'+ _('not found.') );
+  end
  
- if ilib_verbose() > 1 then
-   disp(mgetl(Makename));
- end
-
 endfunction
 //---------------------------------------------------------------------------------------
diff --git a/scilab/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC b/scilab/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC
new file mode 100644 (file)
index 0000000..8c21b1a
--- /dev/null
@@ -0,0 +1,105 @@
+#=============================================================
+# Allan CORNET - DIGITEO - 2009
+#=============================================================
+# generated by builder.sce (lcc): Please do not edit this file
+# see TEMPLATE makefile for LCC-Win32
+# see SCI/modules/dynamic_link/src/scripts/TEMPLATE_MAKEFILE.LCC
+#=============================================================
+# LCC-WIN32 does not support !IF and !INCLUDE ...
+# http://www.dirtcellar.net/lccwin32sg/featurereqlist.html
+#=============================================================
+all:
+MAKE=make -f Makelib.lcc
+#=============================================================
+CC = lcc
+LINKER = lcclnk
+OBJ = obj
+#=============================================================
+LINKER_OPTIMISATION_MODE =
+CC__OPTIMISATION_MODE =
+#=============================================================
+CC_COMMON = -DWIN32 -D_MSC_VER -DSTRICT -DFORDLL -D__STDC__ -DHAVE_EXP10 $(INCLUDES)
+CC_OPTIONS = -ansic msvcrt.lib $(CC_COMMON) $(CC__OPTIMISATION_MODE)
+CC_LDFLAGS = 
+CFLAGS = $(CC_OPTIONS) __CFLAGS__ __MEXCFLAGS__
+FFLAGS = $(CC_OPTIONS) __FFLAGS__ __MEXFFLAGS__
+#=============================================================
+LINKER_FLAGS = -dll -nounderscores $(LINKER_OPTIMISATION_MODE)
+EXTRA_LDFLAGS = __LDFLAGS__
+#=============================================================
+SCIDIR = __SCI__
+SCIDIR1 = __SCIDIR1__
+LCCLIBDIR = __LCCLIBDIR__
+DUMPEXTS = "$(SCIDIR1)\bin\dumpexts"
+#=============================================================
+# name of the dll to be built
+LIBRARY = __LIBRARY__
+#=============================================================
+# list of files
+FILES_SRC = __FILES_SRC__
+#=============================================================
+# list of objects file
+OBJS = __OBJS__
+#=============================================================
+# added libraries 
+OTHERLIBS = __OTHERSLIBS__
+#=============================================================
+# include options 
+INCLUDES=-I"$(SCIDIR)\libs\MALLOC\includes" \
+-I"$(SCIDIR)/modules/core/includes" \
+-I"$(SCIDIR)/modules/call_scilab/includes" \
+-I"$(SCIDIR)/modules/output_stream/includes" \
+-I"$(SCIDIR)/modules/jvm/includes" \
+-I"$(SCIDIR)/modules/localization/includes" \
+-I"$(SCIDIR)/libs/intl" \
+-I"$(SCIDIR)/libs/f2c" \
+-I"$(SCIDIR)/modules/mexlib/includes" \
+-I"$(SCIDIR)/modules/localization/includes" \
+-I"$(SCIDIR)/modules/jvm/includes" \
+-I"$(SCIDIR)/modules/time/includes" \
+-I"$(SCIDIR)/libs/intl"
+#=============================================================
+# Libraries 
+#=============================================================
+# SCILAB_LIBS is used by the binary version of Scilab for linking external codes
+SCILAB_LIBS="$(LCCLIBDIR)\MALLOC.lib" "$(LCCLIBDIR)\blasplus.lib" \
+"$(LCCLIBDIR)\libf2c.lib" "$(LCCLIBDIR)\lapack.lib" \
+"$(LCCLIBDIR)\scicos.lib" "$(LCCLIBDIR)\intersci.lib" \
+"$(LCCLIBDIR)\scioutput_stream.lib" "$(LCCLIBDIR)\dynamic_link.lib" \
+"$(LCCLIBDIR)\integer.lib" "$(LCCLIBDIR)\optimization_f.lib" \
+"$(LCCLIBDIR)\libjvm.lib" "$(LCCLIBDIR)\scilocalization.lib" \
+"$(LCCLIBDIR)\libintl.lib" "$(LCCLIBDIR)\linpack_f.lib" \
+"$(LCCLIBDIR)\call_scilab.lib" "$(LCCLIBDIR)\time.lib" \
+"$(LCCLIBDIR)\libscilab.lib"
+#=============================================================
+.c.$(OBJ):
+       @echo ------------- Compile file $< --------------
+       $(CC) $(CFLAGS) $< 
+#============================================================= 
+.f.$(OBJ):
+       @echo ----------- Compile file $*.f (using f2c) -------------   
+#      @"$(SCIDIR1)\bin\f2c.exe" -E -I"$(SCIDIR1)/modules/core/includes" $*.f 2>NUL
+       @"$(SCIDIR1)\bin\f2c.exe" -I"$(SCIDIR1)/modules/core/includes" $*.f 2>NUL
+       @$(CC) $(FFLAGS) $*.c
+#=============================================================
+all: $(LIBRARY).dll
+#=============================================================
+$(LIBRARY).dll: $(OBJS)
+       $(DUMPEXTS) -o "$(LIBRARY).def" "$*" $(OBJS)
+       $(LINKER) $(LINKER_FLAGS) $(OBJS) $(OTHERLIBS) $(SCILAB_LIBS) \
+       $(EXTRA_LDFLAGS) $(LIBRARY).def -o $(LIBRARY).dll
+#=============================================================
+clean:
+       del *.bak 
+       del *.$(OBJ)
+       del *.dll
+       del *.lib
+       del *.def       
+#=============================================================
+distclean:  
+       del *.bak 
+       del *.$(OBJ)
+       del *.dll
+       del *.lib
+       del *.def
+#=============================================================