Subversion Repositories Kolibri OS

Rev

Rev 3111 | 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/branches/net
  10. TRUNKKERNEL:=$(REPOSITORY)/kernel/trunk
  11. PROGS:=$(REPOSITORY)/programs
  12. NETPROGS:=$(REPOSITORY)/kernel/branches/net/applications
  13.  
  14. # Docpak requires some documents; we place them
  15. # into 'docs' subdir and communicate with FASM
  16. # through environment var DOCDIR.
  17. DOCDIR:=docs/
  18. export DOCDIR
  19.  
  20. # Because most programs are written in FASM and have
  21. # the common structure of one main .asm file possibly including
  22. # several .inc files, we handle this case separately.
  23. # Namely, we organize one big list of such programs
  24. # (FASM_PROGRAMS, see below) containing name of local binary file,
  25. # name of file inside kolibri.img and name of the source file.
  26. # This list is maintained by hand, and the rest is done with some macroses...
  27. # well, slightly complicated macroses - however, you do not need to
  28. # understand them in order to maintain the list.
  29. # To add a FASM program with one .asm file, just
  30. # add the corresponding item to the list and enjoy
  31. # the power of GNU make.
  32.  
  33. # The list of all FASM programs with one main FASM file.
  34. # Every item consists of three parts, separated by ':'.
  35. # First part is the real name of binary file in $(BUILD_DIR)
  36. # as it should be produced by make.
  37. # Second part is the name of a file inside kolibri.img,
  38. # usually uppercased version of first part - to save space
  39. # for FAT filesystem.
  40. # Third part is the name of the source file.
  41. # Spaces separate items, so spaces in names should be
  42. # represented as '|'.
  43. FASM_PROGRAMS:=\
  44.  @clip:@CLIP:$(PROGS)/system/clip/trunk/@clip.ASM \
  45.  @menu:@MENU:$(PROGS)/system/menu/trunk/menu.asm \
  46.  @ss:@SS:$(PROGS)/system/ss/trunk/@ss.asm\
  47.  refrscrn:REFRSCRN:$(PROGS)/system/refrscrn/refrscrn.asm \
  48.  asciivju:ASCIIVJU:$(PROGS)/develop/asciivju/trunk/asciivju.asm \
  49.  calc:CALC:$(PROGS)/other/calc/trunk/calc.asm \
  50.  calendar:CALENDAR:$(PROGS)/system/calendar/trunk/calendar.asm \
  51.  commouse:COMMOUSE:$(PROGS)/system/commouse/trunk/commouse.asm \
  52.  cpu:CPU:$(PROGS)/system/cpu/trunk/cpu.asm \
  53.  cpuid:CPUID:$(PROGS)/system/cpuid/trunk/CPUID.ASM \
  54.  desktop:DESKTOP:$(PROGS)/system/desktop/trunk/desktop.asm \
  55.  disptest:DISPTEST:$(PROGS)/system/disptest/trunk/disptest.ASM \
  56.  docpack:DOCPACK:$(PROGS)/system/docpack/trunk/docpack.asm \
  57.  end:END:$(PROGS)/system/end/light/end.asm \
  58.  gmon:GMON:$(PROGS)/system/gmon/gmon.asm \
  59.  hdd_info:HDD_INFO:$(PROGS)/system/hdd_info/trunk/hdd_info.asm \
  60.  icon:ICON:$(PROGS)/system/icon/trunk/icon.asm \
  61.  kbd:KBD:$(PROGS)/system/kbd/trunk/kbd.ASM \
  62.  kpack:KPACK:$(PROGS)/other/kpack/trunk/kpack.asm \
  63.  launcher:LAUNCHER:$(PROGS)/system/launcher/trunk/launcher.asm \
  64.  magnify:MAGNIFY:$(PROGS)/demos/magnify/trunk/magnify.asm \
  65.  mgb:MGB:$(PROGS)/system/mgb/trunk/mgb.asm \
  66.  mousemul:MOUSEMUL:$(PROGS)/system/mousemul/trunk/mousemul.asm \
  67.  madmouse:MADMOUSE:$(PROGS)/other/madmouse/madmouse.asm \
  68.  mykey:MYKEY:$(PROGS)/system/MyKey/trunk/MyKey.asm \
  69.  pcidev:PCIDEV:$(PROGS)/system/pcidev/trunk/PCIDEV.ASM \
  70.  rdsave:RDSAVE:$(PROGS)/system/rdsave/trunk/rdsave.asm \
  71.  rtfread:RTFREAD:$(PROGS)/other/rtfread/trunk/rtfread.asm \
  72.  run:RUN:$(PROGS)/system/run/trunk/run.asm \
  73.  scrshoot:SCRSHOOT:$(PROGS)/media/scrshoot/scrshoot.asm \
  74.  setup:SETUP:$(PROGS)/system/setup/trunk/setup.asm \
  75.  test:TEST:$(PROGS)/system/test/trunk/test.asm \
  76.  tinypad:TINYPAD:$(PROGS)/develop/tinypad/trunk/tinypad.asm \
  77.  zkey:ZKEY:$(PROGS)/system/zkey/trunk/ZKEY.ASM \
  78.  develop/board:DEVELOP/BOARD:$(PROGS)/system/board/trunk/board.asm \
  79.  develop/cObj:DEVELOP/cObj:$(PROGS)/develop/cObj/trunk/cObj.asm \
  80.  develop/fasm:DEVELOP/FASM:$(PROGS)/develop/fasm/trunk/fasm.asm \
  81.  develop/h2d2b:DEVELOP/H2D2B:$(PROGS)/develop/h2d2b/trunk/h2d2b.asm \
  82.  develop/heed:DEVELOP/HEED:$(PROGS)/develop/heed/trunk/heed.asm \
  83.  develop/ipc:DEVELOP/IPC:$(PROGS)/network/ipc/trunk/ipc.asm \
  84.  develop/keyascii:DEVELOP/KEYASCII:$(PROGS)/develop/keyascii/trunk/keyascii.asm \
  85.  develop/mtdbg:DEVELOP/MTDBG:$(PROGS)/develop/mtdbg/mtdbg.asm \
  86.  develop/scancode:DEVELOP/SCANCODE:$(PROGS)/develop/scancode/trunk/scancode.asm \
  87.  develop/t_edit:DEVELOP/T_EDIT:$(PROGS)/other/t_edit/t_edit.asm \
  88.  develop/test_gets:DEVELOP/test_gets:$(PROGS)/develop/libraries/console/examples/test_gets.asm \
  89.  develop/testcon2:DEVELOP/TESTCON2:$(PROGS)/develop/libraries/console/examples/testcon2.asm \
  90.  develop/thread:DEVELOP/THREAD:$(PROGS)/develop/examples/thread/trunk/thread.asm \
  91.  drivers/com_mouse.obj:DRIVERS/COM_MOUSE.OBJ:$(TRUNKKERNEL)/drivers/com_mouse.asm \
  92.  drivers/emu10k1x.obj:DRIVERS/EMU10K1X.OBJ:$(TRUNKKERNEL)/drivers/emu10k1x.asm \
  93.  drivers/fm801.obj:DRIVERS/FM801.OBJ:$(TRUNKKERNEL)/drivers/fm801.asm \
  94.  drivers/infinity.obj:DRIVERS/INFINITY.OBJ:$(TRUNKKERNEL)/drivers/infinity.asm \
  95.  drivers/ps2mouse.obj:DRIVERS/PS2MOUSE.OBJ:$(REPOSITORY)/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm \
  96.  drivers/sb16.obj:DRIVERS/SB16.OBJ:$(TRUNKKERNEL)/drivers/sb16/sb16.asm \
  97.  drivers/sound.obj:DRIVERS/SOUND.OBJ:$(TRUNKKERNEL)/drivers/sound.asm \
  98.  drivers/vt8235.obj:DRIVERS/VT8235.OBJ:$(TRUNKKERNEL)/drivers/vt823x.asm \
  99.  File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \
  100.  File|Managers/kfm:File|Managers/KFM:$(PROGS)/fs/kfm/trunk/kfm.asm \
  101.  File|Managers/opendial:File|Managers/OPENDIAL:$(PROGS)/fs/opendial/opendial.asm \
  102.  develop/info/asm.syn:DEVELOP/INFO/ASM.SYN:$(PROGS)/other/t_edit/info/asm_syn.asm \
  103.  develop/info/cpp_kol_cla.syn:DEVELOP/INFO/CPP_KOL_CLA.SYN:$(PROGS)/other/t_edit/info/cpp_kol_cla_syn.asm \
  104.  develop/info/cpp_kol_dar.syn:DEVELOP/INFO/CPP_KOL_DAR.SYN:$(PROGS)/other/t_edit/info/cpp_kol_dar_syn.asm \
  105.  develop/info/cpp_kol_def.syn:DEVELOP/INFO/CPP_KOL_DEF.SYN:$(PROGS)/other/t_edit/info/cpp_kol_def_syn.asm \
  106.  develop/info/default.syn:DEVELOP/INFO/DEFAULT.SYN:$(PROGS)/other/t_edit/info/default_syn.asm \
  107.  develop/info/html.syn:DEVELOP/INFO/HTML.SYN:$(PROGS)/other/t_edit/info/html_syn.asm \
  108.  develop/info/ini_files.syn:DEVELOP/INFO/INI_FILES.SYN:$(PROGS)/other/t_edit/info/ini_files_syn.asm \
  109.  develop/info/win_const.syn:DEVELOP/INFO/WIN_CONST.SYN:$(PROGS)/other/t_edit/info/win_const_syn.asm \
  110.  lib/archiver.obj:LIB/ARCHIVER.OBJ:$(PROGS)/fs/kfar/trunk/kfar_arc/kfar_arc.asm \
  111.  lib/box_lib.obj:LIB/BOX_LIB.OBJ:$(PROGS)/develop/libraries/box_lib/trunk/box_lib.asm \
  112.  lib/buf2d.obj:LIB/BUF2D.OBJ:$(PROGS)/develop/libraries/buf2d/trunk/buf2d.asm \
  113.  lib/console.obj:LIB/CONSOLE.OBJ:$(PROGS)/develop/libraries/console/console.asm \
  114.  lib/libgfx.obj:LIB/LIBGFX.OBJ:$(PROGS)/develop/libraries/libs-dev/libgfx/libgfx.asm \
  115.  lib/libimg.obj:LIB/LIBIMG.OBJ:$(PROGS)/develop/libraries/libs-dev/libimg/libimg.asm \
  116.  lib/libini.obj:LIB/LIBINI.OBJ:$(PROGS)/develop/libraries/libs-dev/libini/libini.asm \
  117.  lib/libio.obj:LIB/LIBIO.OBJ:$(PROGS)/develop/libraries/libs-dev/libio/libio.asm \
  118.  lib/proc_lib.obj:LIB/PROC_LIB.OBJ:$(PROGS)/develop/libraries/proc_lib/trunk/proc_lib.asm \
  119.  lib/cnv_png.obj:LIB/CNV_PNG.OBJ:$(PROGS)/media/zsea/plugins/png/cnv_png.asm \
  120.  media/animage:MEDIA/ANIMAGE:$(PROGS)/media/animage/trunk/animage.asm \
  121.  media/cdp:MEDIA/CDP:$(PROGS)/media/cdp/trunk/cdp.asm \
  122.  media/kiv:MEDIA/KIV:$(PROGS)/media/kiv/trunk/kiv.asm \
  123.  media/listplay:MEDIA/LISTPLAY:$(PROGS)/media/listplay/trunk/listplay.asm \
  124.  media/midamp:MEDIA/MIDAMP:$(PROGS)/media/midamp/trunk/midamp.asm \
  125.  media/palitra:MEDIA/PALITRA:$(PROGS)/media/palitra/trunk/palitra.asm \
  126.  media/startmus:MEDIA/STARTMUS:$(PROGS)/media/startmus/trunk/STARTMUS.ASM \
  127.  network/arpcfg:NETWORK/ARPCFG:$(NETPROGS)/arpcfg/arpcfg.asm \
  128.  network/ping:NETWORK/PING:$(NETPROGS)/icmp/ping.asm \
  129.  network/netcfg:NETWORK/NETCFG:$(NETPROGS)/netcfg/netcfg.asm \
  130.  network/netstat:NETWORK/NETSTAT:$(NETPROGS)/netstat/netstat.asm \
  131.  network/nslookup:NETWORK/NSLOOKUP:$(NETPROGS)/nslookup/nslookup.asm \
  132.  network/synergyc:NETWORK/SYNERGYC:$(NETPROGS)/synergyc/synergyc.asm \
  133.  network/tcpserv:NETWORK/TCPSERV:$(NETPROGS)/tcpserv/tcpserv.asm \
  134.  network/telnet:NETWORK/TELNET:$(NETPROGS)/telnet/telnet.asm \
  135.  network/zeroconf:NETWORK/ZEROCONF:$(NETPROGS)/zeroconf/zeroconf.asm \
  136.  network/ftpd:NETWORK/FTPD:$(NETPROGS)/ftpd/ftpd.asm \
  137.  lib/network.obj:LIB/NETWORK.OBJ:$(NETPROGS)/libraries/network/network.asm \
  138.  drivers/3c59x.obj:DRIVERS/3C59X.OBJ:$(KERNEL)/drivers/3c59x.asm \
  139.  drivers/dec21x4x.obj:DRIVERS/DEC21X4X.OBJ:$(KERNEL)/drivers/dec21x4x.asm \
  140.  drivers/i8255x.obj:DRIVERS/I8255X.OBJ:$(KERNEL)/drivers/i8255x.asm \
  141.  drivers/mtd80x.obj:DRIVERS/MTD80X.OBJ:$(KERNEL)/drivers/mtd80x.asm \
  142.  drivers/pcnet32.obj:DRIVERS/PCNET32.OBJ:$(KERNEL)/drivers/pcnet32.asm \
  143.  drivers/r6040.obj:DRIVERS/R6040.OBJ:$(KERNEL)/drivers/R6040.asm \
  144.  drivers/rtl8029.obj:DRIVERS/RTL8029.OBJ:$(KERNEL)/drivers/RTL8029.asm \
  145.  drivers/rtl8139.obj:DRIVERS/RTL8139.OBJ:$(KERNEL)/drivers/RTL8139.asm \
  146.  drivers/rtl8169.obj:DRIVERS/RTL8169.OBJ:$(KERNEL)/drivers/RTL8169.asm \
  147.  drivers/sis900.obj:DRIVERS/SIS900.OBJ:$(KERNEL)/drivers/sis900.asm \
  148.  drivers/i8254x.obj:DRIVERS/I8254X.OBJ:$(KERNEL)/drivers/i8254x.asm \
  149. # end of list
  150.  
  151. # The list of files which should be copied from somewhere.
  152. # Format of an item is exactly the same as in the previous list.
  153. COPY_FILES:=\
  154.  macros.inc:MACROS.INC:$(PROGS)/macros.inc \
  155.  config.inc:CONFIG.INC:$(PROGS)/config.inc \
  156.  struct.inc:STRUCT.INC:$(PROGS)/struct.inc \
  157.  develop/te_icon.png:DEVELOP/TE_ICON.PNG:$(PROGS)/other/t_edit/te_icon.png \
  158.  develop/tl_nod_16.png:DEVELOP/TL_NOD_16.PNG:$(PROGS)/other/t_edit/tl_nod_16.png \
  159.  develop/tl_sys_16.png:DEVELOP/TL_SYS_16.PNG:$(PROGS)/media/log_el/trunk/tl_sys_16.png \
  160.  develop/t_edit.ini:DEVELOP/T_EDIT.INI:$(PROGS)/other/t_edit/t_edit.ini \
  161.  File|Managers/z_icons.png:File|Managers/Z_ICONS.PNG:$(PROGS)/fs/opendial/z_icons.png \
  162.  File|Managers/kfm_keys.txt:File|Managers/KFM_KEYS.TXT:$(PROGS)/fs/kfm/trunk/docs/english/kfm_keys.txt \
  163.  File|Managers/buttons.bmp:File|Managers/BUTTONS.BMP:$(PROGS)/fs/kfm/trunk/buttons.bmp \
  164.  File|Managers/icons.bmp:File|Managers/ICONS.BMP:$(PROGS)/fs/kfm/trunk/icons.bmp \
  165.  media/kiv.ini:MEDIA/KIV.INI:$(PROGS)/media/kiv/trunk/kiv.ini \
  166.  .shell:.shell:$(PROGS)/system/shell/bin/eng/.shell \
  167.  mykey.ini:MYKEY.INI:$(PROGS)/system/MyKey/trunk/mykey.ini \
  168. # end of list
  169.  
  170. # The list of all C-- programs with one main C-- file.
  171. # Format of an item is exactly the same as in the previous list,
  172. # except that there can be fourth field with parameters for a compiler.
  173. CMM_PROGRAMS:=\
  174.  File|Managers/Eolite:File|Managers/EOLITE:$(PROGS)/fs/Eolite/trunk/Eolite.c-- \
  175.  HTMLv:HTMLv:$(PROGS)/cmm/browser/HTMLv.c \
  176.  tmpdisk:tmpdisk:$(PROGS)/cmm/tmpdisk/tmpdisk.c \
  177.  @notify:@notify:$(PROGS)/cmm/notify/notify.c \
  178.  @rb:@rb:$(PROGS)/cmm/rb/rb.c \
  179. #develop/c--:DEVELOP/C--:$(PROGS)/develop/c--/trunk/32.c-- \
  180. # end of list
  181.  
  182. # List of other files to be included in the image file.
  183. # Some of them are auto-built with special rules, some just exist before build.
  184. # Each item is of the form <local name>:<name inside image>.
  185. # Spaces should be represented as |.
  186. OTHER_FILES:=autorun.dat:AUTORUN.DAT \
  187.  @panel:@PANEL \
  188.  background.png:background.png default.skn:DEFAULT.SKN \
  189.  icons.dat:ICONS.DAT iconstrp.png:ICONSTRP.PNG index_htm:INDEX.HTM \
  190.  kernel.mnt:KERNEL.MNT kerpack:KERPACK keymap.key:KEYMAP.KEY \
  191.  lang.inc:LANG.INC lang.ini:LANG.INI \
  192.  menu.dat:MENU.DAT \
  193.  panel.ini:PANEL.INI setup.dat:SETUP.DAT \
  194.  shell:SHELL \
  195.  vmode:VMODE \
  196.  File|Managers/eolite.ini:File|Managers/EOLITE.INI \
  197.  File|Managers/icons.ini:File|Managers/ICONS.INI \
  198.  File|Managers/kfar.ini:File|Managers/KFAR.INI \
  199.  File|Managers/kfm.ini:File|Managers/KFM.INI \
  200.  fonts/char2.mt:FONTS/CHAR2.MT \
  201.  fonts/char.mt:FONTS/CHAR.MT \
  202.  lib/msgbox.obj:LIB/MSGBOX.OBJ \
  203.  lib/pixlib.obj:LIB/PIXLIB.OBJ lib/sort.obj:LIB/SORT.OBJ \
  204.  media/ac97snd:MEDIA/AC97SND \
  205.  network/zeroconf.ini:NETWORK/ZEROCONF.INI \
  206.  network/ftpd.ini:NETWORK/FTPD.INI \
  207.  network/users.ini:NETWORK/USERS.INI \
  208. #end of list
  209.  
  210. # Some macro for convenient work.
  211. # Macros for replacing '|' to escaped space '\ '.
  212. space:=\ #plus space
  213. respace=$(subst |,$(space),$(1))
  214. # Macro for selecting different parts of ':'-separated items.
  215. binarypart=$(word 1,$(subst :, ,$(1)))
  216. imagepart=$(word 2,$(subst :, ,$(1)))
  217. sourcepart=$(word 3,$(subst :, ,$(1)))
  218. parampart=$(word 4,$(subst :, ,$(1)))
  219. # Get file names, possibly with spaces inside, from an item.
  220. # Here $(f) is an item - in fact, macro argument.
  221. fbinary=$(call respace,$(call binarypart,$(f)))
  222. fimage=$(call respace,$(call imagepart,$(f)))
  223. fsource=$(call respace,$(call sourcepart,$(f)))
  224. fparam=$(call respace,$(call parampart,$(f)))
  225.  
  226. # Define targets for image file.
  227. # Join all the lists above.
  228. targets_full:=$(COPY_FILES) $(FASM_PROGRAMS) $(NASM_PROGRAMS) $(OTHER_FILES) $(CMM_PROGRAMS)
  229. # For each item in the united list call fbinary.
  230. targets:=$(foreach f,$(targets_full),$(fbinary))
  231.  
  232. # Define a command for copying a file inside the image.
  233. # mcopy_command is a macro with two parameters,
  234. # local file name $(1) and image file name $(2).
  235. # Note that spaces in these have to be escaped with backslashes.
  236. mcopy_command=mcopy -moi $(BUILD_DIR)/kolibri.img $(1) ::$(2)
  237. # Specialize a previous command for an item $(f) in one of lists.
  238. mcopy_item_command=$(call mcopy_command,$(fbinary),$(fimage))
  239.  
  240. # Join all $(mcopy_item_command) for all items,
  241. # append newline after each item.
  242. # The first newline character after "define" line and
  243. # the last newline character before "endef" line get away
  244. # with define/endef, so we make three newline characters,
  245. # that is two empty lines, in order to get one in $(newline).
  246. define newline
  247.  
  248.  
  249. endef
  250. mcopy_all_items:=$(foreach f,$(targets_full),$(mcopy_item_command)$(newline))
  251.  
  252. # dependencies of MKISOFS_EXTRA; we iterate through $(MKISOFS_EXTRA),
  253. # substitute "=" with space, get the 2nd word and join all results
  254. mkisofs_extra_targets:=$(foreach f,$(MKISOFS_EXTRA),$(word 2,$(subst =, ,$(f))))
  255.  
  256. # The main goal: build kolibri.img and kolibri.iso
  257. all: $(BUILD_DIR)/kolibri.img
  258.  
  259. # The first goal: floppy image.
  260. $(BUILD_DIR)/kolibri.img: $(BUILD_DIR)/.dir \
  261.  Makefile \
  262.  $(BUILD_DIR)/boot_fat12.bin \
  263.  $(targets)
  264. # SYSXTREE
  265. # 3d/CUBETEXT
  266. # 3d/LOGIO.BMP
  267.         str=`date -u +"[auto-build %d %b %Y %R, r$(REV)]"`; \
  268.         echo -n $$str|dd of=kernel.mnt bs=1 seek=`expr 279 - length "$$str"` conv=notrunc 2>/dev/null
  269.         dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 2>&1
  270.         mformat -f 1440 -i $(BUILD_DIR)/kolibri.img ::
  271.         dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc 2>&1
  272.         mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP
  273.         mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP/INFO
  274.         mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS
  275.         mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers
  276.         mmd -i $(BUILD_DIR)/kolibri.img ::FONTS
  277.         mmd -i $(BUILD_DIR)/kolibri.img ::LIB
  278.         mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA
  279.         mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK
  280.         $(mcopy_all_items)
  281.  
  282. # Special targets to modify behaviour of make.
  283. .DELETE_ON_ERROR:
  284. .SUFFIXES: # delete all predefined rules
  285.  
  286. # The floppy bootsector.
  287. $(BUILD_DIR)/boot_fat12.bin: $(TRUNKKERNEL)/bootloader/boot_fat12.asm $(TRUNKKERNEL)/bootloader/floppy1440.inc
  288.         fasm $(TRUNKKERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin
  289.  
  290. $(BUILD_DIR)/.dir develop/.dir develop/info/.dir drivers/.dir fonts/.dir \
  291.  lib/.dir media/.dir network/.dir .deps/.dir:
  292.         mkdir -p $(dir $@)
  293.         touch $@
  294. develop/info/.dir: develop/.dir
  295. File\ Managers/.dir:
  296.         mkdir -p "File Managers"
  297.         touch "File Managers/.dir"
  298.  
  299. # FASM black magic goes to Makefile.fasm.
  300. include Makefile.fasm
  301.  
  302. # Similar for NASM.
  303. include Makefile.nasm
  304.  
  305. # Similar for copying files.
  306. include Makefile.copy
  307.  
  308. # Special rules for copying sysfuncs.txt - it isn't directly included in the image.
  309. docpack: $(DOCDIR)SYSFUNCS.TXT
  310. $(DOCDIR)SYSFUNCS.TXT: $(TRUNKKERNEL)/docs/sysfuncs.txt
  311.         cp $(TRUNKKERNEL)/docs/sysfuncs.txt $(DOCDIR)SYSFUNCS.TXT
  312.  
  313. # Similar for C--.
  314. include Makefile.cmm
  315.  
  316. # Sorry, even black magic seems to be insufficient for
  317. # auto-handling all subtle effects. So we just define
  318. # command lines for compiling and linking, and
  319. # maintain the list of sources and objects by hand.
  320. include Makefile.msvc
  321. include Makefile.gcc
  322.  
  323. # Rules for shell
  324. 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 \
  325.  $(PROGS)/system/shell/kolibri.ld
  326.         $(call gcc_link,$(PROGS)/system/shell/kolibri.ld)
  327. .obj.shell/shell.o: $(PROGS)/system/shell/shell.c \
  328.  $(PROGS)/system/shell/all.h \
  329.  $(PROGS)/system/shell/system/*.h \
  330.  $(PROGS)/system/shell/cmd/*.c \
  331.  $(PROGS)/system/shell/modules/*.c \
  332.  $(PROGS)/system/shell/locale/rus/globals.h \
  333.  Makefile.gcc | .obj.shell
  334.         $(gcc_compile)
  335. .obj.shell/kolibri.o .obj.shell/stdlib.o .obj.shell/string.o .obj.shell/ctype.o: .obj.shell/%.o: \
  336.  $(PROGS)/system/shell/system/%.c $(PROGS)/system/shell/system/*.h \
  337.  Makefile.gcc | .obj.shell
  338.         $(gcc_compile)
  339.         win32-gcc -c -Os -o $@ $<
  340. .obj.shell/start.o: $(PROGS)/system/shell/start.asm | .obj.shell
  341.         fasm $< $@
  342. .obj.shell:
  343.         mkdir -p .obj.shell
  344.  
  345. # Rules for sdk/sound, used by media/ac97snd
  346. SOUNDDIR=$(PROGS)/develop/sdk/trunk/sound/src
  347. SOUND_OBJECTS:=$(patsubst $(SOUNDDIR)/%.asm,.sdk/%.obj,$(wildcard $(SOUNDDIR)/*.asm))
  348. SOUND_INC_FILES:=$(wildcard $(SOUNDDIR)/*.inc)
  349. .sdk/sound.lib: $(SOUND_OBJECTS)
  350.         win32-link /lib /out:$@ $^
  351. $(SOUND_OBJECTS): .sdk/%.obj: $(SOUNDDIR)/%.asm $(SOUND_INC_FILES) | .sdk
  352.         fasm $< $@
  353. .sdk:
  354.         mkdir -p .sdk
  355. # Rules for media/ac97snd
  356. AC97DIR=$(PROGS)/media/ac97snd
  357. media/ac97snd: .obj.ac97snd/ac97snd.exe
  358.         $(msvc_final)
  359. .obj.ac97snd/ac97snd.exe: .obj.ac97snd/ac97wav.obj .obj.ac97snd/crt.obj .obj.ac97snd/k_lib.obj \
  360.         .obj.ac97snd/mpg.lib .sdk/sound.lib .obj.ac97snd/ufmod.obj
  361.         $(msvc_link)
  362. .obj.ac97snd/ac97wav.obj: $(AC97DIR)/ac97snd/ac97wav.c \
  363.         $(AC97DIR)/kolibri.h $(AC97DIR)/ac97snd/ac97wav.h $(AC97DIR)/mpg/mpg123.h \
  364.         $(AC97DIR)/sound.h $(AC97DIR)/ufmod-codec.h Makefile.msvc | .obj.ac97snd
  365.         $(msvc_compile)
  366. .obj.ac97snd/crt.obj: $(AC97DIR)/ac97snd/crt.c $(AC97DIR)/ac97snd/crt.h Makefile.msvc | .obj.ac97snd
  367.         $(msvc_compile)
  368. .obj.ac97snd/k_lib.obj: $(AC97DIR)/ac97snd/k_lib.asm $(AC97DIR)/ac97snd/proc32.inc | .obj.ac97snd
  369.         fasm $< $@
  370. .obj.ac97snd/ufmod.obj: $(AC97DIR)/ufmod-config.asm | .obj.ac97snd
  371.         fasm $< $@ -s .deps/ac97snd-ufmod.fas
  372.         prepsrc .deps/ac97snd-ufmod.fas /dev/stdout | \
  373.         perl -n -e 's|\\|/|g;s| |\\ |g;push @a,$$1 if/^;include\\ \x27(.*?)\x27/;' \
  374.         -e 'END{$$a=join " \\\n ",@a;print "$@: $$a\n$$a:\n"}' > .deps/ac97snd-ufmod.Po
  375. -include .deps/ac97snd-ufmod.Po
  376. AC97SND_MPG_C_FILES:=$(wildcard $(AC97DIR)/mpg/*.c)
  377. AC97SND_MPG_H_FILES:=$(wildcard $(AC97DIR)/mpg/*.h)
  378. AC97SND_MPG_C_OBJECTS:=$(patsubst $(AC97DIR)/mpg/%.c,.obj.ac97snd/%.o,$(AC97SND_MPG_C_FILES))
  379. .obj.ac97snd/mpg.lib: $(AC97SND_MPG_C_OBJECTS) .obj.ac97snd/pow.obj
  380.         win32-link /lib /ltcg /out:$@ $^
  381. $(AC97SND_MPG_C_OBJECTS): .obj.ac97snd/%.o: $(AC97DIR)/mpg/%.c $(AC97SND_MPG_H_FILES) Makefile.msvc | .obj.ac97snd
  382.         $(msvc_compile)
  383. .obj.ac97snd/pow.obj: $(AC97DIR)/mpg/pow.asm $(AC97DIR)/mpg/proc32.inc | .obj.ac97snd
  384.         fasm $< $@
  385. .obj.ac97snd:
  386.         mkdir -p .obj.ac97snd
  387.