///////////////////////////////////////////////////////////////////////////////
//                            Lisaac Installer                               //
//                                                                           //
//                   LSIIT - ULP - CNRS - INRIA - FRANCE                     //
//                                                                           //
//   This program is free software: you can redistribute it and/or modify    //
//   it under the terms of the GNU General Public License as published by    //
//   the Free Software Foundation, either version 3 of the License, or       //
//   (at your option) any later version.                                     //
//                                                                           //
//   This program is distributed in the hope that it will be useful,         //
//   but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           //
//   GNU General Public License for more details.                            //
//                                                                           //
//   You should have received a copy of the GNU General Public License       //
//   along with this program.  If not, see <http://www.gnu.org/licenses/>.   //
//                                                                           //
//                     http://isaacproject.u-strasbg.fr/                     //
///////////////////////////////////////////////////////////////////////////////

  // Lisaac Path Directory System (by Benoit Sonntag).
  //
  // Note:
  // =====
  //  This file is not a Lisaac prototype. 
  //  It's define the profile path directory for to compile code, with a target.
  //  `+' : append new string variable. 
  //  `-' : append new directory. 
  //  `*' : execute command after compilation. 
  //
  // Warning: 
  // ========
  //   - `lisaac' is environment variable value.
  //   - `input_file' is input file name value.
  //   - `output_file' is output file name value.
  //   - `target' is a target value.
  
Section DEFAULT  

  + target := UNIX;

Section COMPILER, SHORTER
  
  + source  := lisaac + "src/";
  
  - source + "tools/";
  - source + "type/";
  - source + "item/";
  - source + "constant/";
  - source + "variable/";
  - source + "external/";
  - source + "external/logic/";
  - source + "external/arithmetic/";
  - source + "external/comparison/";
  - source + "dispatcher/";
  - source + "context/";
  - source + "code_life/";
  
Section COMPILER, SHORTER
  
  * "gcc " + input_file + " -o " + output_file;  
  
Section COMPILER
    
  - source + "compiler_any/";
  
Section SHORTER

  - source + "shorter_any/";
  
  * "cp shorter ../bin/.";
  * "cp shorter.c ../bin/.";
  
Section Common
  // Always valid path.
  
  + option_gcc := " ";
  
  + lib    := lisaac + "lib/";
  + lib_os := lisaac + "lib_os/";
  
  + unix    := lib_os + "unix/";
  + windows := lib_os + "windows/";
  + dos     := lib_os + "dos/";
    
  // Standard library:
  - lib + "base/";
  - lib + "base/low_level/";
  - lib + "collection/";
  - lib + "collection/low_level/";
  - lib + "file_system/";
  - lib + "format/";
  - lib + "format/ai/";
  - lib + "format/bmp/";
  - lib + "graphics/";
  - lib + "graphics/low_level/";
  - lib + "gui/";
  - lib + "gui/clipping/";
  - lib + "gui/event/";
  - lib + "gui/input/";
  - lib + "gui/low_level/";
  - lib + "io/";  
  - lib + "kernel/";
  - lib + "memory/";
  - lib + "number/";
  - lib + "number/low_level/";
  - lib + "string/";
  - lib + "system/";
  - lib + "time/";
  
Section UNIX, DOS, COMPILER, SHORTER

  - unix   + "system/";
  - unix   + "file_system/";
  
Section UNIX
    
  + path_lib_x11 := "/usr/lib";
  
  - unix   + "video/";
  
  * "gcc " + input_file + " -O3 -fomit-frame-pointer -lm -lX11 -o " + 
    output_file + " -L" + path_lib_x11 + option_gcc;

  //* "gcc -D_ISOC9X_SOURCE -O3 -mfpmath=sse -msse2 -march=pentium4 -ffast-math -funroll-loops -o " +
  //output_file + " " + input_file + " -lm";
  
  //* "gcc -D_ISOC9X_SOURCE -O3 -mfpmath=sse -msse2 -march=pentium4 -ffast-math -funroll-loops -o " +
  //"mandelbrot_c mandelbrot_c.c -lm";
  
Section WINDOWS
  
  - unix   + "system/";
  - windows + "file_system/";
  - unix   + "file_system/";
  - windows + "video/";
  
  * "gcc " + input_file + " -o " + output_file + ".exe -lgdi32 " + option_gcc;    
  
Section DOS  
  
  - dos + "file_system/";
  - dos + "video/";
  
  * "gcc " + input_file + " -o " + output_file + ".exe " + option_gcc; 
  
// ********************************  
//            ISAAC  
// ********************************
Section X86, IPAQ, ST2XX, LINUX
  //
  // Standard.
  //
  
  + isaac := "/home/sonntag/svn/isaac/trunk/isaacos/";  
  + isaac_stdlib   := isaac + "stdlib/";
  + isaac_software := isaac + "software/";
  
  //
  // Standard Library.
  //
  
  - isaac_stdlib + "driver/";
  - isaac_stdlib + "driver/clock";
  - isaac_stdlib + "driver/keyboard";
  - isaac_stdlib + "driver/mouse";
  - isaac_stdlib + "driver/video";
  
  - isaac_stdlib + "event/";
  
  - isaac_stdlib + "file_system/";
  
  - isaac_stdlib + "format/";
  - isaac_stdlib + "format/freetype";
  
  - isaac_stdlib + "interface/";
  - isaac_stdlib + "interface/clipping";
  - isaac_stdlib + "interface/group";
  - isaac_stdlib + "interface/item";
  
  - isaac_stdlib + "system/";
  
  //
  // Software
  //
  
  - isaac_software + "about/";
  
  - isaac_software + "console/";
  
  - isaac_software + "game/fouronline";
  - isaac_software + "game/tetris";
  
  - isaac_software + "panel";
  
  - isaac_software + "viewer";
  
Section X86  
  
  + machine := isaac + "x86/";
  
  // Specific directory
  
  - machine + "file_system/physical";
  - machine + "file_system/partition";
  
  
//  * "gcc -specs=" + isaac + "tool/gcc/x86/specs " + input_file + " -c -fPIC";
//  * "cp -f startup.o ../loader/";
    * "gcc -specs=" + isaac + "tool/gcc/x86/specs " + input_file + " -o " + output_file;
    * isaac+"tool/elf2eof/elf2eof -v -p 2048 "+output_file+" -prepend "+isaac+"x86/bootloader/startup.com";
    * "rm startup.sys";
    * "mv startup.eof startup.sys";
    * "./dosemu c startup.sys .";
    * "./dosemu e";

  
//  * "mount /floppy";
//  * "cp -f startup.eof /mnt/floppy/startup.sys";
//  * "umount /floppy";
  
Section IPAQ  
  
  + machine := isaac + "ipaq/";
  
  * "arm-linux-gcc -specs="+isaac+"tool/gcc/ipaq/specs -nostdlib " + input_file + " -O3 -o " + output_file;
  * isaac+"tool/elf2eof/elf2eof -f " + output_file + " -append "+isaac+"image/isaac.ai "+isaac+"image/newton.bmp";
  
Section ST2XX  
  
  + machine := isaac + "st2xx/";
  
//  * "/home/sonntagb/lxbe/le/bin/gcc entry_isaac.s -c";
  * "/home/sonntagb/lxbe/le/bin/gcc " + input_file + " -c";
  * "/home/sonntagb/lxbe/le/bin/ld -EL "+output_file+".o -o "+output_file+" -T../tool/gcc/st2xx/isaac.x";

Section LINUX  
  
  - unix   + "system/";
  - unix   + "file_system/";
  + machine := isaac + "linux/";
  
  // Specific directory
  
  * "gcc -L/usr/X11R6/lib -lX11 -lXext " + input_file + " -o " + output_file;
  
Section IPAQ, X86, ST2XX, LINUX
    
  //
  // Specific machine.
  //

  - machine + "driver/";
  - machine + "driver/clock";
  - machine + "driver/keyboard";
  - machine + "driver/mouse";
  - machine + "driver/video";
  
  - machine + "file_system/";
  
  - machine + "system/";
