1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) DIGITEO - 2009-2010 - Allan CORNET
4 // This file must be used under the terms of the CeCILL.
5 // This source file is licensed as described in the file COPYING, which
6 // you should have received as part of this distribution. The terms
7 // are also available at
8 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
9 //=============================================================================
10 function ilib_gen_cleaner(makename,loadername,files)
19 loadername = 'loader.sce';
26 cleanername = 'cleaner.sce';
28 fd = mopen(cleanername,"wt");
29 mfprintf(fd,"// This file is released under the 3-clause BSD license. See COPYING-BSD.\n");
30 mfprintf(fd,"// Generated by builder.sce : Please, do not edit this file\n");
31 mfprintf(fd,"// cleaner.sce\n");
32 mfprintf(fd,"// ------------------------------------------------------\n");
33 mfprintf(fd,"curdir = pwd();\n");
34 mfprintf(fd,"cleaner_path = get_file_path(''cleaner.sce'');\n");
35 mfprintf(fd,"chdir(cleaner_path);\n");
36 mfprintf(fd,"// ------------------------------------------------------\n");
37 mfprintf(fd,"if fileinfo(''%s'') <> [] then\n",loadername);
38 mfprintf(fd," mdelete(''%s'');\n",loadername);
40 mfprintf(fd,"// ------------------------------------------------------\n");
42 if getos() == 'Windows' then
43 make_command = get_make_command(makename);
44 mfprintf(fd,"if fileinfo(''%s%s'') <> [] then\n",makename,get_makefile_ext());
45 mfprintf(fd," unix_s(''%s'');\n",make_command);
46 mfprintf(fd," mdelete(''%s%s'');\n",makename,get_makefile_ext());
48 mfprintf(fd,"// ------------------------------------------------------\n");
52 for i = 1:size(files,'*')
53 if ( files(i) <> '' ) then
54 mfprintf(fd,"if fileinfo(''%s'') <> [] then\n", files(i));
55 mfprintf(fd," mdelete(''%s'');\n", files(i));
57 mfprintf(fd,"// ------------------------------------------------------\n");
62 mfprintf(fd,"chdir(curdir);\n");
63 mfprintf(fd,"// ------------------------------------------------------\n");
66 if ilib_verbose() > 1 then
67 disp(mgetl('cleaner.sce'));
70 //=============================================================================
71 function cmd = get_make_command(makename)
72 if getos() == 'Windows' then // WINDOWS
73 // Load dynamic_link Internal lib if it's not already loaded
74 if ~ exists("dynamic_linkwindowslib") then
75 load("SCI/modules/dynamic_link/macros/windows/lib");
77 cmd = dlwGetMakefileCmdCleaner(makename);
79 cmd = 'make ' + makename + ' clean';
82 //=============================================================================
83 function ext = get_makefile_ext()
84 if getos() == 'Windows' then // WINDOWS
85 // Load dynamic_link Internal lib if it's not already loaded
86 if ~ exists("dynamic_linkwindowslib") then
87 load("SCI/modules/dynamic_link/macros/windows/lib");
89 ext = dlwGetMakefileExt();
94 //=============================================================================