Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #!/bin/bash
  2.  
  3. app_name=fridge
  4. dir_path=/usr/local/kos32
  5. # 1 - static, 2 - dynamic.
  6. compile_mode=2
  7. # for app with gui (native, windows, posix).
  8. # for app with cui (console).
  9. subsys_arg='native'
  10.  
  11.  
  12. gcc_keys="-m32 -march=native -mtune=generic -std=c99 -c -O2 -fomit-frame-pointer -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32"
  13. ld_keys1="-static -nostdlib --subsystem $subsys_arg --image-base 0"
  14. ld_keys2="-call_shared -nostdlib --subsystem $subsys_arg --image-base 0"
  15.  
  16. path_to_headers="$dir_path/sdk/sources/newlib/libc/include"
  17. path_to_ldscript1="$dir_path/sdk/sources/newlib/static.lds"
  18. path_to_ldscript2="$dir_path/sdk/sources/newlib/app-dynamic.lds"
  19. path_to_libc="$dir_path/lib"
  20. path_to_libgcc="$dir_path/sdk/lib"
  21.  
  22. kos32-gcc  $gcc_keys -I $path_to_headers -o $app_name.o $app_name.c
  23.  
  24. case $compile_mode in
  25.   1) kos32-ld  $ld_keys1 -T $path_to_ldscript1 -Map=$app_name.map -L $path_to_libgcc -L $path_to_libc -o $app_name.kex $app_name.o -lc -lgcc -lc  ;;
  26.   2) kos32-ld  $ld_keys2 -T $path_to_ldscript2 -Map=$app_name.map -L $path_to_libgcc -L $path_to_libc  -o $app_name.kex $app_name.o -lgcc -lc.dll ;;
  27.   *) exit 1 ;;
  28. esac
  29.  
  30. kos32-strip  -s $app_name.kex -o $app_name.kex
  31. kos32-objcopy  $app_name.kex -O binary
  32. rm  $app_name.o
  33. rm  $app_name.map
  34.  
  35. exit 0
  36.