Subversion Repositories Kolibri OS

Rev

Rev 4097 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. # General rule for naming: variables with CAPITALIZED names hold settings,
  2. # you can - and are expected - to modify it; variables with lowercase names
  3. # are intermediate variables and macroses not to be modified unless you
  4. # know what you're doing.
  5.  
  6. # Define directories for destination, source repository, sources of kernel, sources of programs.
  7. BUILD_DIR:=build
  8. REPOSITORY:=../..
  9. KERNEL:=$(REPOSITORY)/kernel/trunk
  10. PROGS:=$(REPOSITORY)/programs
  11.  
  12. # The main goal: build kolibri.img, kolibri.iso and list for creating a distribution kit
  13. all: $(BUILD_DIR)/kolibri.img $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/distr.lst
  14.  
  15. # Docpak requires some documents; we place them
  16. # into 'docs' subdir and communicate with FASM
  17. # through environment var DOCDIR.
  18. DOCDIR:=docs/
  19. export DOCDIR
  20.  
  21. # Because most programs are written in FASM and have
  22. # the common structure of one main .asm file possibly including
  23. # several .inc files, we handle this case separately.
  24. # Namely, we organize one big list of such programs
  25. # (FASM_PROGRAMS, see below) containing name of local binary file,
  26. # name of file inside kolibri.img and name of the source file.
  27. # This list is maintained by hand, and the rest is done with some macroses...
  28. # well, slightly complicated macroses - however, you do not need to
  29. # understand them in order to maintain the list.
  30. # To add a FASM program with one .asm file, just
  31. # add the corresponding item to the list and enjoy
  32. # the power of GNU make.
  33.  
  34. # The list of all FASM programs with one main FASM file.
  35. # Every item consists of three parts, separated by ':'.
  36. # First part is the real name of binary file in $(BUILD_DIR)
  37. # as it should be produced by make.
  38. # Second part is the name of a file inside kolibri.img,
  39. # usually uppercased version of first part - to save space
  40. # for FAT filesystem.
  41. # Third part is the name of the source file.
  42. # Spaces separate items, so spaces in names should be
  43. # represented as '|'.
  44. FASM_PROGRAMS:=\
  45.  @clip:@CLIP:$(PROGS)/system/clip/trunk/@clip.ASM \
  46.  @menu:@MENU:$(PROGS)/system/menu/trunk/menu.asm \
  47.  @panel:@PANEL:$(PROGS)/system/panel/trunk/@PANEL.ASM \
  48.  @ss:@SS:$(PROGS)/system/ss/trunk/@ss.asm \
  49.  refrscrn:REFRSCRN:$(PROGS)/system/refrscrn/refrscrn.asm \
  50.  asciivju:ASCIIVJU:$(PROGS)/develop/asciivju/trunk/asciivju.asm \
  51.  calc:CALC:$(PROGS)/other/calc/trunk/calc.asm \
  52.  calendar:CALENDAR:$(PROGS)/system/calendar/trunk/calendar.asm \
  53.  colrdial:COLRDIAL:$(PROGS)/system/colrdial/color_dialog.asm \
  54.  commouse:COMMOUSE:$(PROGS)/system/commouse/trunk/commouse.asm \
  55.  cpu:CPU:$(PROGS)/system/cpu/trunk/cpu.asm \
  56.  cpuid:CPUID:$(PROGS)/system/cpuid/trunk/CPUID.ASM \
  57.  desktop:DESKTOP:$(PROGS)/system/desktop/trunk/desktop.asm \
  58.  disptest:DISPTEST:$(PROGS)/system/disptest/trunk/disptest.ASM \
  59.  docpack:DOCPACK:$(PROGS)/system/docpack/trunk/docpack.asm \
  60.  end:END:$(PROGS)/system/end/light/end.asm \
  61.  gmon:GMON:$(PROGS)/system/gmon/gmon.asm \
  62.  hdd_info:HDD_INFO:$(PROGS)/system/hdd_info/trunk/hdd_info.asm \
  63.  @icon:@ICON:$(PROGS)/system/icon_new/@icon.asm \
  64.  cropflat:CROPFLAT:$(PROGS)/system/cropflat/cropflat.asm \
  65.  kbd:KBD:$(PROGS)/system/kbd/trunk/kbd.ASM \
  66.  kpack:KPACK:$(PROGS)/other/kpack/trunk/kpack.asm \
  67.  launcher:LAUNCHER:$(PROGS)/system/launcher/trunk/launcher.asm \
  68.  magnify:MAGNIFY:$(PROGS)/demos/magnify/trunk/magnify.asm \
  69.  mgb:MGB:$(PROGS)/system/mgb/trunk/mgb.asm \
  70.  mousemul:MOUSEMUL:$(PROGS)/system/mousemul/trunk/mousemul.asm \
  71.  madmouse:MADMOUSE:$(PROGS)/other/madmouse/madmouse.asm \
  72.  mykey:MYKEY:$(PROGS)/system/MyKey/trunk/MyKey.asm \
  73.  pcidev:PCIDEV:$(PROGS)/system/pcidev/trunk/PCIDEV.ASM \
  74.  period:PERIOD:$(PROGS)/other/period/trunk/period.asm \
  75.  rdsave:RDSAVE:$(PROGS)/system/rdsave/trunk/rdsave.asm \
  76.  rtfread:RTFREAD:$(PROGS)/other/rtfread/trunk/rtfread.asm \
  77.  run:RUN:$(PROGS)/system/run/trunk/run.asm \
  78.  searchap:SEARCHAP:$(PROGS)/system/searchap/searchap.asm \
  79.  scrshoot:SCRSHOOT:$(PROGS)/media/scrshoot/scrshoot.asm \
  80.  setup:SETUP:$(PROGS)/system/setup/trunk/setup.asm \
  81.  test:TEST:$(PROGS)/system/test/trunk/test.asm \
  82.  tinypad:TINYPAD:$(PROGS)/develop/tinypad/trunk/tinypad.asm \
  83.  zkey:ZKEY:$(PROGS)/system/zkey/trunk/ZKEY.ASM \
  84.  3d/3dsheart:3D/3DSHEART:$(PROGS)/demos/3dsheart/trunk/3dsheart.asm \
  85.  3d/3dwav:3D/3DWAV:$(PROGS)/demos/3dwav/trunk/3dwav.asm \
  86.  3d/crownscr:3D/CROWNSCR:$(PROGS)/demos/crownscr/trunk/crownscr.asm  \
  87.  3d/free3d04:3D/FREE3D04:$(PROGS)/demos/free3d04/trunk/free3d04.asm \
  88.  3d/view3ds:3D/VIEW3DS:$(PROGS)/demos/3DS/VIEW3DS.ASM \
  89.  demos/bcdclk:DEMOS/BCDCLK:$(PROGS)/demos/bcdclk/trunk/bcdclk.asm \
  90.  demos/circle:DEMOS/CIRCLE:$(PROGS)/develop/examples/circle/trunk/circle.asm \
  91.  demos/colorref:DEMOS/COLORREF:$(PROGS)/demos/colorref/trunk/colorref.asm \
  92.  demos/cslide:DEMOS/CSLIDE:$(PROGS)/demos/cslide/trunk/cslide.asm \
  93.  demos/eyes:DEMOS/EYES:$(PROGS)/demos/eyes/trunk/eyes.asm \
  94.  demos/firework:DEMOS/FIREWORK:$(PROGS)/demos/firework/trunk/firework.asm \
  95.  demos/movback:DEMOS/MOVBACK:$(PROGS)/demos/movback/trunk/movback.asm \
  96.  demos/plasma:DEMOS/PLASMA:$(PROGS)/demos/plasma/trunk/plasma.asm \
  97.  demos/tinyfrac:DEMOS/TINYFRAC:$(PROGS)/demos/tinyfrac/trunk/tinyfrac.asm \
  98.  demos/trantest:DEMOS/TRANTEST:$(PROGS)/demos/trantest/trunk/trantest.asm \
  99.  demos/tube:DEMOS/TUBE:$(PROGS)/demos/tube/trunk/tube.asm \
  100.  demos/unvwater:DEMOS/UNVWATER:$(PROGS)/demos/unvwater/trunk/unvwater.asm \
  101.  demos/web:DEMOS/WEB:$(PROGS)/demos/web/trunk/web.asm \
  102.  develop/board:DEVELOP/BOARD:$(PROGS)/system/board/trunk/board.asm \
  103.  develop/cObj:DEVELOP/cObj:$(PROGS)/develop/cObj/trunk/cObj.asm \
  104.  develop/fasm:DEVELOP/FASM:$(PROGS)/develop/fasm/trunk/fasm.asm \
  105.  develop/h2d2b:DEVELOP/H2D2B:$(PROGS)/develop/h2d2b/trunk/h2d2b.asm \
  106.  develop/heed:DEVELOP/HEED:$(PROGS)/develop/heed/trunk/heed.asm \
  107.  develop/keyascii:DEVELOP/KEYASCII:$(PROGS)/develop/keyascii/trunk/keyascii.asm \
  108.  develop/mtdbg:DEVELOP/MTDBG:$(PROGS)/develop/mtdbg/mtdbg.asm \
  109.  develop/scancode:DEVELOP/SCANCODE:$(PROGS)/develop/scancode/trunk/scancode.asm \
  110.  develop/t_edit:DEVELOP/T_EDIT:$(PROGS)/other/t_edit/t_edit.asm \
  111.  develop/test_gets:DEVELOP/test_gets:$(PROGS)/develop/libraries/console/examples/test_gets.asm \
  112.  develop/testcon2:DEVELOP/TESTCON2:$(PROGS)/develop/libraries/console/examples/testcon2.asm \
  113.  develop/thread:DEVELOP/THREAD:$(PROGS)/develop/examples/thread/trunk/thread.asm \
  114.  develop/info/asm.syn:DEVELOP/INFO/ASM.SYN:$(PROGS)/other/t_edit/info/asm_syn.asm \
  115.  develop/info/cpp_kol_cla.syn:DEVELOP/INFO/CPP_KOL_CLA.SYN:$(PROGS)/other/t_edit/info/cpp_kol_cla_syn.asm \
  116.  develop/info/cpp_kol_dar.syn:DEVELOP/INFO/CPP_KOL_DAR.SYN:$(PROGS)/other/t_edit/info/cpp_kol_dar_syn.asm \
  117.  develop/info/cpp_kol_def.syn:DEVELOP/INFO/CPP_KOL_DEF.SYN:$(PROGS)/other/t_edit/info/cpp_kol_def_syn.asm \
  118.  develop/info/default.syn:DEVELOP/INFO/DEFAULT.SYN:$(PROGS)/other/t_edit/info/default_syn.asm \
  119.  develop/info/html.syn:DEVELOP/INFO/HTML.SYN:$(PROGS)/other/t_edit/info/html_syn.asm \
  120.  develop/info/ini_files.syn:DEVELOP/INFO/INI_FILES.SYN:$(PROGS)/other/t_edit/info/ini_files_syn.asm \
  121.  develop/info/win_const.syn:DEVELOP/INFO/WIN_CONST.SYN:$(PROGS)/other/t_edit/info/win_const_syn.asm \
  122.  drivers/com_mouse.obj:DRIVERS/COM_MOUSE.OBJ:$(KERNEL)/drivers/com_mouse.asm \
  123.  drivers/emu10k1x.obj:DRIVERS/EMU10K1X.OBJ:$(KERNEL)/drivers/emu10k1x.asm \
  124.  drivers/fm801.obj:DRIVERS/FM801.OBJ:$(KERNEL)/drivers/fm801.asm \
  125.  drivers/infinity.obj:DRIVERS/INFINITY.OBJ:$(KERNEL)/drivers/infinity.asm \
  126.  drivers/intel_hda.obj:DRIVERS/intel_hda.obj:$(REPOSITORY)/drivers/audio/intel_hda/intel_hda.asm \
  127.  drivers/ps2mouse.obj:DRIVERS/PS2MOUSE.OBJ:$(REPOSITORY)/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm \
  128.  drivers/sb16.obj:DRIVERS/SB16.OBJ:$(KERNEL)/drivers/sb16/sb16.asm \
  129.  drivers/sound.obj:DRIVERS/SOUND.OBJ:$(KERNEL)/drivers/sound.asm \
  130.  drivers/intelac97.obj:DRIVERS/INTELAC97.OBJ:$(KERNEL)/drivers/intelac97.asm \
  131.  drivers/tmpdisk.obj:DRIVERS/TMPDISK.OBJ:$(KERNEL)/drivers/tmpdisk.asm \
  132.  drivers/usbhid.obj:DRIVERS/USBHID.OBJ:$(KERNEL)/drivers/usbhid/usbhid.asm \
  133.  drivers/usbstor.obj:DRIVERS/USBSTOR.OBJ:$(KERNEL)/drivers/usbstor.asm \
  134.  drivers/vt823x.obj:DRIVERS/VT823X.OBJ:$(KERNEL)/drivers/vt823x.asm \
  135.  drivers/vidintel.obj:DRIVERS/VIDINTEL.OBJ:$(KERNEL)/drivers/vidintel.asm \
  136.  drivers/3c59x.obj:DRIVERS/3C59X.obj:$(REPOSITORY)/drivers/ethernet/3c59x.asm \
  137.  drivers/dec21x4x.obj:DRIVERS/DEC21X4X.obj:$(REPOSITORY)/drivers/ethernet/dec21x4x.asm \
  138.  drivers/forcedeth.obj:DRIVERS/FORCEDETH.obj:$(REPOSITORY)/drivers/ethernet/forcedeth.asm \
  139.  drivers/i8254x.obj:DRIVERS/I8254X.obj:$(REPOSITORY)/drivers/ethernet/i8254x.asm \
  140.  drivers/i8255x.obj:DRIVERS/I8255X.obj:$(REPOSITORY)/drivers/ethernet/i8255x.asm \
  141.  drivers/mtd80x.obj:DRIVERS/MTD80X.obj:$(REPOSITORY)/drivers/ethernet/mtd80x.asm \
  142.  drivers/pcnet32.obj:DRIVERS/PCNET32.obj:$(REPOSITORY)/drivers/ethernet/pcnet32.asm \
  143.  drivers/r6040.obj:DRIVERS/R6040.obj:$(REPOSITORY)/drivers/ethernet/R6040.asm \
  144.  drivers/rhine.obj:DRIVERS/RHINE.obj:$(REPOSITORY)/drivers/ethernet/rhine.asm \
  145.  drivers/rtl8029.obj:DRIVERS/RTL8029.obj:$(REPOSITORY)/drivers/ethernet/RTL8029.asm \
  146.  drivers/rtl8139.obj:DRIVERS/RTL8139.obj:$(REPOSITORY)/drivers/ethernet/RTL8139.asm \
  147.  drivers/rtl8169.obj:DRIVERS/RTL8169.obj:$(REPOSITORY)/drivers/ethernet/RTL8169.asm \
  148.  drivers/sis900.obj:DRIVERS/SIS900.obj:$(REPOSITORY)/drivers/ethernet/sis900.asm \
  149.  File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \
  150.  File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \
  151.  File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \
  152.  games/15:GAMES/15:$(PROGS)/games/15/trunk/15.ASM \
  153.  games/arcanii:GAMES/ARCANII:$(PROGS)/games/arcanii/trunk/arcanii.asm \
  154.  games/freecell:GAMES/FREECELL:$(PROGS)/games/freecell/freecell.asm \
  155.  games/gomoku:GAMES/GOMOKU:$(PROGS)/games/gomoku/trunk/gomoku.asm \
  156.  games/invaders:GAMES/INVADERS:$(PROGS)/games/invaders/invaders.asm \
  157.  games/klavisha:GAMES/KLAVISHA:$(PROGS)/games/klavisha/trunk/klavisha.asm \
  158.  games/lines:GAMES/LINES:$(PROGS)/games/lines/lines.asm \
  159.  games/mblocks:GAMES/MBLOCKS:$(PROGS)/games/mblocks/trunk/mblocks.asm \
  160.  games/msquare:GAMES/MSQUARE:$(PROGS)/games/MSquare/trunk/MSquare.asm \
  161.  games/phenix:GAMES/PHENIX:$(PROGS)/games/phenix/trunk/phenix.asm \
  162.  games/pipes:GAMES/PIPES:$(PROGS)/games/pipes/pipes.asm \
  163.  games/pong:GAMES/PONG:$(PROGS)/games/pong/trunk/pong.asm \
  164.  games/pong3:GAMES/PONG3:$(PROGS)/games/pong3/trunk/pong3.asm \
  165.  games/rsquare:GAMES/RSQUARE:$(PROGS)/games/rsquare/trunk/rsquare.asm \
  166.  games/snake:GAMES/SNAKE:$(PROGS)/games/snake/trunk/snake.asm \
  167.  games/sq_game:GAMES/SQ_GAME:$(PROGS)/games/sq_game/trunk/SQ_GAME.ASM \
  168.  games/sudoku:GAMES/SUDOKU:$(PROGS)/games/sudoku/trunk/sudoku.asm \
  169.  games/sw:GAMES/SW:$(PROGS)/games/sw/trunk/sw.asm \
  170.  games/tanks:GAMES/TANKS:$(PROGS)/games/tanks/trunk/tanks.asm \
  171.  games/tetris:GAMES/TETRIS:$(PROGS)/games/tetris/trunk/tetris.asm \
  172.  lib/archiver.obj:LIB/ARCHIVER.OBJ:$(PROGS)/fs/kfar/trunk/kfar_arc/kfar_arc.asm \
  173.  lib/box_lib.obj:LIB/BOX_LIB.OBJ:$(PROGS)/develop/libraries/box_lib/trunk/box_lib.asm \
  174.  lib/buf2d.obj:LIB/BUF2D.OBJ:$(PROGS)/develop/libraries/buf2d/trunk/buf2d.asm \
  175.  lib/console.obj:LIB/CONSOLE.OBJ:$(PROGS)/develop/libraries/console/console.asm \
  176.  lib/libgfx.obj:LIB/LIBGFX.OBJ:$(PROGS)/develop/libraries/libs-dev/libgfx/libgfx.asm \
  177.  lib/libimg.obj:LIB/LIBIMG.OBJ:$(PROGS)/develop/libraries/libs-dev/libimg/libimg.asm \
  178.  lib/libini.obj:LIB/LIBINI.OBJ:$(PROGS)/develop/libraries/libs-dev/libini/libini.asm \
  179.  lib/libio.obj:LIB/LIBIO.OBJ:$(PROGS)/develop/libraries/libs-dev/libio/libio.asm \
  180.  lib/network.obj:LIB/NETWORK.OBJ:$(PROGS)/develop/libraries/network/network.asm \
  181.  lib/proc_lib.obj:LIB/PROC_LIB.OBJ:$(PROGS)/develop/libraries/proc_lib/trunk/proc_lib.asm \
  182.  lib/cnv_png.obj:LIB/CNV_PNG.OBJ:$(PROGS)/media/zsea/plugins/png/cnv_png.asm \
  183.  media/animage:MEDIA/ANIMAGE:$(PROGS)/media/animage/trunk/animage.asm \
  184.  media/cdp:MEDIA/CDP:$(PROGS)/media/cdp/trunk/cdp.asm \
  185.  media/kiv:MEDIA/KIV:$(PROGS)/media/kiv/trunk/kiv.asm \
  186.  media/listplay:MEDIA/LISTPLAY:$(PROGS)/media/listplay/trunk/listplay.asm \
  187.  media/midamp:MEDIA/MIDAMP:$(PROGS)/media/midamp/trunk/midamp.asm \
  188.  media/palitra:MEDIA/PALITRA:$(PROGS)/media/palitra/trunk/palitra.asm \
  189.  media/startmus:MEDIA/STARTMUS:$(PROGS)/media/startmus/trunk/STARTMUS.ASM \
  190.  network/ping:NETWORK/PING:$(PROGS)/network/icmp/ping.asm \
  191.  network/netcfg:NETWORK/NETCFG:$(PROGS)/network/netcfg/netcfg.asm \
  192.  network/netstat:NETWORK/NETSTAT:$(PROGS)/network/netstat/netstat.asm \
  193.  network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/network/nslookup/nslookup.asm \
  194.  network/synergyc:NETWORK/SYNERGYC:$(PROGS)/network/synergyc/synergyc.asm \
  195.  network/tcpserv:NETWORK/TCPSERV:$(PROGS)/network/tcpserv/tcpserv.asm \
  196.  network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/telnet.asm \
  197.  network/zeroconf:NETWORK/ZEROCONF:$(PROGS)/network/zeroconf/zeroconf.asm \
  198.  network/ftpc:NETWORK/FTPC:$(PROGS)/network/ftpc/ftpc.asm \
  199.  network/ftpd:NETWORK/FTPD:$(PROGS)/network/ftpd/ftpd.asm \
  200.  network/tftpc:NETWORK/TFTPC:$(PROGS)/network/tftpc/tftpc.asm \
  201.  network/ircc:NETWORK/IRCC:$(PROGS)/network/ircc/ircc.asm \
  202.  network/downloader:NETWORK/DOWNLOADER:$(PROGS)/network/downloader/downloader.asm \
  203. # end of list
  204. # The list of all FASM programs with one main FASM file for CD image.
  205. # Format of an item is exactly the same as in the previous list.
  206. FASM_PROGRAMS_CD:=\
  207.  drivers/atikms:DRIVERS/ATIKMS:$(REPOSITORY)/drivers/video/drm/radeon/atikms.asm \
  208.  distr_data/zsea:DISTR_DATA/ZSEA:$(PROGS)/media/zsea/zSea.asm \
  209.  distr_data/cnv_bmp.obj:DISTR_DATA/CNV_BMP.OBJ:$(PROGS)/media/zsea/plugins/bmp/cnv_bmp.asm \
  210.  distr_data/cnv_gif.obj:DISTR_DATA/CNV_GIF.OBJ:$(PROGS)/media/zsea/plugins/gif/cnv_gif.asm \
  211.  distr_data/cnv_jpeg.obj:DISTR_DATA/CNV_JPEG.OBJ:$(PROGS)/media/zsea/plugins/jpeg/cnv_jpeg.asm \
  212.  distr_data/convert.obj:DISTR_DATA/CONVERT.OBJ:$(PROGS)/media/zsea/plugins/convert/convert.asm \
  213.  distr_data/rotate.obj:DISTR_DATA/ROTATE.OBJ:$(PROGS)/media/zsea/plugins/rotate/rotate.asm \
  214.  distr_data/scaling.obj:DISTR_DATA/SCALING.OBJ:$(PROGS)/media/zsea/plugins/scaling/scaling.asm \
  215. # end of list
  216.  
  217. # The list of all FASM programs which needs to be compiled without KPACKing.
  218. FASM_NOKPACK_PROGRAMS:=\
  219.  distr_data/9x2klbr.exe:-:$(PROGS)/hd_load/9x2klbr/9x2klbr.asm \
  220.  distr_data/MeOSload.com:-:$(PROGS)/hd_load/meosload/MeOSload.asm \
  221.  distr_data/mtldr:-:$(PROGS)/hd_load/mtldr/mtldr.asm \
  222.  mtldr_for_installer:-:$(PROGS)/hd_load/mtldr_install/mtldr_code/mtldr.asm \
  223.  distr_data/mtldr_install.exe:-:$(PROGS)/hd_load/mtldr_install/mtldr_install.asm \
  224.  distr_data/MeOSload_for_usb_boot_old.com:-:$(PROGS)/hd_load/usb_boot_old/MeOSload.asm \
  225.  distr_data/enable_for_usb_boot_old.exe:-:$(PROGS)/hd_load/usb_boot_old/enable.asm \
  226.  distr_data/BOOT_F32.BIN:-:$(PROGS)/hd_load/usb_boot/BOOT_F32.ASM \
  227.  distr_data/MTLD_F32:-:$(PROGS)/hd_load/usb_boot/mtldr.asm \
  228.  distr_data/inst.exe:-:$(PROGS)/hd_load/usb_boot/inst.asm \
  229.  distr_data/setmbr.exe:-:$(PROGS)/hd_load/usb_boot/setmbr.asm \
  230. #end of list
  231.  
  232. # The list of all NASM programs with one main NASM file.
  233. # Format of an item is exactly the same as in the previous list.
  234. NASM_PROGRAMS:=\
  235.  demos/aclock:DEMOS/ACLOCK:$(PROGS)/demos/aclock/trunk/aclock.asm \
  236.  demos/timer:DEMOS/TIMER:$(PROGS)/other/Timer/Timer.asm \
  237.  games/c4:GAMES/C4:$(PROGS)/games/c4/trunk/c4.asm \
  238. # end of list
  239.  
  240. # The list of files which should be copied from somewhere.
  241. # Format of an item is exactly the same as in the previous list.
  242. COPY_FILES:=\
  243.  macros.inc:MACROS.INC:$(PROGS)/macros.inc \
  244.  config.inc:CONFIG.INC:$(PROGS)/config.inc \
  245.  struct.inc:STRUCT.INC:$(PROGS)/struct.inc \
  246.  develop/te_icon.png:DEVELOP/TE_ICON.PNG:$(PROGS)/other/t_edit/te_icon.png \
  247.  develop/tl_nod_16.png:DEVELOP/TL_NOD_16.PNG:$(PROGS)/other/t_edit/tl_nod_16.png \
  248.  develop/tl_sys_16.png:DEVELOP/TL_SYS_16.PNG:$(PROGS)/media/log_el/trunk/tl_sys_16.png \
  249.  develop/t_edit.ini:DEVELOP/T_EDIT.INI:$(PROGS)/other/t_edit/t_edit.ini \
  250.  File|Managers/z_icons.png:File|Managers/Z_ICONS.PNG:$(PROGS)/fs/opendial/z_icons.png \
  251.  File|Managers/kfm_keys.txt:File|Managers/KFM_KEYS.TXT:$(PROGS)/fs/kfm/trunk/docs/russian/dos_kolibri/kfm_keys.txt \
  252.  File|Managers/buttons.bmp:File|Managers/BUTTONS.BMP:$(PROGS)/fs/kfm/trunk/buttons.bmp \
  253.  File|Managers/icons.bmp:File|Managers/ICONS.BMP:$(PROGS)/fs/kfm/trunk/icons.bmp \
  254.  fonts/litt.chr:FONTS/LITT.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/LITT.CHR \
  255.  games/snake.ini:GAMES/SNAKE.INI:$(PROGS)/games/snake/trunk/snake.ini \
  256.  media/kiv.ini:MEDIA/KIV.INI:$(PROGS)/media/kiv/trunk/kiv.ini \
  257.  .shell:.shell:$(PROGS)/system/shell/bin/rus/.shell \
  258.  settings/mykey.ini:SETTINGS/MYKEY.INI:$(PROGS)/system/MyKey/trunk/mykey.ini \
  259.  example.asm:EXAMPLE.ASM:$(PROGS)/develop/examples/example/trunk/rus/example.asm \
  260. # end of list
  261.  
  262. # The list of all C-- programs with one main C-- file.
  263. # Format of an item is exactly the same as in the previous list,
  264. # except that there can be fourth field with parameters for a compiler.
  265. CMM_PROGRAMS:=\
  266.  File|Managers/eolite:File|Managers/EOLITE:$(PROGS)/cmm/eolite/Eolite.c \
  267.  games/clicks:GAMES/CLICKS:$(PROGS)/games/clicks/trunk/clicks.c \
  268.  games/FindNumbers:GAMES/FindNumbers:$(PROGS)/games/FindNumbers/trunk/FindNumbers.c-- \
  269.  games/flood-it:GAMES/flood-it:$(PROGS)/games/flood-it/trunk/flood-it.c \
  270.  games/mine:GAMES/MINE:$(PROGS)/games/mine/trunk/mine.c--:/MEOS \
  271.  HTMLv:HTMLv:$(PROGS)/cmm/browser/HTMLv.c \
  272.  tmpdisk:tmpdisk:$(PROGS)/cmm/tmpdisk/tmpdisk.c \
  273.  @notify:@notify:$(PROGS)/cmm/notify/notify.c \
  274. # end of list
  275.  
  276. # List of other files to be included in the image file.
  277. # Some of them are auto-built with special rules, some just exist before build.
  278. # Each item is of the form <local name>:<name inside image>.
  279. # Spaces should be represented as |.
  280. #
  281. # yogev_ezra: Removed '3dsheart' to free some space on RAMDISK. This demo has 90% in common with VIEW3DS
  282. OTHER_FILES:=settings/autorun.dat:SETTINGS/AUTORUN.DAT \
  283.  default.skn:DEFAULT.SKN \
  284.  graph:GRAPH hdread:HDREAD \
  285.  settings/icon.ini:SETTINGS/ICON.INI \
  286.  iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \
  287.  kernel.mnt:KERNEL.MNT kerpack:KERPACK \
  288.  settings/keymap.key:SETTINGS/KEYMAP.KEY \
  289.  settings/lang.ini:SETTINGS/LANG.INI \
  290.  kuzkina.mid:KUZKINA.MID lang.inc:LANG.INC \
  291.  settings/menu.dat:SETTINGS/MENU.DAT \
  292.  settings/kolibri.lbl:SETTINGS/KOLIBRI.LBL \
  293.  settings/panel.ini:SETTINGS/PANEL.INI pipetka:PIPETKA \
  294.  settings/setup.dat:SETTINGS/SETUP.DAT \
  295.  shell:SHELL table:TABLE vmode:VMODE \
  296.  3d/cubeline:3D/CUBELINE 3d/gears:3D/GEARS 3d/house.3ds:3D/HOUSE.3DS \
  297.  demos/ak47.lif:DEMOS/AK47.LIF demos/life2:DEMOS/LIFE2 \
  298.  demos/relay.lif:DEMOS/RELAY.LIF demos/rpento.lif:DEMOS/RPENTO.LIF \
  299.  demos/use_mb:DEMOS/USE_MB \
  300.  File|Managers/eolite.ini:File|Managers/EOLITE.INI \
  301.  File|Managers/icons.ini:File|Managers/ICONS.INI \
  302.  File|Managers/kfar.ini:File|Managers/KFAR.INI \
  303.  File|Managers/kfm.ini:File|Managers/KFM.INI \
  304.  games/appdata.dat:GAMES/APPDATA.DAT games/ataka:GAMES/ATAKA \
  305.  games/basekurs.kla:GAMES/BASEKURS.KLA games/checkers:GAMES/CHECKERS \
  306.  games/megamaze:GAMES/MEGAMAZE games/padenie:GAMES/PADENIE \
  307.  games/reversi:GAMES/REVERSI games/rforces:GAMES/RFORCES \
  308.  games/whowtbam:GAMES/WHOWTBAM games/xonix:GAMES/XONIX \
  309.  games/kosilka:GAMES/KOSILKA \
  310.  lib/msgbox.obj:LIB/MSGBOX.OBJ \
  311.  lib/pixlib.obj:LIB/PIXLIB.OBJ lib/sort.obj:LIB/SORT.OBJ \
  312.  media/ac97snd:MEDIA/AC97SND \
  313.  ../common/media/ImgF/ImgF:MEDIA/ImgF/ImgF \
  314.  ../common/media/ImgF/cEdg.obj:MEDIA/ImgF/cEdg.obj \
  315.  ../common/media/ImgF/dither.obj:MEDIA/ImgF/dither.obj \
  316.  ../common/media/ImgF/invSol.obj:MEDIA/ImgF/invSol.obj \
  317.  network.ini:NETWORK.INI \
  318.  network/ftpd.ini:NETWORK/FTPD.INI \
  319.  network/users.ini:NETWORK/USERS.INI \
  320. #end of list
  321. #3d/logio.bmp:3D/LOGIO.BMP 3d/cubetext:3D/CUBETEXT
  322.  
  323. # Generate skins list understandable by gnu make
  324. Makefile.skins: $(REPOSITORY)/skins/authors.txt $(REPOSITORY)/data/generate_makefile_skins.sh
  325.         cut -f1 $< | $(SHELL) $(REPOSITORY)/data/generate_makefile_skins.sh > $@
  326. include Makefile.skins
  327.  
  328. # Extra targets for the distribution kit and LiveCD image in the syntax of mkisofs
  329. EXTRA:=\
  330.  emu/e80/e80=e80 \
  331.  emu/dosbox/=$(PROGS)/emulator/DosBox/dosbox \
  332.  emu/dosbox/=$(PROGS)/emulator/DosBox/dosbox.conf \
  333.  emu/dosbox/=$(PROGS)/emulator/DosBox/readme.txt \
  334.  /=distr_data/autorun.inf \
  335.  /=distr_data/KolibriOS_icon.ico \
  336.  Skins/=$(REPOSITORY)/skins/authors.txt \
  337.  Docs/cp866/config.txt=docs/CONFIG.TXT \
  338.  Docs/cp866/gnu.txt=docs/GNU.TXT \
  339.  Docs/cp866/history.txt=docs/HISTORY.TXT \
  340.  Docs/cp866/hot_keys.txt=docs/HOT_KEYS.TXT \
  341.  Docs/cp866/install.txt=docs/INSTALL.TXT \
  342.  Docs/cp866/readme.txt=docs/README.TXT \
  343.  Docs/cp866/sysfuncr.txt=docs/SYSFUNCR.TXT \
  344.  Docs/cp1251/config.txt=docs/CONFIG.WIN.TXT \
  345.  Docs/cp1251/gnu.txt=docs/GNU.WIN.TXT \
  346.  Docs/cp1251/history.txt=docs/HISTORY.WIN.TXT \
  347.  Docs/cp1251/hot_keys.txt=docs/HOT_KEYS.WIN.TXT \
  348.  Docs/cp1251/install.txt=docs/INSTALL.WIN.TXT \
  349.  Docs/cp1251/readme.txt=docs/README.WIN.TXT \
  350.  Docs/cp1251/sysfuncr.txt=docs/SYSFUNCR.WIN.TXT \
  351.  Docs/stack.txt=docs/STACK.TXT \
  352.  HD_Load/9x2klbr/=distr_data/9x2klbr.exe \
  353.  HD_Load/9x2klbr/=../common/HD_load/9x2klbr/LDKLBR.VXD \
  354.  HD_Load/9x2klbr/=$(PROGS)/hd_load/9x2klbr/readme_dos.txt \
  355.  HD_Load/9x2klbr/=$(PROGS)/hd_load/9x2klbr/readme_win.txt \
  356.  HD_Load/MeOSLoad/=distr_data/MeOSload.com \
  357.  HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/AUTOEXEC.BAT \
  358.  HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/CONFIG.SYS \
  359.  HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/L_readme.txt \
  360.  HD_Load/MeOSLoad/=$(PROGS)/hd_load/meosload/L_readme_Win.txt \
  361.  HD_Load/mtldr/=distr_data/mtldr \
  362.  HD_Load/mtldr/=$(PROGS)/hd_load/mtldr/install.txt \
  363.  HD_Load/mtldr/=$(PROGS)/hd_load/mtldr/vista_install.bat \
  364.  HD_Load/mtldr/=$(PROGS)/hd_load/mtldr/vista_remove.bat \
  365.  HD_Load/=distr_data/mtldr_install.exe \
  366.  HD_Load/memdisk=../common/HD_load/memdisk \
  367.  HD_Load/USB_Boot/=distr_data/BOOT_F32.BIN \
  368.  HD_Load/USB_Boot/=distr_data/MTLD_F32 \
  369.  HD_Load/USB_Boot/=distr_data/inst.exe \
  370.  HD_Load/USB_Boot/=distr_data/setmbr.exe \
  371.  HD_Load/USB_Boot/=$(PROGS)/hd_load/usb_boot/readme.txt \
  372.  HD_Load/USB_boot_old/=$(PROGS)/hd_load/usb_boot_old/usb_boot.rtf \
  373.  HD_Load/USB_boot_old/=$(PROGS)/hd_load/usb_boot_old/usb_boot_866.txt \
  374.  HD_Load/USB_boot_old/=$(PROGS)/hd_load/usb_boot_old/usb_boot_1251.txt \
  375.  HD_Load/USB_boot_old/MeOSload.com=distr_data/MeOSload_for_usb_boot_old.com \
  376.  HD_Load/USB_boot_old/enable.exe=distr_data/enable_for_usb_boot_old.exe \
  377.  games/fceu=../common/games/fceu \
  378.  games/pig=../common/games/pig \
  379.  games/soko/soko=games/soko \
  380.  games/soko=../common/games/soko/ \
  381.  games/lrl=../common/games/lrl \
  382.  games/lrl.hsr=../common/games/lrl.hsr \
  383.  games/lrl.lev=../common/games/lrl.lev \
  384.  games/fara=games/fara \
  385.  games/fara.gfx=../common/games/fara.gfx \
  386.  kolibrios/media/fplay-full=../common/media/fplay-full \
  387.  kolibrios/media/zsea/zsea=distr_data/zsea \
  388.  kolibrios/media/zsea/plugins/cnv_bmp.obj=distr_data/cnv_bmp.obj \
  389.  kolibrios/media/zsea/plugins/cnv_gif.obj=distr_data/cnv_gif.obj \
  390.  kolibrios/media/zsea/plugins/cnv_jpeg.obj=distr_data/cnv_jpeg.obj \
  391.  kolibrios/media/zsea/plugins/convert.obj=distr_data/convert.obj \
  392.  kolibrios/media/zsea/plugins/rotate.obj=distr_data/rotate.obj \
  393.  kolibrios/media/zsea/plugins/scaling.obj=distr_data/scaling.obj \
  394.  kolibrios/media/zsea/zsea.ini=$(REPOSITORY)/programs/media/zsea/zSea.ini \
  395.  kolibrios/media/zsea/zsea_keys.txt=$(REPOSITORY)/programs/media/zsea/Docs/zSea_keys_rus.txt \
  396.  kolibrios/media/zsea/buttons/buttons.png=$(REPOSITORY)/programs/media/zsea/buttons.png \
  397. #end of list
  398. DISTRIBUTION_EXTRA:=\
  399.  $(EXTRA) \
  400.  /readme.txt=distr_data/readme_distr.txt \
  401.  /readme_dos.txt=distr_data/readme_dos_distr.txt \
  402.  /kolibri.lbl=settings/kolibri.lbl \
  403. #end of list
  404. MKISOFS_EXTRA:=\
  405.  $(EXTRA) \
  406.  /=distr_data/readme.txt \
  407.  /=distr_data/readme_dos.txt \
  408.  /=settings/kolibri.lbl \
  409. #end of list
  410.  
  411. # Text files which need to be recoded to cp1251 from native aka cp866
  412. RECODE_TEXT_FILES:=\
  413.   distr_data/readme.txt:distr_data/readme_dos.txt \
  414.   distr_data/readme_distr.txt:distr_data/readme_dos_distr.txt \
  415.   docs/CONFIG.WIN.TXT:docs/CONFIG.TXT \
  416.   docs/GNU.WIN.TXT:docs/GNU.TXT \
  417.   docs/HISTORY.WIN.TXT:docs/HISTORY.TXT \
  418.   docs/HOT_KEYS.WIN.TXT:docs/HOT_KEYS.TXT \
  419.   docs/INSTALL.WIN.TXT:docs/INSTALL.TXT \
  420.   docs/README.WIN.TXT:docs/README.TXT \
  421.   docs/SYSFUNCR.WIN.TXT:docs/SYSFUNCR.TXT \
  422. #end of list
  423.  
  424. # Some macro for convenient work.
  425. # Macros for replacing '|' to escaped space '\ '.
  426. space:=\ #plus space
  427. respace=$(subst |,$(space),$(1))
  428. # Macro for selecting different parts of ':'-separated items.
  429. binarypart=$(word 1,$(subst :, ,$(1)))
  430. imagepart=$(word 2,$(subst :, ,$(1)))
  431. sourcepart=$(word 3,$(subst :, ,$(1)))
  432. parampart=$(word 4,$(subst :, ,$(1)))
  433. # Get file names, possibly with spaces inside, from an item.
  434. # Here $(f) is an item - in fact, macro argument.
  435. fbinary=$(call respace,$(call binarypart,$(f)))
  436. fimage=$(call respace,$(call imagepart,$(f)))
  437. fsource=$(call respace,$(call sourcepart,$(f)))
  438. fparam=$(call respace,$(call parampart,$(f)))
  439.  
  440. # Define targets for image file.
  441. # Join all the lists above.
  442. targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS)
  443. # For each item in the united list call fbinary.
  444. targets:=$(foreach f,$(targets_full),$(fbinary))
  445.  
  446. # Define a command for copying a file inside the image.
  447. # mcopy_command is a macro with two parameters,
  448. # local file name $(1) and image file name $(2).
  449. # Note that spaces in these have to be escaped with backslashes.
  450. mcopy_command=mcopy -moi $(BUILD_DIR)/kolibri.img $(1) ::$(2)
  451. # Specialize a previous command for an item $(f) in one of lists.
  452. mcopy_item_command=$(call mcopy_command,$(fbinary),$(fimage))
  453.  
  454. # Join all $(mcopy_item_command) for all items,
  455. # append newline after each item.
  456. # The first newline character after "define" line and
  457. # the last newline character before "endef" line get away
  458. # with define/endef, so we make three newline characters,
  459. # that is two empty lines, in order to get one in $(newline).
  460. define newline
  461.  
  462.  
  463. endef
  464. mcopy_all_items:=$(foreach f,$(targets_full),$(mcopy_item_command)$(newline))
  465.  
  466. # add skins to MKISOFS_EXTRA and DISTRIBUTION_EXTRA
  467. allskins:=$(foreach f,$(SKIN_SOURCES),$(call imagepart,$(f))=$(call binarypart,$(f)))
  468. MKISOFS_EXTRA:=$(MKISOFS_EXTRA) $(allskins)
  469. DISTRIBUTION_EXTRA:=$(DISTRIBUTION_EXTRA) $(allskins)
  470. # dependencies of MKISOFS_EXTRA; we iterate through $(MKISOFS_EXTRA),
  471. # substitute "=" with space, get the 2nd word and join all results
  472. mkisofs_extra_targets:=$(call respace,$(foreach f,$(MKISOFS_EXTRA),$(word 2,$(subst =, ,$(f)))))
  473. distribution_extra_targets:=$(call respace,$(foreach f,$(DISTRIBUTION_EXTRA),$(word 2,$(subst =, ,$(f)))))
  474.  
  475. # Define a command for creating a symlink for an item in DISTRIBUTION_EXTRA.
  476. extra_item_dst=distribution_kit/$(word 1,$(subst =, ,$(f)))
  477. extra_item_src=$(word 2,$(subst =, ,$(f)))
  478. makelink_item_command=$(if $(notdir $(extra_item_src)), \
  479.  ln -sr $(extra_item_src) $(extra_item_dst), \
  480.  ln -sr $(extra_item_src)* $(extra_item_dst) \
  481.  )
  482. # Join all $(makelink_command) for all items from DISTRIBUTION_EXTRA.
  483. make_distribution_links:=$(foreach f,$(DISTRIBUTION_EXTRA),$(makelink_item_command)$(newline))
  484. # Define a command for creating all directories for DISTRIBUTION_EXTRA.
  485. # Note that $(sort) removes duplicate entries.
  486. distribution_dirs:=$(sort $(foreach f,$(DISTRIBUTION_EXTRA),$(dir distribution_kit/$(word 1,$(subst =, ,$(f))))))
  487. make_distribution_dirs:=$(foreach f,$(distribution_dirs),mkdir -p $(f)$(newline))
  488.  
  489. # The first goal: floppy image.
  490. $(BUILD_DIR)/kolibri.img: $(BUILD_DIR)/.dir \
  491.  Makefile \
  492.  $(BUILD_DIR)/boot_fat12.bin \
  493.  $(targets)
  494.         str=`LANG=ru_RU.utf8 date -u +"[автосборка %d %b %Y %R, r$(REV)]"|iconv -f utf8 -t cp866`; \
  495.         echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null
  496.         dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1
  497.         mformat -f 1440 -i $(BUILD_DIR)/kolibri.img ::
  498.         dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1
  499.         mmd -i $(BUILD_DIR)/kolibri.img ::3D
  500.         mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS
  501.         mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP
  502.         mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO
  503.         mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS
  504.         mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers
  505.         mmd -i $(BUILD_DIR)/kolibri.img ::FONTS
  506.         mmd -i $(BUILD_DIR)/kolibri.img ::GAMES
  507.         mmd -i $(BUILD_DIR)/kolibri.img ::LIB
  508.         mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA
  509.         mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA/ImgF
  510.         mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK
  511.         mmd -i $(BUILD_DIR)/kolibri.img ::SETTINGS
  512.         $(mcopy_all_items)
  513.  
  514. # The second goal: LiveCD image.
  515. $(BUILD_DIR)/kolibri.iso: $(BUILD_DIR)/kolibri.img $(mkisofs_extra_targets)
  516.         mkisofs -U -J -pad -b kolibri.img -c boot.catalog -hide-joliet boot.catalog -graft-points \
  517.         -A "KolibriOS AutoBuilder" -p "CleverMouse" -publisher "KolibriOS Team" -V "KolibriOS r$(REV)" -sysid "KOLIBRI" \
  518.         -iso-level 3 -o $(BUILD_DIR)/kolibri.iso $(BUILD_DIR)/kolibri.img $(call respace,$(MKISOFS_EXTRA)) 2>&1
  519.  
  520. # The third goal: distribution list.
  521. $(BUILD_DIR)/distr.lst: $(BUILD_DIR)/kolibri.img $(distribution_extra_targets)
  522.         rm -rf distribution_kit
  523.         $(call respace,$(make_distribution_dirs))
  524.         ln -sr $(BUILD_DIR)/kolibri.img distribution_kit/kolibri.img
  525.         $(call respace,$(make_distribution_links))
  526.         touch $(BUILD_DIR)/distr.lst
  527.  
  528. # Special targets to modify behaviour of make.
  529. .DELETE_ON_ERROR:
  530. .SUFFIXES: # disable all predefined rules
  531.  
  532. # The floppy bootsector.
  533. $(BUILD_DIR)/boot_fat12.bin: $(KERNEL)/bootloader/boot_fat12.asm $(KERNEL)/bootloader/floppy1440.inc
  534.         fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin
  535.  
  536. $(BUILD_DIR)/.dir 3d/.dir demos/.dir develop/.dir develop/info/.dir drivers/.dir fonts/.dir \
  537.  games/.dir lib/.dir media/.dir network/.dir allskins/.dir distr_data/.dir .deps/.dir:
  538.         mkdir -p $(dir $@)
  539.         touch $@
  540. develop/info/.dir: develop/.dir
  541. File\ Managers/.dir:
  542.         mkdir -p "File Managers"
  543.         touch "File Managers/.dir"
  544.  
  545. # extra dependency for mtldr_install.exe
  546. distr_data/mtldr_install.exe: mtldr_for_installer
  547.  
  548. # FASM black magic goes to Makefile.fasm.
  549. include Makefile.fasm
  550.  
  551. # Similar for NASM.
  552. include Makefile.nasm
  553.  
  554. # Similar for copying files.
  555. include Makefile.copy
  556.  
  557. # Special rules for copying sysfuncr.txt - it isn't directly included in the image.
  558. docpack: $(DOCDIR)SYSFUNCR.TXT
  559. $(DOCDIR)SYSFUNCR.TXT: $(KERNEL)/docs/sysfuncr.txt
  560.         iconv -f utf-8 -t cp866 $(KERNEL)/docs/sysfuncr.txt > $(DOCDIR)SYSFUNCR.TXT
  561.  
  562. # Similar for C--.
  563. include Makefile.cmm
  564.  
  565. # Recode some text files from native encoding aka cp866 to cp1251
  566. define recode_meta_rule
  567. $(1): $(2)
  568.         iconv -f cp866 -t cp1251 "$$<" > "$$@"
  569. endef
  570. $(foreach f, $(RECODE_TEXT_FILES), $(eval $(call recode_meta_rule,$(fbinary),$(fimage))))
  571.  
  572. # Sorry, even black magic seems to be insufficient for
  573. # auto-handling all subtle effects. So we just define
  574. # command lines for compiling and linking, and
  575. # maintain the list of sources and objects by hand.
  576. include Makefile.msvc
  577.  
  578. # Rules for table
  579. table: .obj.table/table.exe
  580.         $(msvc_final)
  581. TABLE_OBJECTS:=.obj.table/calc.obj .obj.table/func.obj .obj.table/hello.obj \
  582.  .obj.table/KosFile.obj .obj.table/kosSyst.obj .obj.table/math2.obj \
  583.  .obj.table/mcsmemm.obj .obj.table/parser.obj
  584. TABLE_H_FILES:=$(wildcard $(PROGS)/other/table/*.h)
  585. .obj.table/table.exe: $(TABLE_OBJECTS)
  586.         $(msvc_link)
  587. $(TABLE_OBJECTS): .obj.table/%.obj: $(PROGS)/other/table/%.cpp $(TABLE_H_FILES) Makefile.msvc | .obj.table
  588.         $(msvc_compile)
  589. .obj.table:
  590.         mkdir -p .obj.table
  591.  
  592. # Rules for graph
  593. graph: .obj.graph/graph.exe
  594.         $(msvc_final)
  595. GRAPH_CPP_OBJECTS:=.obj.graph/func.obj .obj.graph/hello.obj .obj.graph/kolibri.obj \
  596.  .obj.graph/KosFile.obj .obj.graph/kosSyst.obj .obj.graph/math2.obj \
  597.  .obj.graph/mcsmemm.obj .obj.graph/parser.obj
  598. GRAPH_C_OBJECTS:=.obj.graph/string.obj
  599. GRAPH_H_FILES:=$(wildcard $(PROGS)/other/graph/*.h)
  600. GRAPH_FASM_OBJECTS:=.obj.graph/memcpy.obj .obj.graph/memset.obj
  601. .obj.graph/graph.exe: $(GRAPH_CPP_OBJECTS) $(GRAPH_C_OBJECTS) $(GRAPH_FASM_OBJECTS)
  602.         $(msvc_link)
  603. $(GRAPH_CPP_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.cpp $(GRAPH_H_FILES) Makefile.msvc | .obj.graph
  604.         $(msvc_compile)
  605. $(GRAPH_C_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.c $(GRAPH_H_FILES) Makefile.msvc | .obj.graph
  606.         $(msvc_compile)
  607. $(GRAPH_FASM_OBJECTS): .obj.graph/%.obj: $(PROGS)/other/graph/%.asm Makefile.msvc | .obj.graph
  608.         fasm $< $@
  609. .obj.graph:
  610.         mkdir -p .obj.graph
  611.  
  612. # Rules for kosilka
  613. games/kosilka: .obj.kosilka/kosilka.exe
  614.         $(msvc_final)
  615. KOSILKA_OBJECTS:=.obj.kosilka/kosilka.obj .obj.kosilka/KosFile.obj .obj.kosilka/kosSyst.obj .obj.kosilka/mcsmemm.obj
  616. KOSILKA_H_FILES:=$(PROGS)/games/kosilka/*.h
  617. .obj.kosilka/kosilka.exe: $(KOSILKA_OBJECTS)
  618.         $(msvc_link)
  619. $(KOSILKA_OBJECTS): .obj.kosilka/%.obj: $(PROGS)/games/kosilka/%.cpp $(KOSILKA_H_FILES) Makefile.msvc | .obj.kosilka
  620.         $(msvc_compile)
  621. .obj.kosilka:
  622.         mkdir -p .obj.kosilka
  623.  
  624. include Makefile.gcc
  625.  
  626. # Rules for shell
  627. shell: .obj.shell/start.o .obj.shell/shell.o .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o \
  628.  $(PROGS)/system/shell/kolibri.ld
  629.         $(call gcc_link,$(PROGS)/system/shell/kolibri.ld)
  630. .obj.shell/shell.o: $(PROGS)/system/shell/shell.c \
  631.  $(PROGS)/system/shell/all.h \
  632.  $(PROGS)/system/shell/system/*.h \
  633.  $(PROGS)/system/shell/cmd/*.c \
  634.  $(PROGS)/system/shell/modules/*.c \
  635.  $(PROGS)/system/shell/locale/rus/globals.h \
  636.  Makefile.gcc | .obj.shell
  637.         $(gcc_compile)
  638. .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o: .obj.shell/%.o: \
  639.  $(PROGS)/system/shell/system/%.c $(PROGS)/system/shell/system/*.h \
  640.  Makefile.gcc | .obj.shell
  641.         $(gcc_compile)
  642. .obj.shell/start.o: $(PROGS)/system/shell/start.asm | .obj.shell
  643.         fasm $< $@
  644. .obj.shell:
  645.         mkdir -p .obj.shell
  646.  
  647. # Rules for e80
  648. E80DIR=$(PROGS)/emulator/e80/trunk
  649. e80: .obj.e80/start.o .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o .obj.e80/z80.o .obj.e80/e80.o
  650.         $(call gcc_link,$(E80DIR)/kolibri.ld)
  651. .obj.e80/e80.o: $(E80DIR)/e80.c $(E80DIR)/48.h \
  652.  $(E80DIR)/system/*.h $(E80DIR)/system/msgbox.c \
  653.  $(E80DIR)/z80/z80.h Makefile.gcc | .obj.e80
  654.         $(gcc_compile)
  655. .obj.e80/kolibri.o .obj.e80/stdlib.o .obj.e80/string.o: .obj.e80/%.o: \
  656.  $(E80DIR)/system/%.c $(E80DIR)/system/*.h Makefile.gcc | .obj.e80
  657.         $(gcc_compile)
  658. .obj.e80/z80.o: $(E80DIR)/z80/z80.c $(E80DIR)/z80/*
  659.         $(gcc_compile)
  660. .obj.e80/start.o: $(E80DIR)/asm_code.asm | .obj.e80
  661.         fasm $< $@
  662. .obj.e80:
  663.         mkdir -p .obj.e80
  664.  
  665. # Rules for sdk/sound, used by media/ac97snd
  666. SOUNDDIR=$(PROGS)/develop/sdk/trunk/sound/src
  667. SOUND_OBJECTS:=$(patsubst $(SOUNDDIR)/%.asm,.sdk/%.obj,$(wildcard $(SOUNDDIR)/*.asm))
  668. SOUND_INC_FILES:=$(wildcard $(SOUNDDIR)/*.inc)
  669. .sdk/sound.lib: $(SOUND_OBJECTS)
  670.         win32-link /lib /out:$@ $^
  671. $(SOUND_OBJECTS): .sdk/%.obj: $(SOUNDDIR)/%.asm $(SOUND_INC_FILES) | .sdk
  672.         fasm $< $@
  673. .sdk:
  674.         mkdir -p .sdk
  675. # Rules for media/ac97snd
  676. AC97DIR=$(PROGS)/media/ac97snd
  677. media/ac97snd: .obj.ac97snd/ac97snd.exe
  678.         $(msvc_final)
  679. .obj.ac97snd/ac97snd.exe: .obj.ac97snd/ac97wav.obj .obj.ac97snd/crt.obj .obj.ac97snd/k_lib.obj \
  680.         .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj
  681.         $(msvc_link)
  682. .obj.ac97snd/ac97wav.obj: $(AC97DIR)/ac97snd/ac97wav.c \
  683.         $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \
  684.         $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd
  685.         $(msvc_compile)
  686. .obj.ac97snd/crt.obj: $(AC97DIR)/ac97snd/crt.c $(AC97DIR)/ac97snd/crt.h Makefile.msvc | .obj.ac97snd
  687.         $(msvc_compile)
  688. .obj.ac97snd/k_lib.obj: $(AC97DIR)/ac97snd/k_lib.asm $(AC97DIR)/ac97snd/proc32.inc | .obj.ac97snd
  689.         fasm $< $@
  690. .obj.ac97snd/ufmod.obj: $(AC97DIR)/ufmod-config.asm | .obj.ac97snd
  691.         fasm $< $@ -s .deps/ac97snd-ufmod.fas
  692.         prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \
  693.         perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \
  694.         -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po
  695. -include .deps/ac97snd-ufmod.Po
  696. AC97SND_MPG_C_FILES:=$(wildcard $(AC97DIR)/mpg/*.c)
  697. AC97SND_MPG_H_FILES:=$(wildcard $(AC97DIR)/mpg/*.h)
  698. AC97SND_MPG_C_OBJECTS:=$(patsubst $(AC97DIR)/mpg/%.c,.obj.ac97snd/%.o,$(AC97SND_MPG_C_FILES))
  699. .obj.ac97snd/mpg.lib: $(AC97SND_MPG_C_OBJECTS) .obj.ac97snd/pow.obj
  700.         win32-link /lib /ltcg /out:$@ $^
  701. $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_FILES) Makefile.msvc | .obj.ac97snd
  702.         $(msvc_compile)
  703. .obj.ac97snd/pow.obj: $(AC97DIR)/mpg/pow.asm $(AC97DIR)/mpg/proc32.inc | .obj.ac97snd
  704.         fasm $< $@
  705. .obj.ac97snd:
  706.         mkdir -p .obj.ac97snd
  707.  
  708. # Rules for atikms.dll
  709. # Use Makefile from $(REPOSITORY)/drivers/ddk and $(REPOSITORY)/drivers/video/drm/radeon
  710. # However, dependencies must be duplicated - I don't know how to avoid this
  711. # without need to rebuild kolibri.img at every iteration...
  712. # Note that we are going to write in the directory shared
  713. # between all Makefiles, so we need locked operations.
  714. drivers/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll drivers/.dir
  715.         kpack --nologo $< $@
  716. $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: $(REPOSITORY)/drivers/video/drm/radeon/Makefile.lto
  717.         flock $(REPOSITORY)/drivers/video/drm/radeon/.lock \
  718.         $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/video/drm/radeon -f Makefile.lto
  719. $(REPOSITORY)/drivers/ddk/libddk.a: $(REPOSITORY)/drivers/ddk/Makefile
  720.         flock $(REPOSITORY)/drivers/ddk/.lock \
  721.         $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libddk.a
  722. $(REPOSITORY)/drivers/ddk/libcore.a: $(REPOSITORY)/drivers/ddk/Makefile
  723.         flock $(REPOSITORY)/drivers/ddk/.lock \
  724.         $(MAKE) CC=win32-gcc45 AS=win32-as LD=win32-ld AR=win32-ar FASM=fasm -C $(REPOSITORY)/drivers/ddk libcore.a
  725. # dependencies
  726. $(REPOSITORY)/drivers/video/drm/radeon/atikms.dll: \
  727.  $(REPOSITORY)/drivers/video/drm/radeon/atikms.lds \
  728.  $(REPOSITORY)/drivers/ddk/libddk.a \
  729.  $(REPOSITORY)/drivers/ddk/libcore.a \
  730.  $(REPOSITORY)/drivers/video/drm/radeon/*.[Sch] \
  731.  $(REPOSITORY)/drivers/video/drm/radeon/*.asm \
  732.  $(REPOSITORY)/drivers/video/drm/radeon/Makefile \
  733.  $(REPOSITORY)/drivers/video/drm/radeon/firmware/*.bin \
  734.  $(REPOSITORY)/drivers/include/*.h \
  735.  $(REPOSITORY)/drivers/include/*/*.h \
  736.  $(REPOSITORY)/drivers/include/*/*/*.h \
  737.  $(REPOSITORY)/drivers/include/*/*/*/*.h
  738. $(REPOSITORY)/drivers/ddk/libddk.a: \
  739.  $(REPOSITORY)/drivers/ddk/*/* \
  740.  $(REPOSITORY)/drivers/include/*.h \
  741.  $(REPOSITORY)/drivers/include/*/*.h \
  742.  $(REPOSITORY)/drivers/include/*/*/*.h \
  743.  $(REPOSITORY)/drivers/include/*/*/*/*.h
  744. $(REPOSITORY)/drivers/ddk/libcore.a: \
  745.  $(REPOSITORY)/drivers/ddk/core.S
  746.