OSDN Git Service

e8d31cdd93ab6a68d8f8a1ee7d59b2cbd26cc291
[hos/hos-v4a.git] / kernel / build / common / tmp_mkinc / mk_inc.pl
1 #! /usr/bin/perl
2
3
4 # sources
5 @sources =
6 (
7         [
8                 "Dispatcher",                           # comment
9                 "\$(COMMON_HEADERS)",           # depend
10                 "\$(KERNEL_CORE_DIR)/dsp",      # path
11                 "DSP_DIR",                                      # def_dir
12                 "ent_tsk.c",
13                 "idl_lop.c",
14                 "dsp_tsk.c",
15                 "dsp_sta.c",
16                 "dsp_ext.c",
17                 "dsp_ter.c",
18                 "dsp_wai.c",
19                 "dsp_wup.c",
20                 "dsp_sus.c",
21                 "dsp_rsm.c",
22         ],
23         [
24                 "Task-queue",
25                 "\$(COMMON_HEADERS)",
26                 "\$(KERNEL_CORE_DIR)/que",
27                 "QUE_DIR",
28                 "add_que.c",
29                 "adf_que.c",
30                 "adp_que.c",
31                 "rmv_que.c",
32                 "rmh_que.c",
33                 "trm_que.c",
34                 "nxt_que.c",
35                 "rot_que.c",
36         ],
37         [
38                 "Ready-queue",
39                 "\$(COMMON_HEADERS)",
40                 "\$(KERNEL_CORE_DIR)/rdq",
41                 "RDQ_DIR",
42                 "cre_rdq.c",
43                 "del_rdq.c",
44                 "add_rdq.c",
45                 "rmv_rdq.c",
46                 "rmh_rdq.c",
47                 "ref_rdq.c",
48         ],
49         [
50                 "Time management",
51                 "\$(COMMON_HEADERS)",
52                 "\$(KERNEL_CORE_DIR)/tim",
53                 "TIM_DIR",
54                 "sig_tim.c",
55         ],
56         [
57                 "Timeout-queue",
58                 "\$(COMMON_HEADERS)",
59                 "\$(KERNEL_CORE_DIR)/toq",
60                 "TOQ_DIR",
61                 "sig_toq.c",
62                 "add_toq.c",
63                 "rmv_toq.c",
64         ],
65         [
66                 "Timer-queue",
67                 "\$(COMMON_HEADERS)",
68                 "\$(KERNEL_CORE_DIR)/tmq",
69                 "TMQ_DIR",
70                 "sig_tmq.c",
71                 "add_tmq.c",
72                 "rmv_tmq.c",
73         ],
74         [
75                 "Memory-heap",
76                 "\$(COMMON_HEADERS)",
77                 "\$(KERNEL_CORE_DIR)/hep",
78                 "HEP_DIR",
79                 "cre_hep.c",
80                 "alc_hep.c",
81                 "fre_hep.c",
82         ],
83         [
84                 "Deferrable procedure call",
85                 "\$(COMMON_HEADERS)",
86                 "\$(KERNEL_CORE_DIR)/dpc",
87                 "DPC_DIR",
88                 "exe_dpc.c",
89         ],
90         [
91                 "Asyncronous data-queue",
92                 "\$(COMMON_HEADERS)",
93                 "\$(KERNEL_CORE_DIR)/adtq",
94                 "ADTQ_DIR",
95                 "frcv_adq.c",
96                 "fsnd_adq.c",
97                 "rcv_adq.c",
98                 "reff_adq.c",
99                 "refs_adq.c",
100                 "snd_adq.c",
101         ],
102         [
103                 "System",
104                 "\$(COMMON_HEADERS)",
105                 "\$(KERNEL_OBJ_DIR)/sys",
106                 "SYSOBJ_DIR",
107                 "sta_knl.c",
108                 "get_tid.c",
109                 "loc_cpu.c",
110                 "unl_cpu.c",
111                 "sns_loc.c",
112                 "ena_dsp.c",
113                 "dis_dsp.c",
114                 "sns_dsp.c",
115                 "sns_ctx.c",
116         ],
117         [
118                 "Tasks",
119                 "\$(COMMON_HEADERS)",
120                 "\$(KERNEL_OBJ_DIR)/tsk",
121                 "TSKOBJ_DIR",
122                 "acre_tsk.c",
123                 "kcre_tsk.c",
124                 "del_tsk.c",
125                 "act_tsk.c",
126                 "ext_tsk.c",
127                 "ter_tsk.c",
128                 "slp_tsk.c",
129                 "wup_tsk.c",
130                 "can_wup.c",
131                 "rel_wai.c",
132                 "sus_tsk.c",
133                 "rsm_tsk.c",
134                 "dly_tsk.c",
135                 "ref_tsk.c",
136                 "ref_tst.c",
137         ],
138         [
139                 "Semaphores",
140                 "\$(COMMON_HEADERS) \$(SEMOBJ_HEADERS)",
141                 "\$(KERNEL_OBJ_DIR)/sem",
142                 "SEMOBJ_DIR",
143                 "cre_sem.c",
144                 "acre_sem.c",
145                 "kcre_sem.c",
146                 "del_sem.c",
147                 "sig_sem.c",
148                 "isig_sem.c",
149                 "wai_sem.c",
150                 "pol_sem.c",
151                 "twai_sem.c",
152                 "ref_sem.c",
153         ],
154         [
155                 "Event-flags",
156                 "\$(COMMON_HEADERS) \$(FLGOBJ_HEADERS)",
157                 "\$(KERNEL_OBJ_DIR)/flg",
158                 "FLGOBJ_DIR",
159                 "cre_flg.c",
160                 "acre_flg.c",
161                 "kcre_flg.c",
162                 "del_flg.c",
163                 "set_flg.c",
164                 "iset_flg.c",
165                 "clr_flg.c",
166                 "wai_flg.c",
167                 "pol_flg.c",
168                 "twai_flg.c",
169                 "kchk_flg.c",
170                 "ref_flg.c",
171         ],
172         [
173                 "Data queues",
174                 "\$(COMMON_HEADERS) \$(DTQOBJ_HEADERS)",
175                 "\$(KERNEL_OBJ_DIR)/dtq",
176                 "DTQOBJ_DIR",
177                 "cre_dtq.c",
178                 "acre_dtq.c",
179                 "kcre_dtq.c",
180                 "snd_dtq.c",
181                 "fsnd_dtq.c",
182                 "rcv_dtq.c",
183                 "prcv_dtq.c",
184                 "trcv_dtq.c",
185         ],
186         [
187                 "Mailboxes",
188                 "\$(COMMON_HEADERS) \$(MBXOBJ_HEADERS)",
189                 "\$(KERNEL_OBJ_DIR)/mbx",
190                 "MBXOBJ_DIR",
191                 "acre_mbx.c",
192                 "kcre_mbx.c",
193                 "snd_mbx.c",
194                 "rcv_mbx.c",
195                 "kadf_msg.c",
196                 "kadp_msg.c",
197                 "kadd_msq.c",
198                 "krmf_msg.c",
199                 "krmp_msg.c",
200                 "krmv_msq.c",
201         ],
202         [
203                 "Mutexes",
204                 "\$(COMMON_HEADERS) \$(MTXOBJ_HEADERS)",
205                 "\$(KERNEL_OBJ_DIR)/mtx",
206                 "MTXOBJ_DIR",
207                 "cre_mtx.c",
208                 "acre_mtx.c",
209                 "kcre_mtx.c",
210                 "del_mtx.c",
211                 "loc_mtx.c",
212                 "unl_mtx.c",
213                 "kadd_mtx.c",
214                 "krmv_mtx.c",
215         ],
216         [
217                 "Fixed-sized Memory Pools",
218                 "\$(COMMON_HEADERS) \$(MPFOBJ_HEADERS)",
219                 "\$(KERNEL_OBJ_DIR)/mpf",
220                 "MPFOBJ_DIR",
221                 "acre_mpf.c",
222                 "kcre_mpf.c",
223                 "get_mpf.c",
224                 "pget_mpf.c",
225                 "rel_mpf.c",
226         ],
227         [
228                 "System Time Management",
229                 "\$(COMMON_HEADERS)",
230                 "\$(KERNEL_OBJ_DIR)/tim",
231                 "TIMOBJ_DIR",
232                 "set_tim.c",
233                 "get_tim.c",
234                 "isig_tim.c",
235         ],
236         [
237                 "Interrupt handlers",
238                 "\$(COMMON_HEADERS) \$(INHOBJ_HEADERS)",
239                 "\$(KERNEL_OBJ_DIR)/inh",
240                 "INHOBJ_DIR",
241                 "def_inh.c",
242                 "sta_inh.c",
243                 "exe_inh.c",
244                 "end_inh.c",
245         ],
246         [
247                 "Interrupt Service Routines",
248                 "\$(COMMON_HEADERS) \$(ISROBJ_HEADERS)",
249                 "\$(KERNEL_OBJ_DIR)/isr",
250                 "ISROBJ_DIR",
251                 "acre_isr.c",
252                 "kcre_isr.c",
253                 "exe_isr.c",
254         ],
255 );
256
257 # header
258 $headers = <<END_OF_HEADERS;
259 # Header files
260 ITRON_HEADERS  = \$(KERNEL_INC_DIR)/itron.h                             \\
261                  \$(KERNEL_INC_DIR)/kernel.h
262
263 CFG_HEADERS    = \$(KERNEL_INC_DIR)/parser/parssys.h            \\
264                  \$(KERNEL_INC_DIR)/parser/parsknl.h            \\
265                  \$(KERNEL_INC_DIR)/parser/parserr.h            \\
266                  \$(KERNEL_INC_DIR)/parser/parshok.h
267
268 PARS_HEADERS   = \$(KERNEL_INC_DIR)/config/cfgsys.h             \\
269                  \$(KERNEL_INC_DIR)/config/cfgknl.h             \\
270                  \$(KERNEL_INC_DIR)/config/cfgerr.h             \\
271                  \$(KERNEL_INC_DIR)/config/cfghok.h
272
273 CORE_HEADERS   = \$(KERNEL_INC_DIR)/core/adtq.h                 \\
274                  \$(KERNEL_INC_DIR)/core/basetyp.h              \\
275                  \$(KERNEL_INC_DIR)/core/chkptr.h               \\
276                  \$(KERNEL_INC_DIR)/core/cmpl.h                 \\
277                  \$(KERNEL_INC_DIR)/core/core.h                 \\
278                  \$(KERNEL_INC_DIR)/core/dsp.h                  \\
279                  \$(KERNEL_INC_DIR)/core/hep.h                  \\
280                  \$(KERNEL_INC_DIR)/core/objhdl.h               \\
281                  \$(KERNEL_INC_DIR)/core/objid.h                        \\
282                  \$(KERNEL_INC_DIR)/core/que.h                  \\
283                  \$(KERNEL_INC_DIR)/core/rdq.h                  \\
284                  \$(KERNEL_INC_DIR)/core/sys.h                  \\
285                  \$(KERNEL_INC_DIR)/core/tmq.h                  \\
286                  \$(KERNEL_INC_DIR)/core/toq.h                  \\
287                  \$(KERNEL_INC_DIR)/core/dpc.h
288
289 ARCH_HEADERS   = \$(INC_PROC_DIR)/proc.h                                        \\
290                  \$(INC_PROC_DIR)/procatr.h                             \\
291                  \$(INC_IRC_DIR)/irc.h                                  \\
292                  \$(INC_IRC_DIR)/ircatr.h
293
294 TSKOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/tskobj.h
295
296 SEMOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/semobj.h
297
298 FLGOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/flgobj.h
299
300 DTQOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/dtqobj.h
301
302 MBXOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/mbxobj.h
303
304 MTXOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/mtxobj.h
305
306 MPFOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/mpfobj.h
307
308 TIMOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/timobj.h
309
310 INHOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/inhobj.h
311
312 ISROBJ_HEADERS = \$(KERNEL_INC_DIR)/object/isrobj.h
313
314 COMMON_HEADERS = \$(ITRON_HEADERS)              \\
315                  \$(CFG_HEADERS)                        \\
316                  \$(PARS_HEADERS)               \\
317                  \$(CORE_HEADERS)               \\
318                  \$(ARCH_HEADERS)               \\
319                  \$(TSKOBJ_HEADERS)             \\
320 END_OF_HEADERS
321
322
323
324
325 # --------------------------------------------------
326 #  gmake source
327 # --------------------------------------------------
328
329 open(OUT, "> ../gmake/knlsrc.inc");
330
331 print(OUT "# ----------------------------------------------------------------------------\n");
332 print(OUT "#  Hyper Operating System V4 Advance\n");
333 print(OUT "#    common include file for GNU make\n");
334 print(OUT "#\n");
335 print(OUT "#  Copyright (C) 1998-2007 by Project HOS\n");
336 print(OUT "#  http://sourceforge.jp/projects/hos/\n");
337 print(OUT "# ----------------------------------------------------------------------------\n");
338 print(OUT "\n");
339 print(OUT "\n");
340 print(OUT "\n");
341 print(OUT "# Directories\n");
342 print(OUT "KERNEL_SRC_DIR  = \$(KERNEL_DIR)/source\n");
343 print(OUT "KERNEL_INC_DIR  = \$(KERNEL_DIR)/include\n");
344 print(OUT "KERNEL_CORE_DIR = \$(KERNEL_SRC_DIR)/core\n");
345 print(OUT "KERNEL_OBJ_DIR  = \$(KERNEL_SRC_DIR)/object\n");
346 print(OUT "\n");
347 print(OUT "\n");
348 print(OUT "\n");
349 print(OUT "# Kernel include directorys\n");
350 print(OUT "INC_DIRS += \$(KERNEL_INC_DIR)\n");
351 print(OUT "\n");
352 print(OUT "\n");
353
354 print(OUT $headers);
355 print(OUT "\n");
356
357 foreach $s ( @sources )
358 {
359         @list = @{$s};
360         $comment = shift(@list);
361         $depend  = shift(@list);
362         $path    = shift(@list);
363         $def_dir = shift(@list);
364         
365         print(OUT "\n\n");
366         print(OUT "# $comment\n");
367         print(OUT "$def_dir = $path\n");
368         print(OUT "SRC_DIRS += \$($def_dir)\n");
369         foreach $file ( @list )
370         {
371                 print(OUT "CSRCS += \$($def_dir)/$file\n");
372         }
373 }
374
375
376 print(OUT "\n");
377 print(OUT "\n");
378 print(OUT "# end of file\n");
379
380 close(OUT);
381
382
383
384 # --------------------------------------------------
385 #  gmake depend
386 # --------------------------------------------------
387
388 open(OUT, "> ../gmake/knldep.inc");
389
390 print(OUT "# ----------------------------------------------------------------------------\n");
391 print(OUT "#  Hyper Operating System V4 Advance\n");
392 print(OUT "#    common depend file for GNU make\n");
393 print(OUT "#\n");
394 print(OUT "#  Copyright (C) 1998-2007 by Project HOS\n");
395 print(OUT "#  http://sourceforge.jp/projects/hos/\n");
396 print(OUT "# ----------------------------------------------------------------------------\n");
397 print(OUT "\n");
398 print(OUT "\n");
399 print(OUT "\n");
400 foreach $s ( @sources )
401 {
402         @list = @{$s};
403         $comment = shift(@list);
404         $depend  = shift(@list);
405         $path    = shift(@list);
406         $def_dir = shift(@list);
407         
408         print(OUT "\n");
409         foreach $file ( @list )
410         {
411                 $objfile = $file;
412                 $objfile =~ s/\.c/\./;
413                 print(OUT "\$(OBJS_DIR)/$objfile\$(EXT_OBJ):\t\$($def_dir)/$file\t$depend\n");
414         }
415 }
416
417
418 print(OUT "\n");
419 print(OUT "\n");
420 print(OUT "# end of file\n");
421
422 close(OUT);
423
424
425
426
427 # --------------------------------------------------
428 #  nmake source
429 # --------------------------------------------------
430
431 open(OUT, "> ../nmake/knlsrc.inc");
432
433 print(OUT "# ----------------------------------------------------------------------------\n");
434 print(OUT "#  Hyper Operating System V4 Advance\n");
435 print(OUT "#    common include file for nmake\n");
436 print(OUT "#\n");
437 print(OUT "#  Copyright (C) 1998-2007 by Project HOS\n");
438 print(OUT "#  http://sourceforge.jp/projects/hos/\n");
439 print(OUT "# ----------------------------------------------------------------------------\n");
440 print(OUT "\n");
441 print(OUT "\n");
442 print(OUT "\n");
443 print(OUT "# Directories\n");
444 print(OUT "KERNEL_SRC_DIR  = \$(KERNEL_DIR)\\source\n");
445 print(OUT "KERNEL_INC_DIR  = \$(KERNEL_DIR)\\include\n");
446 print(OUT "KERNEL_CORE_DIR = \$(KERNEL_SRC_DIR)\\core\n");
447 print(OUT "KERNEL_OBJ_DIR  = \$(KERNEL_SRC_DIR)\\object\n");
448 print(OUT "\n");
449 print(OUT "\n");
450 print(OUT "\n");
451 print(OUT "# Kernel include directorys\n");
452 print(OUT "INC_DIRS = \$(INC_DIRS) \$(KERNEL_INC_DIR)\n");
453 print(OUT "\n");
454 print(OUT "\n");
455
456 $tmp = $headers;
457 $tmp =~ s/\//\\/g;
458 print(OUT $tmp);
459 print(OUT "\n");
460
461 foreach $s ( @sources )
462 {
463         @list = @{$s};
464         $comment = shift(@list);
465         $depend  = shift(@list);
466         $path    = shift(@list);
467         $def_dir = shift(@list);
468         
469         $path =~ s/\//\\/g;
470         
471         print(OUT "\n\n");
472         print(OUT "# $comment\n");
473         print(OUT "$def_dir = $path\n");
474         foreach $file ( @list )
475         {
476                 print(OUT "CSRCS = \$(CSRCS) \$($def_dir)\\$file\n");
477         }
478         foreach $file ( @list )
479         {
480                 $file =~ s/\.c//g;
481                 print(OUT "OBJS = \$(OBJS) \$(OBJS_DIR)\\$file\.\$(EXT_OBJ)\n");
482         }
483 }
484
485
486 print(OUT "\n");
487 print(OUT "\n");
488 print(OUT "# end of file\n");
489
490 close(OUT);
491
492
493
494 # --------------------------------------------------
495 #  nmake depend
496 # --------------------------------------------------
497
498 open(OUT, "> ../nmake/knldep.inc");
499
500 print(OUT "# ----------------------------------------------------------------------------\n");
501 print(OUT "#  Hyper Operating System V4 Advance\n");
502 print(OUT "#    common depend file for nmake\n");
503 print(OUT "#\n");
504 print(OUT "#  Copyright (C) 1998-2007 by Project HOS\n");
505 print(OUT "#  http://sourceforge.jp/projects/hos/\n");
506 print(OUT "# ----------------------------------------------------------------------------\n");
507 print(OUT "\n");
508 print(OUT "\n");
509 print(OUT "\n");
510 print(OUT "# ----------------------------------\n");
511 print(OUT "#  source copy\n");
512 print(OUT "# ----------------------------------\n");
513 print(OUT "srcobjcp_makelib:\n");
514 foreach $s ( @sources )
515 {
516         @list = @{$s};
517         $comment = shift(@list);
518         $depend  = shift(@list);
519         $path    = shift(@list);
520         $def_dir = shift(@list);
521         
522         print(OUT "\t\$(CMD_CP) \$($def_dir)\\*.* \$(OBJS_DIR)\n");
523 }
524
525 print(OUT "\n");
526 print(OUT "\n");
527 print(OUT "\n");
528 print(OUT "# ----------------------------------\n");
529 print(OUT "#  depend\n");
530 print(OUT "# ----------------------------------\n");
531
532 foreach $s ( @sources )
533 {
534         @list = @{$s};
535         $comment = shift(@list);
536         $depend  = shift(@list);
537         $path    = shift(@list);
538         $def_dir = shift(@list);
539         
540         $path =~ s/\//\\/g;
541         
542         print(OUT "\n");
543         foreach $file ( @list )
544         {
545                 $objfile =~ s/\.c//g;
546                 print(OUT "\$(OBJS_DIR)\\$objfile.\$(EXT_OBJ):\t\$(OBJS_DIR)\\$file\t$depend\n");
547         }
548 }
549
550
551 print(OUT "\n");
552 print(OUT "\n");
553 print(OUT "\n");
554 print(OUT "# end of file\n");
555
556 close(OUT);
557