# -*- Shell-script -*-
# vim:se ft=sh:

mainmenu_name "DROPS Configuration"

mainmenu_option next_comment
comment 'Target Architecture'

choice 'Target Architecture' \
	"x86              BUILD_ARCH_x86 \
	 arm              BUILD_ARCH_arm \
	 amd64            BUILD_ARCH_amd64" x86

if [ "$BUILD_ARCH_x86" = "y" ] ; then
  define_string BUILD_ARCH "x86"
  string " CPU type" CPU '586'
fi

if [ "$BUILD_ARCH_arm" = "y" ] ; then
  define_string BUILD_ARCH "arm"
fi

if [ "$BUILD_ARCH_amd64" = "y" ] ; then
  define_string BUILD_ARCH "amd64"
  string " CPU type" CPU 'k8'
fi


choice ' ABI' \
  "L4.Fiasco BUILD_ABI_l4v2 \
   Linux     BUILD_ABI_linux" L4.Fiasco

if [ "$BUILD_ABI_l4v2" = "y" ] ; then
  define_string BUILD_ABI "l4v2"
fi
if [ "$BUILD_ABI_linux" = "y" ] ; then
  define_string BUILD_ABI "linux"
fi

if [ "$BUILD_ARCH_arm" = "y" ] ; then

  choice 'ARM Platform' \
     "integrator   PLATFORM_ARM_integrator \
      rv           PLATFORM_ARM_rv \
      custom       PLATFORM_ARM_custom" integrator

  if [ "$PLATFORM_ARM_integrator" = "y" ] ; then
    define_string CPU 'int'
    define_string ARM_PLATFORM_TYPE 'integrator'
    string "RAM base" RAM_BASE 0x0
    int  "RAM size in MB" RAM_SIZE_MB 256
  fi
  if [ "$PLATFORM_ARM_rv" = "y" ] ; then
    define_string CPU 'rv'
    define_string ARM_PLATFORM_TYPE 'rv'
    string "RAM base" RAM_BASE 0x0
    int "RAM size in MB" RAM_SIZE_MB 256
  fi

  if [ "$PLATFORM_ARM_custom" = "y" ] ; then
    string " CPU type" CPU 'int'
    string " Platform name" ARM_PLATFORM_TYPE 'integrator'
    string "RAM base" RAM_BASE 0x0
    int "RAM size in MB" RAM_SIZE_MB 256
  fi


fi

endmenu


mainmenu_option next_comment
comment 'Paths and Directories'
string 'DROPS_STDDIR' DROPS_STDDIR '/path/to/drops'
string 'DROPS_INSTDIR' DROPS_INSTDIR '$(DROPS_STDDIR)'
endmenu

mainmenu_option next_comment
comment 'Verboseness and Messages'
bool 'Verbose dependency building' DEPEND_VERBOSE_SWITCH
if [ "$DEPEND_VERBOSE_SWITCH" = "n" ] ; then
    define_string DEPEND_VERBOSE @
fi
bool 'Verbose compilation and building' VERBOSE_SWITCH
if [ "$VERBOSE_SWITCH" = "n" ] ; then
    define_string VERBOSE @
fi
bool 'Short messages for compilation' SHOWMESSAGES
if [ "$SHOWMESSAGES" = "y" ] ; then
    bool 'Colored build-steps' BID_COLORED_PHASES
fi
endmenu

mainmenu_option next_comment
comment 'Compilers and Tools'
bool 'Use special C-Compilers' BIDc_USE_SPECIAL_CC
if [ "$BIDc_USE_SPECIAL_CC" = "y" ] ; then
    string 'HOST_CC'  HOST_CC  'gcc'
    string 'HOST_CXX' HOST_CXX 'g++'
    if [ "$BUILD_ARCH" = "x86" ] ; then
        string 'CC'  CC  '$(SYSTEM_TARGET_x86)gcc -m32'
        string 'CXX' CXX '$(SYSTEM_TARGET_x86)g++ -m32'
    fi
    if [ "$BUILD_ARCH" = "arm" ] ; then
        string 'CC'  CC  '$(SYSTEM_TARGET_arm)gcc'
        string 'CXX' CXX '$(SYSTEM_TARGET_arm)g++'
    fi
    if [ "$BUILD_ARCH" = "amd64" ] ; then
        string 'CC'  CC  '$(SYSTEM_TARGET_amd64)gcc -m64'
        string 'CXX' CXX '$(SYSTEM_TARGET_amd64)g++ -m64'
    fi
else
    define_string HOST_CC   'gcc'
    define_string HOST_CXX  'g++'
    if [ "$BUILD_ARCH" = "x86" ] ; then
      define_string CC  '$(SYSTEM_TARGET_x86)gcc -m32'
      define_string CXX '$(SYSTEM_TARGET_x86)g++ -m32'
    fi
    if [ "$BUILD_ARCH" = "arm" ] ; then
      define_string CC  '$(SYSTEM_TARGET_arm)gcc'
      define_string CXX '$(SYSTEM_TARGET_arm)g++'
    fi
    if [ "$BUILD_ARCH" = "amd64" ] ; then
      define_string CC  '$(SYSTEM_TARGET_amd64)gcc -m64'
      define_string CXX '$(SYSTEM_TARGET_amd64)g++ -m64'
    fi
fi
comment "Tools"
string 'YACC' YACC byacc
string 'LEX' LEX flex
string 'CTAGS' CTAGS ctags
string 'ETAGS' ETAGS etags

comment "Options"
bool 'System has ld.so (highly recommended if so)' HAVE_LDSO
if [ "$HAVE_LDSO" = "y" ] ; then
    bool 'Automatically determine internal gcc preprocessor names' INT_CPP_NAME_SWITCH
    if [ "$INT_CPP_NAME_SWITCH" = "n" ] ; then
        if [ "$BUILD_ARCH" = "x86" ] ; then
          string 'Internal name of x86 gcc preprocessor' INT_CPP_NAME "cpp0"
          string 'Internal name of x86 g++ preprocessor' INT_CXX_NAME "cpp0"
	fi
        if [ "$BUILD_ARCH" = "arm" ] ; then
          string 'Internal name of arm gcc preprocessor' INT_CPP_NAME "cpp0"
          string 'Internal name of arm g++ preprocessor' INT_CXX_NAME "cpp0"
	fi
        if [ "$BUILD_ARCH" = "amd64" ] ; then
          string 'Internal name of amd64 gcc preprocessor' INT_CPP_NAME "cpp0"
          string 'Internal name of amd64 g++ preprocessor' INT_CXX_NAME "cpp0"
	fi
    fi
    bool 'Automatically determine internal ld names' INT_LD_NAME_SWITCH
    if [ "$INT_LD_NAME_SWITCH" = "n" ] ; then
        if [ "$BUILD_ARCH" = "x86" ] ; then
          string 'Internal name of x86 gcc/g++ linker' INT_LD_NAME "ld"
	fi
        if [ "$BUILD_ARCH" = "arm" ] ; then
          string 'Internal name of arm gcc/g++ linker' INT_LD_NAME "ld"
	fi
        if [ "$BUILD_ARCH" = "amd64" ] ; then
          string 'Internal name of amd64 gcc/g++ linker' INT_LD_amd64_NAME "ld"
	fi
    fi
fi
bool 'Strip binaries on install' BID_STRIP_PROGS
bool 'Generate stabs-compatible debug Infos with gcc-3+' BID_GSTAB_SW
if [ "$BID_GSTAB_SW" = "y" ] ; then
    define_string BID_CFLAGS_GSTAB "-gstabs+"
fi
bool 'GCC: Omit Frame-pointers' BID_GCC_OMIT_FP
if [ "$BID_GCC_OMIT_FP" = "y" ] ; then
    define_string BID_CFLAGS_OMIT_FP "-fomit-frame-pointer"
fi
bool 'Generate Map-files for binaries' BID_GENERATE_MAPFILE
bool 'Build doc directories' BID_BUILD_DOC

endmenu

mainmenu_option next_comment
  comment 'Advanced'

  define_bool USE_UCLIBC   "y"
  define_bool USE_DIETLIBC "n"

  define_bool   BUILD_LOADER "y"
  define_string BUILD_LOADER_PICS 'libl4util.a libl4util_root.a libsigma0.a libnames.a libloaderif.a libcon.a libl4rm.a libbootmod.a libcon.a libconstream-server.a libdm_generic.a libdm_mem.a libgeneric_ts.a liblogserver.a liblogserver_capsule.a libsemaphore.a libthread.a libslab.a libgeneric_fprov.a libl4env_err.a libl4env.a libroot.a libc_be_l4env_start_stop.a libc_be_minimal_log_io.a libc_be_simple_mem.a libc_be_mmap.a libc_be_mmap_util.a libuclibc_support.a libuclibm_support.a librtc.a libl4env-l4lx.a'

  bool 'Use system-call entry code in the KIP (absolute)' L4_CALL_SYSCALLS
  if [ "$L4_CALL_SYSCALLS" = "y" ] ; then
    define_bool L4_ABS_SYSCALLS "y"
    define_string  BID_CPPFLAGS_SYSCALLS "-DCONFIG_L4_CALL_SYSCALLS -DCONFIG_L4_ABS_SYSCALLS"
  fi

  bool 'Use hierarchical task system (EXPERIMENTAL)' USE_TASKLIB
  bool 'Enable RELEASE flag' RELEASE_MODE
  bool 'Do not build anything outside l4 directory' BID_BUILD_L4DIR_ONLY

  string 'Configuration label' CONFIG_LABEL

  mainmenu_option next_comment
    comment 'Paths'

    define_string LINUX24_INCDIR '$(OBJ_BASE)/include/linux-24 $(DROPS_STDDIR)/include/linux-24'
    define_string LINUX26_INCDIR '$(OBJ_BASE)/include/$(ARCH)/l4/linux-26-headers $(DROPS_STDDIR)/include/$(ARCH)/l4/linux-26-headers $(OBJ_BASE)/include/l4/linux-26-headers $(DROPS_STDDIR)/include/l4/linux-26-headers'

    string 'DDE-2.4 include path (DDE_INCDIR)' DDE_INCDIR '$(OBJ_BASE)/include/$(ARCH)/l4/dde_linux $(DROPS_STDDIR)/include/$(ARCH)/l4/dde_linux'
    string 'DDE-2.6 include path (DDE26_INCDIR)' DDE26_INCDIR '$(OBJ_BASE)/include/$(ARCH)/l4/dde_linux26 $(DROPS_STDDIR)/include/$(ARCH)/l4/dde_linux26 $(OBJ_BASE)/include/l4/dde_linux26 $(DROPS_STDDIR)/include/l4/dde_linux26'
    string 'SDL include path (SDL_INCDIR)' SDL_INCDIR '$(OBJ_BASE)/include/l4/sdl $(DROPS_STDDIR)/include/l4/sdl'
    if [ "$BUILD_SYSTEMS_x86_l4secv2emu" = "y" ] ; then
      string 'Fiasco build directory (FIASCO_DIR)' FIASCO_DIR '$(L4DIR)/kernel/fiasco/build_test/'
    fi
  endmenu
endmenu
