Rev 1737 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1737 | clevermous | 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 |
||
1739 | clevermous | 8 | REPOSITORY:=../.. |
1737 | clevermous | 9 | KERNEL:=$(REPOSITORY)/kernel/trunk |
10 | PROGS:=$(REPOSITORY)/programs |
||
11 | |||
12 | # Docpak requires some documents; we place them |
||
13 | # into 'docs' subdir and communicate with FASM |
||
14 | # through environment var DOCDIR. |
||
15 | DOCDIR:=docs/ |
||
16 | export DOCDIR |
||
17 | |||
18 | # Because most programs are written in FASM and have |
||
19 | # the common structure of one main .asm file possibly including |
||
20 | # several .inc files, we handle this case separately. |
||
21 | # Namely, we organize one big list of such programs |
||
22 | # (FASM_PROGRAMS, see below) containing name of local binary file, |
||
23 | # name of file inside kolibri.img and name of the source file. |
||
24 | # This list is maintained by hand, and the rest is done with some macroses... |
||
25 | # well, slightly complicated macroses - however, you do not need to |
||
26 | # understand them in order to maintain the list. |
||
27 | # To add a FASM program with one .asm file, just |
||
28 | # add the corresponding item to the list and enjoy |
||
29 | # the power of GNU make. |
||
30 | |||
31 | # The list of all FASM programs with one main FASM file. |
||
32 | # Every item consists of three parts, separated by ':'. |
||
33 | # First part is the real name of binary file in $(BUILD_DIR) |
||
34 | # as it should be produced by make. |
||
35 | # Second part is the name of a file inside kolibri.img, |
||
36 | # usually uppercased version of first part - to save space |
||
37 | # for FAT filesystem. |
||
38 | # Third part is the name of the source file. |
||
39 | # Spaces separate items, so spaces in names should be |
||
40 | # represented as '|'. |
||
41 | FASM_PROGRAMS:=\ |
||
42 | @clip:@CLIP:$(PROGS)/system/clip/trunk/@clip.ASM \ |
||
43 | @menu:@MENU:$(PROGS)/system/menu/trunk/menu.asm \ |
||
44 | @panel:@PANEL:$(PROGS)/system/panel/trunk/@PANEL.ASM \ |
||
45 | @rb:@RB:$(PROGS)/system/rb/trunk/@RB.ASM \ |
||
46 | @ss:@SS:$(PROGS)/system/ss/trunk/@SS.ASM \ |
||
47 | calc:CALC:$(PROGS)/other/calc/trunk/calc.asm \ |
||
48 | calendar:CALENDAR:$(PROGS)/system/calendar/trunk/calendar.asm \ |
||
49 | commouse:COMMOUSE:$(PROGS)/system/commouse/trunk/commouse.asm \ |
||
50 | copyr:COPYR:$(PROGS)/fs/copyr/trunk/copyr.asm \ |
||
51 | cpu:CPU:$(PROGS)/system/cpu/trunk/cpu.asm \ |
||
52 | cpuid:CPUID:$(PROGS)/system/cpuid/trunk/CPUID.ASM \ |
||
53 | desktop:DESKTOP:$(PROGS)/system/desktop/trunk/desktop.asm \ |
||
54 | disptest:DISPTEST:$(PROGS)/system/disptest/trunk/disptest.ASM \ |
||
55 | docpak:DOCPAK:$(PROGS)/system/docpack/trunk/docpack.asm \ |
||
56 | downloader:downloader:$(PROGS)/network/downloader/trunk/downloader.asm \ |
||
57 | end:END:$(PROGS)/system/end/trunk/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 | launcher:LAUNCHER:$(PROGS)/system/launcher/trunk/launcher.asm \ |
||
63 | magnify:MAGNIFY:$(PROGS)/demos/magnify/trunk/magnify.asm \ |
||
64 | mgb:MGB:$(PROGS)/system/mgb/trunk/mgb.asm \ |
||
65 | mousemul:MOUSEMUL:$(PROGS)/system/mousemul/trunk/mousemul.asm \ |
||
66 | pcidev:PCIDEV:$(PROGS)/system/pcidev/trunk/PCIDEV.ASM \ |
||
67 | period:PERIOD:$(PROGS)/other/period/trunk/period.asm \ |
||
68 | pic4:PIC4:$(PROGS)/media/pic4/trunk/pic4.asm \ |
||
69 | rdsave:RDSAVE:$(PROGS)/system/rdsave/trunk/rdsave.asm \ |
||
70 | rtfread:RTFREAD:$(PROGS)/other/rtfread/trunk/rtfread.asm \ |
||
71 | run:RUN:$(PROGS)/system/run/trunk/run.asm \ |
||
72 | scrshoot:SCRSHOOT:$(PROGS)/media/scrshoot/scrshoot.asm \ |
||
73 | setup:SETUP:$(PROGS)/system/setup/trunk/setup.asm \ |
||
74 | tinypad:TINYPAD:$(PROGS)/develop/tinypad/trunk/tinypad.asm \ |
||
75 | vrr:VRR:$(PROGS)/system/vrr/trunk/vrr.asm \ |
||
76 | vrr_m:VRR_M:$(PROGS)/system/vrr_m/trunk/vrr_m.asm \ |
||
77 | zkey:ZKEY:$(PROGS)/system/zkey/trunk/ZKEY.ASM \ |
||
78 | 3d/3dcube2:3D/3DCUBE2:$(PROGS)/demos/3dcube2/trunk/3DCUBE2.ASM \ |
||
79 | 3d/3dtcub10:3D/3DTCUB10:$(PROGS)/demos/3dtcub10/trunk/3DTCUB10.ASM \ |
||
80 | 3d/crownscr:3D/CROWNSCR:$(PROGS)/demos/crownscr/trunk/crownscr.asm \ |
||
81 | 3d/free3d04:3D/FREE3D04:$(PROGS)/demos/free3d04/trunk/free3d04.asm \ |
||
82 | 3d/view3ds:3D/VIEW3DS:$(PROGS)/demos/3DS/VIEW3DS.ASM \ |
||
83 | demos/bcdclk:DEMOS/BCDCLK:$(PROGS)/demos/bcdclk/bcdclk/bcdclk.asm \ |
||
84 | demos/circle:DEMOS/CIRCLE:$(PROGS)/develop/examples/circle/trunk/circle.asm \ |
||
85 | demos/colorref:DEMOS/COLORREF:$(PROGS)/demos/colorref/trunk/colorref.asm \ |
||
86 | demos/cslide:DEMOS/CSLIDE:$(PROGS)/demos/cslide/trunk/cslide.asm \ |
||
87 | demos/eyes:DEMOS/EYES:$(PROGS)/demos/eyes/trunk/eyes.asm \ |
||
88 | demos/fire:DEMOS/FIRE:$(PROGS)/demos/fire/trunk/fire.asm \ |
||
89 | demos/firework:DEMOS/FIREWORK:$(PROGS)/demos/firework/trunk/firework.asm \ |
||
90 | demos/movback:DEMOS/MOVBACK:$(PROGS)/demos/movback/trunk/movback.asm \ |
||
91 | demos/plasma:DEMOS/PLASMA:$(PROGS)/demos/plasma/trunk/plasma.asm \ |
||
92 | demos/timer:DEMOS/TIMER:$(PROGS)/demos/timer/trunk/timer.asm \ |
||
93 | demos/tinyfrac:DEMOS/TINYFRAC:$(PROGS)/demos/tinyfrac/trunk/tinyfrac.asm \ |
||
94 | demos/trantest:DEMOS/TRANTEST:$(PROGS)/demos/trantest/trunk/trantest.asm \ |
||
95 | demos/tube:DEMOS/TUBE:$(PROGS)/demos/tube/trunk/tube.asm \ |
||
96 | demos/unvwater:DEMOS/UNVWATER:$(PROGS)/demos/unvwater/trunk/unvwater.asm \ |
||
97 | develop/board:DEVELOP/BOARD:$(PROGS)/system/board/trunk/board.asm \ |
||
98 | develop/cObj:DEVELOP/cObj:$(PROGS)/develop/cObj/trunk/cObj.asm \ |
||
99 | develop/fasm:DEVELOP/FASM:$(PROGS)/develop/fasm/trunk/fasm.asm \ |
||
100 | develop/h2d2b:DEVELOP/H2D2B:$(PROGS)/develop/h2d2b/trunk/h2d2b.asm \ |
||
101 | develop/heed:DEVELOP/HEED:$(PROGS)/develop/heed/trunk/heed.asm \ |
||
102 | develop/ipc:DEVELOP/IPC:$(PROGS)/network/ipc/trunk/ipc.asm \ |
||
103 | develop/keyascii:DEVELOP/KEYASCII:$(PROGS)/develop/keyascii/trunk/keyascii.asm \ |
||
104 | develop/mtdbg:DEVELOP/MTDBG:$(PROGS)/develop/mtdbg/mtdbg.asm \ |
||
105 | develop/scancode:DEVELOP/SCANCODE:$(PROGS)/develop/scancode/trunk/scancode.asm \ |
||
106 | develop/test_gets:DEVELOP/test_gets:$(PROGS)/develop/libraries/console/examples/test_gets.asm \ |
||
107 | develop/testcon2:DEVELOP/TESTCON2:$(PROGS)/develop/libraries/console/examples/testcon2.asm \ |
||
108 | develop/thread:DEVELOP/THREAD:$(PROGS)/develop/examples/thread/trunk/thread.asm \ |
||
109 | drivers/atikms:DRIVERS/ATIKMS:$(REPOSITORY)/drivers/video/drm/radeon/atikms.asm \ |
||
110 | drivers/com_mouse.obj:DRIVERS/COM_MOUSE.OBJ:$(KERNEL)/drivers/com_mouse.asm \ |
||
111 | drivers/emu10k1x.obj:DRIVERS/EMU10K1X.OBJ:$(KERNEL)/drivers/emu10k1x.asm \ |
||
112 | drivers/fm801.obj:DRIVERS/FM801.OBJ:$(KERNEL)/drivers/fm801.asm \ |
||
113 | drivers/infinity.obj:DRIVERS/INFINITY.OBJ:$(KERNEL)/drivers/infinity.asm \ |
||
114 | drivers/ps2mouse.obj:DRIVERS/PS2MOUSE.OBJ:$(REPOSITORY)/drivers/mouse/ps2mouse4d/trunk/ps2mouse.asm \ |
||
115 | drivers/sb16.obj:DRIVERS/SB16.OBJ:$(KERNEL)/drivers/sb16/sb16.asm \ |
||
116 | drivers/sound.obj:DRIVERS/SOUND.OBJ:$(KERNEL)/drivers/sound.asm \ |
||
117 | drivers/vmode.mdr:DRIVERS/VMODE.MDR:$(KERNEL)/drivers/vmode.asm \ |
||
118 | drivers/vt8235.obj:DRIVERS/VT8235.OBJ:$(KERNEL)/drivers/vt823x.asm \ |
||
119 | File|Managers/kfar:File|Managers/KFAR:$(PROGS)/fs/kfar/trunk/kfar.asm \ |
||
120 | File|Managers/OpenDial:File|Managers/OPENDIAL:$(PROGS)/develop/libraries/box_lib/asm/trunk/OpenDial.asm \ |
||
121 | fonts/bgitest:FONTS/BGITEST:$(PROGS)/demos/bgitest/trunk/bgitest.asm \ |
||
122 | games/15:GAMES/15:$(PROGS)/games/15/trunk/15.ASM \ |
||
123 | games/arcanii:GAMES/ARCANII:$(PROGS)/games/arcanii/trunk/arcanii.asm \ |
||
124 | games/freecell:GAMES/FREECELL:$(PROGS)/games/freecell/freecell.ASM \ |
||
125 | games/invaders:GAMES/INVADERS:$(PROGS)/games/invaders/invaders.asm \ |
||
126 | games/lines:GAMES/LINES:$(PROGS)/games/lines/lines.asm \ |
||
127 | games/mblocks:GAMES/MBLOCKS:$(PROGS)/games/mblocks/trunk/mblocks.asm \ |
||
128 | games/phenix:GAMES/PHENIX:$(PROGS)/games/phenix/trunk/phenix.asm \ |
||
129 | games/pipes:GAMES/PIPES:$(PROGS)/games/pipes/pipes.asm \ |
||
130 | games/pong:GAMES/PONG:$(PROGS)/games/pong/trunk/pong.asm \ |
||
131 | games/pong3:GAMES/PONG3:$(PROGS)/games/pong3/trunk/pong3.asm \ |
||
132 | games/rsquare:GAMES/RSQUARE:$(PROGS)/games/rsquare/trunk/rsquare.asm \ |
||
133 | games/snake:GAMES/SNAKE:$(PROGS)/games/snake/trunk/snake.asm \ |
||
134 | games/tetris:GAMES/TETRIS:$(PROGS)/games/tetris/trunk/tetris.asm \ |
||
135 | lib/archiver.obj:LIB/ARCHIVER.OBJ:$(PROGS)/fs/kfar/trunk/kfar_arc/kfar_arc.asm \ |
||
136 | lib/box_lib.obj:LIB/BOX_LIB.OBJ:$(PROGS)/develop/libraries/box_lib/trunk/box_lib.asm \ |
||
137 | lib/console.obj:LIB/CONSOLE.OBJ:$(PROGS)/develop/libraries/console/console.asm \ |
||
138 | lib/libgfx.obj:LIB/LIBGFX.OBJ:$(PROGS)/develop/libraries/libs-dev/libgfx/libgfx.asm \ |
||
139 | lib/libimg.obj:LIB/LIBIMG.OBJ:$(PROGS)/develop/libraries/libs-dev/libimg/libimg.asm \ |
||
140 | lib/libini.obj:LIB/LIBINI.OBJ:$(PROGS)/develop/libraries/libs-dev/libini/libini.asm \ |
||
141 | lib/libio.obj:LIB/LIBIO.OBJ:$(PROGS)/develop/libraries/libs-dev/libio/libio.asm \ |
||
142 | lib/network.obj:LIB/NETWORK.OBJ:$(PROGS)/develop/libraries/network/network.asm \ |
||
143 | lib/proc_lib.obj:LIB/PROC_LIB.OBJ:$(PROGS)/develop/libraries/proc_lib/trunk/proc_lib.asm \ |
||
144 | media/animage:MEDIA/ANIMAGE:$(PROGS)/media/animage/trunk/animage.asm \ |
||
145 | media/cdp:MEDIA/CDP:$(PROGS)/media/cdp/trunk/cdp.asm \ |
||
146 | media/kiv:MEDIA/KIV:$(PROGS)/media/kiv/trunk/kiv.asm \ |
||
147 | media/midamp:MEDIA/MIDAMP:$(PROGS)/media/midamp/trunk/midamp.asm \ |
||
148 | network/airc:NETWORK/AIRC:$(PROGS)/network/airc/trunk/airc.asm \ |
||
149 | network/arpstat:NETWORK/ARPSTAT:$(PROGS)/network/arpstat/trunk/arpstat.asm \ |
||
150 | network/chess:NETWORK/CHESS:$(PROGS)/network/chess/trunk/chess.asm \ |
||
151 | network/ethstat:NETWORK/ETHSTAT:$(PROGS)/network/ethstat/trunk/ethstat.asm \ |
||
152 | network/ftps:NETWORK/FTPS:$(PROGS)/network/ftps/trunk/FTPS.ASM \ |
||
153 | network/httpc:NETWORK/HTTPC:$(PROGS)/network/httpc/trunk/httpc.asm \ |
||
154 | network/https:NETWORK/HTTPS:$(PROGS)/network/https/trunk/https.asm \ |
||
155 | network/nntpc:NETWORK/NNTPC:$(PROGS)/network/nntpc/trunk/nntpc.asm \ |
||
156 | network/nslookup:NETWORK/NSLOOKUP:$(PROGS)/develop/libraries/network/examples/nslookup.asm \ |
||
157 | network/popc:NETWORK/POPC:$(PROGS)/network/popc/trunk/popc.asm \ |
||
158 | network/smtps:NETWORK/SMTPS:$(PROGS)/network/smtps/trunk/smtps.asm \ |
||
159 | network/stackcfg:NETWORK/STACKCFG:$(PROGS)/network/stackcfg/trunk/stackcfg.asm \ |
||
160 | network/telnet:NETWORK/TELNET:$(PROGS)/network/telnet/trunk/telnet.asm \ |
||
161 | network/tftpc:NETWORK/TFTPC:$(PROGS)/network/tftpc/trunk/tftpc.asm \ |
||
162 | network/VNCclient:NETWORK/VNCclient:$(PROGS)/network/VNCclient/VNCclient.asm \ |
||
163 | network/ym:NETWORK/YM:$(PROGS)/network/ym/trunk/ym.asm \ |
||
164 | network/zeroconf:NETWORK/ZEROCONF:$(PROGS)/network/zeroconf/trunk/zeroconf.asm \ |
||
165 | # end of list |
||
166 | |||
167 | # The list of files which should be copied from somewhere. |
||
168 | # Format of an item is exactly the same as in the previous list. |
||
169 | COPY_FILES:=\ |
||
170 | macros.inc:MACROS.INC:$(PROGS)/macros.inc \ |
||
171 | config.inc:CONFIG.INC:$(PROGS)/config.inc \ |
||
172 | struct.inc:STRUCT.INC:$(PROGS)/struct.inc \ |
||
173 | File|Managers/z_icons.png:File|Managers/Z_ICONS.PNG:$(PROGS)/develop/libraries/box_lib/asm/trunk/z_icons.png \ |
||
174 | fonts/euro.chr:FONTS/EURO.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/EURO.CHR \ |
||
175 | fonts/goth.chr:FONTS/GOTH.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/GOTH.CHR \ |
||
176 | fonts/lcom.chr:FONTS/LCOM.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/LCOM.CHR \ |
||
177 | fonts/litt.chr:FONTS/LITT.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/LITT.CHR \ |
||
178 | fonts/sans.chr:FONTS/SANS.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/SANS.CHR \ |
||
179 | fonts/scri.chr:FONTS/SCRI.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/SCRI.CHR \ |
||
180 | fonts/simp.chr:FONTS/SIMP.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/SIMP.CHR \ |
||
181 | fonts/smal.chr:FONTS/SMAL.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/SMAL.CHR \ |
||
182 | fonts/trip.chr:FONTS/TRIP.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/TRIP.CHR \ |
||
183 | fonts/tscr.chr:FONTS/TSCR.CHR:$(PROGS)/demos/bgitest/trunk/FONTS/TSCR.CHR |
||
184 | |||
185 | # List of other files to be included in the image file. |
||
186 | # Some of them are auto-built with special rules, some just exist before build. |
||
187 | # Each item is of the form |
||
188 | # Spaces should be represented as |. |
||
189 | OTHER_FILES:=asciivju:ASCIIVJU autorun.dat:AUTORUN.DAT \ |
||
190 | background.gif:background.gif default.skn:DEFAULT.SKN \ |
||
191 | e80:E80 graph:GRAPH hdread:HDREAD htmlv:HTMLV \ |
||
192 | icons.dat:ICONS.DAT iconstrp.gif:ICONSTRP.GIF index_htm:INDEX.HTM \ |
||
193 | kernel.mnt:KERNEL.MNT kerpack:KERPACK keymap.key:KEYMAP.KEY kpack:KPACK \ |
||
194 | kuzkina.mid:KUZKINA.MID lang.inc:LANG.INC lang.ini:LANG.INI \ |
||
195 | menu.dat:MENU.DAT mykey:MYKEY @notify:@NOTIFY \ |
||
196 | panel.dat:PANEL.DAT pipetka:PIPETKA setup.dat:SETUP.DAT \ |
||
197 | shell:SHELL spanel:SPANEL table:TABLE test:TEST \ |
||
198 | vmode:VMODE \ |
||
199 | 3d/3dsheart:3D/3DSHEART 3d/3dspiral:3D/3DSPIRAL 3d/cubeline:3D/CUBELINE \ |
||
200 | 3d/flatwav:3D/FLATWAV 3d/gears:3D/GEARS 3d/house.3ds:3D/HOUSE.3DS \ |
||
201 | demos/aclock:DEMOS/ACLOCK demos/ak47.lif:DEMOS/AK47.LIF \ |
||
202 | demos/barge.lif:DEMOS/BARGE.LIF demos/life2:DEMOS/LIFE2 \ |
||
203 | demos/relay.lif:DEMOS/RELAY.LIF demos/rpento.lif:DEMOS/RPENTO.LIF \ |
||
204 | demos/use_mb:DEMOS/USE_MB demos/web:DEMOS/WEB \ |
||
205 | drivers/atikms.dll:DRIVERS/ATIKMS.DLL \ |
||
206 | File|Managers/buttons.bmp:File|Managers/BUTTONS.BMP \ |
||
207 | File|Managers/eolite:File|Managers/EOLITE \ |
||
208 | File|Managers/eolite.ini:File|Managers/EOLITE.INI \ |
||
209 | File|Managers/icons.bmp:File|Managers/ICONS.BMP \ |
||
210 | File|Managers/icons.ini:File|Managers/ICONS.INI \ |
||
211 | File|Managers/kfar.ini:File|Managers/KFAR.INI \ |
||
212 | File|Managers/kfm:File|Managers/KFM \ |
||
213 | File|Managers/kfm.ini:File|Managers/KFM.INI \ |
||
214 | File|Managers/kfm_keys.txt:File|Managers/KFM_KEYS.TXT \ |
||
215 | fonts/bold.chr:FONTS/BOLD.CHR fonts/char2.mt:FONTS/CHAR2.MT \ |
||
216 | fonts/char.mt:FONTS/CHAR.MT \ |
||
217 | games/appdata.dat:GAMES/APPDATA.DAT games/ataka:GAMES/ATAKA \ |
||
218 | games/basekurs.kla:GAMES/BASEKURS.KLA games/bnc:GAMES/BNC games/c4:GAMES/C4 \ |
||
219 | games/checkers:GAMES/CHECKERS games/clicks:GAMES/CLICKS \ |
||
220 | games/FindNumbers:GAMES/FindNumbers games/gomoku:GAMES/GOMOKU \ |
||
221 | games/klavisha:GAMES/KLAVISHA games/kosilka:GAMES/KOSILKA \ |
||
222 | games/kosskin.gfx:GAMES/KOSSKIN.GFX games/kox:GAMES/KOX \ |
||
223 | games/lights:GAMES/LIGHTS games/megamaze:GAMES/MEGAMAZE games/mine:GAMES/MINE \ |
||
224 | games/msquare:GAMES/MSQUARE games/padenie:GAMES/PADENIE \ |
||
225 | games/reversi:GAMES/REVERSI games/rforces:GAMES/RFORCES \ |
||
226 | games/snake.ini:GAMES/SNAKE.INI games/sq_game:GAMES/SQ_GAME \ |
||
227 | games/sudoku:GAMES/SUDOKU games/sw:GAMES/SW games/whowtbam:GAMES/WHOWTBAM \ |
||
228 | games/xonix:GAMES/XONIX \ |
||
229 | lib/cnv_png.obj:LIB/CNV_PNG.OBJ lib/msgbox.obj:LIB/MSGBOX.OBJ \ |
||
230 | lib/pixlib.obj:LIB/PIXLIB.OBJ lib/sort.obj:LIB/SORT.OBJ \ |
||
231 | media/ac97snd:MEDIA/AC97SND media/kiv.ini:MEDIA/KIV.INI \ |
||
232 | media/listplay:MEDIA/LISTPLAY media/startmus:MEDIA/STARTMUS \ |
||
233 | network/jmail:NETWORK/JMAIL network/zeroconf.ini:NETWORK/ZEROCONF.INI \ |
||
234 | #end of list |
||
235 | #3d/logio.bmp:3D/LOGIO.BMP 3d/cubetext:3D/CUBETEXT |
||
236 | |||
237 | # Some macro for convenient work. |
||
238 | # Macros for replacing '|' to escaped space '\ '. |
||
239 | space:=\ #plus space |
||
240 | respace=$(subst |,$(space),$(1)) |
||
241 | # Macro for selecting different parts of ':'-separated items. |
||
242 | binarypart=$(word 1,$(subst :, ,$(1))) |
||
243 | imagepart=$(word 2,$(subst :, ,$(1))) |
||
244 | sourcepart=$(word 3,$(subst :, ,$(1))) |
||
245 | # Get file names, possibly with spaces inside, from an item. |
||
246 | # Here $(f) is an item - in fact, macro argument. |
||
247 | fbinary=$(call respace,$(call binarypart,$(f))) |
||
248 | fimage=$(call respace,$(call imagepart,$(f))) |
||
249 | fsource=$(call respace,$(call sourcepart,$(f))) |
||
250 | |||
251 | # Define targets for image file. |
||
252 | # Join lists $(FASM_PROGRAMS), $(COPY_FILES) and $(OTHER_FILES); |
||
253 | # for each item in the united list call fbinary. |
||
254 | targets:=$(foreach f,$(COPY_FILES) $(FASM_PROGRAMS) $(OTHER_FILES),$(fbinary)) |
||
255 | |||
256 | # Define a command for copying a file inside the image. |
||
257 | # mcopy_command is a macro with two parameters, |
||
258 | # local file name $(1) and image file name $(2). |
||
259 | # Note that spaces in these have to be escaped with backslashes. |
||
260 | mcopy_command=mcopy -mi $(BUILD_DIR)/kolibri.img $(1) ::$(2) |
||
261 | # Specialize a previous command for an item $(f) in one of lists. |
||
262 | mcopy_item_command=$(call mcopy_command,$(fbinary),$(fimage)) |
||
263 | |||
264 | # Join all $(mcopy_item_command) for all items, |
||
265 | # append newline after each item. |
||
266 | # The first newline character after "define" line and |
||
267 | # the last newline character before "endef" line get away |
||
268 | # with define/endef, so we make three newline characters, |
||
269 | # that is two empty lines, in order to get one in $(newline). |
||
270 | define newline |
||
271 | |||
272 | |||
273 | endef |
||
274 | mcopy_all_items:=$(foreach f,$(FASM_PROGRAMS) $(COPY_FILES) $(OTHER_FILES),$(mcopy_item_command)$(newline)) |
||
275 | |||
276 | # The main goal: image. |
||
277 | $(BUILD_DIR)/kolibri.img: $(BUILD_DIR)/.dir \ |
||
278 | Makefile \ |
||
279 | $(BUILD_DIR)/boot_fat12.bin \ |
||
280 | $(targets) |
||
281 | # SYSXTREE |
||
282 | # 3d/CUBETEXT |
||
283 | # 3d/LOGIO.BMP |
||
284 | dd if=/dev/zero of=$(BUILD_DIR)/kolibri.img count=2880 bs=512 |
||
285 | mformat -f 1440 -i $(BUILD_DIR)/kolibri.img :: |
||
286 | dd if=$(BUILD_DIR)/boot_fat12.bin of=$(BUILD_DIR)/kolibri.img count=1 bs=512 conv=notrunc |
||
287 | mmd -i $(BUILD_DIR)/kolibri.img ::3D |
||
288 | mmd -i $(BUILD_DIR)/kolibri.img ::DEMOS |
||
289 | mmd -i $(BUILD_DIR)/kolibri.img ::DEVELOP |
||
290 | mmd -i $(BUILD_DIR)/kolibri.img ::DRIVERS |
||
291 | mmd -i $(BUILD_DIR)/kolibri.img ::File\ Managers |
||
292 | mmd -i $(BUILD_DIR)/kolibri.img ::FONTS |
||
293 | mmd -i $(BUILD_DIR)/kolibri.img ::GAMES |
||
294 | mmd -i $(BUILD_DIR)/kolibri.img ::LIB |
||
295 | mmd -i $(BUILD_DIR)/kolibri.img ::MEDIA |
||
296 | mmd -i $(BUILD_DIR)/kolibri.img ::NETWORK |
||
297 | $(mcopy_all_items) |
||
298 | |||
299 | # Special target to modify behaviour of make. |
||
300 | .DELETE_ON_ERROR: |
||
301 | |||
302 | # The floppy bootsector. |
||
303 | $(BUILD_DIR)/boot_fat12.bin: $(KERNEL)/bootloader/boot_fat12.asm $(KERNEL)/bootloader/floppy1440.inc |
||
304 | fasm $(KERNEL)/bootloader/boot_fat12.asm $(BUILD_DIR)/boot_fat12.bin |
||
305 | |||
306 | $(BUILD_DIR)/.dir 3d/.dir demos/.dir develop/.dir drivers/.dir fonts/.dir \ |
||
307 | games/.dir lib/.dir media/.dir network/.dir .deps/.dir: |
||
308 | mkdir -p $(dir $@) |
||
309 | touch $@ |
||
310 | File\ Managers/.dir: |
||
311 | mkdir -p "File Managers" |
||
312 | touch "File Managers/.dir" |
||
313 | |||
314 | # Define the rule for all FASM programs. |
||
315 | # Yes, this looks like a black magic. |
||
316 | # But it is not so scary as it seems. |
||
317 | # First, we define "meta-rule" as a rule which is |
||
318 | # macro depending on $(fasmprog). |
||
319 | # Second, the construction foreach+eval creates |
||
320 | # usual rules, one for each $(fasmprog) in $(FASM_PROGRAMS). |
||
321 | # Note that meta-rule is double-expanded, first |
||
322 | # time as the arg of eval - it is the place where $(fasmprog) |
||
323 | # gets expanded - and second time as the rule; |
||
324 | # so all $ which are expected to expand at the second time should be escaped. |
||
325 | # And all $ which are expected to be expanded by the shell should be escaped |
||
326 | # twice, so they become $$$$. |
||
327 | |||
328 | # The arguments of macro fasm_meta_rule: |
||
329 | # $(1) = name of binary file, |
||
330 | # $(2) = name of main source file. |
||
331 | # $(3) = folder of binary file - without spaces. |
||
332 | # $(4) = name of program - without path and extension, |
||
333 | define fasm_meta_rule |
||
334 | $(1): $(2) Makefile .deps/.dir $$(call respace,$$(addsuffix .dir,$(3))) |
||
335 | fasm -m 65536 $$< "$$@" -s .deps/$(4).fas |
||
336 | prepsrc .deps/$(4).fas /dev/null |
||
337 | prepsrc .deps/$(4).fas /dev/stdout | (echo -n '$(1):' && \ |
||
338 | perl -ne 's|\\|/|g;print " \\\n $$$$1" if /^;include \x27(.*?)\x27/' \ |
||
339 | && echo) > .deps/$(4).Po |
||
340 | kpack --nologo "$$@" |
||
341 | -include .deps/$(4).Po |
||
342 | endef |
||
343 | |||
344 | progname=$(call respace,$(basename $(notdir $(call binarypart,$(f))))) |
||
345 | binarydir=$(subst ./,,$(dir $(call binarypart,$(f)))) |
||
346 | $(foreach f,$(FASM_PROGRAMS),$(eval $(call fasm_meta_rule,$(fbinary),$(fsource),$(binarydir),$(progname)))) |
||
347 | |||
348 | # Rule for the kernel differs: it uses kerpack instead of kpack. |
||
349 | kernel.mnt: $(KERNEL)/kernel.asm Makefile .deps/.dir |
||
350 | fasm -m 65536 $< "$@" -s .deps/kernel.fas |
||
351 | prepsrc .deps/kernel.fas /dev/null |
||
352 | prepsrc .deps/kernel.fas /dev/stdout | (echo -n 'kernel.mnt:' && \ |
||
353 | perl -ne 's|\\|/|g;print " \\\n $$1" if /^;include \x27(.*?)\x27/' \ |
||
354 | && echo) > .deps/kernel.Po |
||
355 | kerpack $@ |
||
356 | -include .deps/kernel.Po |
||
357 | |||
358 | # Rule for copying files is simpler, but similar to previous. |
||
359 | define copy_meta_rule |
||
360 | $(1): $(2) Makefile $$(call respace,$$(addsuffix .dir,$(3))) |
||
361 | cp $$< "$$@" |
||
362 | endef |
||
363 | $(foreach f,$(COPY_FILES),$(eval $(call copy_meta_rule,$(fbinary),$(fsource),$(binarydir)))) |
||
364 | |||
365 | # Special rules for copying sysfuncr.txt. |
||
366 | docpak: $(DOCDIR)SYSFUNCR.TXT $(wildcard $(DOCDIR)*) |
||
367 | $(DOCDIR)SYSFUNCR.TXT: $(KERNEL)/docs/sysfuncr.txt |
||
368 | cp $(KERNEL)/docs/sysfuncr.txt $(DOCDIR)SYSFUNCR.TXT>>> |