OSDN Git Service

(none)
[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                 "ini_dpc.c",
89                 "req_dpc.c",
90                 "exe_dpc.c",
91         ],
92         [
93                 "Asyncronous data-queue",
94                 "\$(COMMON_HEADERS)",
95                 "\$(KERNEL_CORE_DIR)/adtq",
96                 "ADTQ_DIR",
97                 "frcv_adq.c",
98                 "fsnd_adq.c",
99                 "rcv_adq.c",
100                 "reff_adq.c",
101                 "refs_adq.c",
102                 "snd_adq.c",
103         ],
104         [
105                 "System",
106                 "\$(COMMON_HEADERS)",
107                 "\$(KERNEL_OBJ_DIR)/sys",
108                 "SYSOBJ_DIR",
109                 "sta_knl.c",
110                 "get_tid.c",
111                 "loc_cpu.c",
112                 "unl_cpu.c",
113                 "sns_loc.c",
114                 "ena_dsp.c",
115                 "dis_dsp.c",
116                 "sns_dsp.c",
117                 "sns_ctx.c",
118         ],
119         [
120                 "Tasks",
121                 "\$(COMMON_HEADERS)",
122                 "\$(KERNEL_OBJ_DIR)/tsk",
123                 "TSKOBJ_DIR",
124                 "cre_tsk.c",
125                 "acre_tsk.c",
126                 "kcre_tsk.c",
127                 "del_tsk.c",
128                 "act_tsk.c",
129                 "iact_tsk.c",
130                 "can_act.c",
131                 "ext_tsk.c",
132                 "exd_tsk.c",
133                 "ter_tsk.c",
134                 "chg_pri.c",
135                 "kchg_pri.c",
136                 "get_pri.c",
137                 "ref_tsk.c",
138                 "ref_tst.c",
139                 "slp_tsk.c",
140                 "wup_tsk.c",
141                 "iwup_tsk.c",
142                 "can_wup.c",
143                 "rel_wai.c",
144                 "irel_wai.c",
145                 "sus_tsk.c",
146                 "rsm_tsk.c",
147                 "frsm_tsk.c",
148                 "dly_tsk.c",
149                 "def_tex.c",
150                 "ras_tex.c",
151                 "ena_tex.c",
152                 "kexe_tex.c",
153                 "tcb2id.c",
154         ],
155         [
156                 "Semaphores",
157                 "\$(COMMON_HEADERS) \$(SEMOBJ_HEADERS)",
158                 "\$(KERNEL_OBJ_DIR)/sem",
159                 "SEMOBJ_DIR",
160                 "cre_sem.c",
161                 "acre_sem.c",
162                 "kcre_sem.c",
163                 "del_sem.c",
164                 "sig_sem.c",
165                 "isig_sem.c",
166                 "wai_sem.c",
167                 "pol_sem.c",
168                 "twai_sem.c",
169                 "ref_sem.c",
170         ],
171         [
172                 "Event-flags",
173                 "\$(COMMON_HEADERS) \$(FLGOBJ_HEADERS)",
174                 "\$(KERNEL_OBJ_DIR)/flg",
175                 "FLGOBJ_DIR",
176                 "cre_flg.c",
177                 "acre_flg.c",
178                 "kcre_flg.c",
179                 "del_flg.c",
180                 "set_flg.c",
181                 "iset_flg.c",
182                 "clr_flg.c",
183                 "wai_flg.c",
184                 "pol_flg.c",
185                 "twai_flg.c",
186                 "kchk_flg.c",
187                 "ref_flg.c",
188         ],
189         [
190                 "Data queues",
191                 "\$(COMMON_HEADERS) \$(DTQOBJ_HEADERS)",
192                 "\$(KERNEL_OBJ_DIR)/dtq",
193                 "DTQOBJ_DIR",
194                 "cre_dtq.c",
195                 "acre_dtq.c",
196                 "kcre_dtq.c",
197                 "del_dtq.c",
198                 "snd_dtq.c",
199                 "fsnd_dtq.c",
200                 "rcv_dtq.c",
201                 "prcv_dtq.c",
202                 "trcv_dtq.c",
203         ],
204         [
205                 "Mailboxes",
206                 "\$(COMMON_HEADERS) \$(MBXOBJ_HEADERS)",
207                 "\$(KERNEL_OBJ_DIR)/mbx",
208                 "MBXOBJ_DIR",
209                 "acre_mbx.c",
210                 "kcre_mbx.c",
211                 "snd_mbx.c",
212                 "rcv_mbx.c",
213                 "kadf_msg.c",
214                 "kadp_msg.c",
215                 "kadd_msq.c",
216                 "krmf_msg.c",
217                 "krmp_msg.c",
218                 "krmv_msq.c",
219         ],
220         [
221                 "Mutexes",
222                 "\$(COMMON_HEADERS) \$(MTXOBJ_HEADERS)",
223                 "\$(KERNEL_OBJ_DIR)/mtx",
224                 "MTXOBJ_DIR",
225                 "cre_mtx.c",
226                 "acre_mtx.c",
227                 "kcre_mtx.c",
228                 "del_mtx.c",
229                 "loc_mtx.c",
230                 "ploc_mtx.c",
231                 "tloc_mtx.c",
232                 "unl_mtx.c",
233                 "kadd_mtx.c",
234                 "krmv_mtx.c",
235         ],
236         [
237                 "Fixed-sized Memory Pools",
238                 "\$(COMMON_HEADERS) \$(MPFOBJ_HEADERS)",
239                 "\$(KERNEL_OBJ_DIR)/mpf",
240                 "MPFOBJ_DIR",
241                 "acre_mpf.c",
242                 "kcre_mpf.c",
243                 "get_mpf.c",
244                 "pget_mpf.c",
245                 "rel_mpf.c",
246         ],
247         [
248                 "System Time Management",
249                 "\$(COMMON_HEADERS)",
250                 "\$(KERNEL_OBJ_DIR)/tim",
251                 "TIMOBJ_DIR",
252                 "set_tim.c",
253                 "get_tim.c",
254                 "isig_tim.c",
255         ],
256         [
257                 "Cyclic Handlers",
258                 "\$(COMMON_HEADERS) \$(CYCOBJ_HEADERS)",
259                 "\$(KERNEL_OBJ_DIR)/cyc",
260                 "CYCOBJ_DIR",
261                 "cre_cyc.c",
262                 "acre_cyc.c",
263                 "kcre_cyc.c",
264                 "del_cyc.c",
265                 "sta_cyc.c",
266                 "stp_cyc.c",
267                 "ref_cyc.c",
268                 "kcyc_hdr.c",
269         ],
270         [
271                 "Interrupt handlers",
272                 "\$(COMMON_HEADERS) \$(INHOBJ_HEADERS)",
273                 "\$(KERNEL_OBJ_DIR)/inh",
274                 "INHOBJ_DIR",
275                 "def_inh.c",
276                 "sta_inh.c",
277                 "exe_inh.c",
278                 "end_inh.c",
279         ],
280         [
281                 "Interrupt Service Routines",
282                 "\$(COMMON_HEADERS) \$(ISROBJ_HEADERS)",
283                 "\$(KERNEL_OBJ_DIR)/isr",
284                 "ISROBJ_DIR",
285                 "acre_isr.c",
286                 "kcre_isr.c",
287                 "del_isr.c",
288                 "exe_isr.c",
289         ],
290 );
291
292 # header
293 $headers = <<END_OF_HEADERS;
294 # Header files
295 ITRON_HEADERS  = \$(KERNEL_INC_DIR)/itron.h                             \\
296                  \$(KERNEL_INC_DIR)/kernel.h
297
298 CFG_HEADERS    = \$(KERNEL_INC_DIR)/parser/parssys.h            \\
299                  \$(KERNEL_INC_DIR)/parser/parsknl.h            \\
300                  \$(KERNEL_INC_DIR)/parser/parserr.h            \\
301                  \$(KERNEL_INC_DIR)/parser/parshok.h
302
303 PARS_HEADERS   = \$(KERNEL_INC_DIR)/config/cfgsys.h             \\
304                  \$(KERNEL_INC_DIR)/config/cfgknl.h             \\
305                  \$(KERNEL_INC_DIR)/config/cfgerr.h             \\
306                  \$(KERNEL_INC_DIR)/config/cfghok.h
307
308 CORE_HEADERS   = \$(KERNEL_INC_DIR)/core/adtq.h                 \\
309                  \$(KERNEL_INC_DIR)/core/basetyp.h              \\
310                  \$(KERNEL_INC_DIR)/core/chkptr.h               \\
311                  \$(KERNEL_INC_DIR)/core/cmpl.h                 \\
312                  \$(KERNEL_INC_DIR)/core/core.h                 \\
313                  \$(KERNEL_INC_DIR)/core/dsp.h                  \\
314                  \$(KERNEL_INC_DIR)/core/hep.h                  \\
315                  \$(KERNEL_INC_DIR)/core/objhdl.h               \\
316                  \$(KERNEL_INC_DIR)/core/objid.h                        \\
317                  \$(KERNEL_INC_DIR)/core/que.h                  \\
318                  \$(KERNEL_INC_DIR)/core/rdq.h                  \\
319                  \$(KERNEL_INC_DIR)/core/sys.h                  \\
320                  \$(KERNEL_INC_DIR)/core/tmq.h                  \\
321                  \$(KERNEL_INC_DIR)/core/toq.h                  \\
322                  \$(KERNEL_INC_DIR)/core/dpc.h
323
324 ARCH_HEADERS   = \$(INC_PROC_DIR)/proc.h                                        \\
325                  \$(INC_PROC_DIR)/procatr.h                             \\
326                  \$(INC_IRC_DIR)/irc.h                                  \\
327                  \$(INC_IRC_DIR)/ircatr.h
328
329 TSKOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/tskobj.h
330
331 SEMOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/semobj.h
332
333 FLGOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/flgobj.h
334
335 DTQOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/dtqobj.h
336
337 MBXOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/mbxobj.h
338
339 MTXOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/mtxobj.h
340
341 MPFOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/mpfobj.h
342
343 CYCOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/cycobj.h
344
345 INHOBJ_HEADERS = \$(KERNEL_INC_DIR)/object/inhobj.h
346
347 ISROBJ_HEADERS = \$(KERNEL_INC_DIR)/object/isrobj.h
348
349 COMMON_HEADERS = \$(ITRON_HEADERS)              \\
350                  \$(CFG_HEADERS)                        \\
351                  \$(PARS_HEADERS)               \\
352                  \$(CORE_HEADERS)               \\
353                  \$(ARCH_HEADERS)               \\
354                  \$(TSKOBJ_HEADERS)             \\
355 END_OF_HEADERS
356
357
358
359
360 # --------------------------------------------------
361 #  gmake source
362 # --------------------------------------------------
363
364 open(OUT, "> ../gmake/knlsrc.inc");
365
366 print(OUT "# ----------------------------------------------------------------------------\n");
367 print(OUT "#  Hyper Operating System V4 Advance\n");
368 print(OUT "#    common include file for GNU make\n");
369 print(OUT "#\n");
370 print(OUT "#  Copyright (C) 1998-2007 by Project HOS\n");
371 print(OUT "#  http://sourceforge.jp/projects/hos/\n");
372 print(OUT "# ----------------------------------------------------------------------------\n");
373 print(OUT "\n");
374 print(OUT "\n");
375 print(OUT "\n");
376 print(OUT "# Directories\n");
377 print(OUT "KERNEL_SRC_DIR  = \$(KERNEL_DIR)/source\n");
378 print(OUT "KERNEL_INC_DIR  = \$(KERNEL_DIR)/include\n");
379 print(OUT "KERNEL_CORE_DIR = \$(KERNEL_SRC_DIR)/core\n");
380 print(OUT "KERNEL_OBJ_DIR  = \$(KERNEL_SRC_DIR)/object\n");
381 print(OUT "\n");
382 print(OUT "\n");
383 print(OUT "\n");
384 print(OUT "# Kernel include directorys\n");
385 print(OUT "INC_DIRS += \$(KERNEL_INC_DIR)\n");
386 print(OUT "\n");
387 print(OUT "\n");
388
389 print(OUT $headers);
390 print(OUT "\n");
391
392 foreach $s ( @sources )
393 {
394         @list = @{$s};
395         $comment = shift(@list);
396         $depend  = shift(@list);
397         $path    = shift(@list);
398         $def_dir = shift(@list);
399         
400         print(OUT "\n\n");
401         print(OUT "# $comment\n");
402         print(OUT "$def_dir = $path\n");
403         print(OUT "SRC_DIRS += \$($def_dir)\n");
404         foreach $file ( @list )
405         {
406                 print(OUT "CSRCS += \$($def_dir)/$file\n");
407         }
408 }
409
410
411 print(OUT "\n");
412 print(OUT "\n");
413 print(OUT "# end of file\n");
414
415 close(OUT);
416
417
418
419 # --------------------------------------------------
420 #  gmake depend
421 # --------------------------------------------------
422
423 open(OUT, "> ../gmake/knldep.inc");
424
425 print(OUT "# ----------------------------------------------------------------------------\n");
426 print(OUT "#  Hyper Operating System V4 Advance\n");
427 print(OUT "#    common depend file for GNU make\n");
428 print(OUT "#\n");
429 print(OUT "#  Copyright (C) 1998-2007 by Project HOS\n");
430 print(OUT "#  http://sourceforge.jp/projects/hos/\n");
431 print(OUT "# ----------------------------------------------------------------------------\n");
432 print(OUT "\n");
433 print(OUT "\n");
434 print(OUT "\n");
435 foreach $s ( @sources )
436 {
437         @list = @{$s};
438         $comment = shift(@list);
439         $depend  = shift(@list);
440         $path    = shift(@list);
441         $def_dir = shift(@list);
442         
443         print(OUT "\n");
444         foreach $file ( @list )
445         {
446                 $objfile = $file;
447                 $objfile =~ s/\.c/\./;
448                 print(OUT "\$(OBJS_DIR)/$objfile\$(EXT_OBJ):\t\$($def_dir)/$file\t$depend\n");
449         }
450 }
451
452
453 print(OUT "\n");
454 print(OUT "\n");
455 print(OUT "# end of file\n");
456
457 close(OUT);
458
459
460
461
462 # --------------------------------------------------
463 #  nmake source
464 # --------------------------------------------------
465
466 open(OUT, "> ../nmake/knlsrc.inc");
467
468 print(OUT "# ----------------------------------------------------------------------------\n");
469 print(OUT "#  Hyper Operating System V4 Advance\n");
470 print(OUT "#    common include file for nmake\n");
471 print(OUT "#\n");
472 print(OUT "#  Copyright (C) 1998-2007 by Project HOS\n");
473 print(OUT "#  http://sourceforge.jp/projects/hos/\n");
474 print(OUT "# ----------------------------------------------------------------------------\n");
475 print(OUT "\n");
476 print(OUT "\n");
477 print(OUT "\n");
478 print(OUT "# Directories\n");
479 print(OUT "KERNEL_SRC_DIR  = \$(KERNEL_DIR)\\source\n");
480 print(OUT "KERNEL_INC_DIR  = \$(KERNEL_DIR)\\include\n");
481 print(OUT "KERNEL_CORE_DIR = \$(KERNEL_SRC_DIR)\\core\n");
482 print(OUT "KERNEL_OBJ_DIR  = \$(KERNEL_SRC_DIR)\\object\n");
483 print(OUT "\n");
484 print(OUT "\n");
485 print(OUT "\n");
486 print(OUT "# Kernel include directorys\n");
487 print(OUT "INC_DIRS = \$(INC_DIRS) \$(KERNEL_INC_DIR)\n");
488 print(OUT "\n");
489 print(OUT "\n");
490
491 $tmp = $headers;
492 $tmp =~ s/\//\\/g;
493 print(OUT $tmp);
494 print(OUT "\n");
495
496 foreach $s ( @sources )
497 {
498         @list = @{$s};
499         $comment = shift(@list);
500         $depend  = shift(@list);
501         $path    = shift(@list);
502         $def_dir = shift(@list);
503         
504         $path =~ s/\//\\/g;
505         
506         print(OUT "\n\n");
507         print(OUT "# $comment\n");
508         print(OUT "$def_dir = $path\n");
509         foreach $file ( @list )
510         {
511                 print(OUT "CSRCS = \$(CSRCS) \$($def_dir)\\$file\n");
512         }
513         foreach $file ( @list )
514         {
515                 $file =~ s/\.c//g;
516                 print(OUT "OBJS = \$(OBJS) \$(OBJS_DIR)\\$file\.\$(EXT_OBJ)\n");
517         }
518 }
519
520
521 print(OUT "\n");
522 print(OUT "\n");
523 print(OUT "# end of file\n");
524
525 close(OUT);
526
527
528
529 # --------------------------------------------------
530 #  nmake depend
531 # --------------------------------------------------
532
533 open(OUT, "> ../nmake/knldep.inc");
534
535 print(OUT "# ----------------------------------------------------------------------------\n");
536 print(OUT "#  Hyper Operating System V4 Advance\n");
537 print(OUT "#    common depend file for nmake\n");
538 print(OUT "#\n");
539 print(OUT "#  Copyright (C) 1998-2007 by Project HOS\n");
540 print(OUT "#  http://sourceforge.jp/projects/hos/\n");
541 print(OUT "# ----------------------------------------------------------------------------\n");
542 print(OUT "\n");
543 print(OUT "\n");
544 print(OUT "\n");
545 print(OUT "# ----------------------------------\n");
546 print(OUT "#  source copy\n");
547 print(OUT "# ----------------------------------\n");
548 print(OUT "\n");
549 print(OUT "makelib_srcobjcp:\n\n");
550
551 foreach $s ( @sources )
552 {
553         @list = @{$s};
554         $comment = shift(@list);
555         $depend  = shift(@list);
556         $path    = shift(@list);
557         $def_dir = shift(@list);
558         
559         $path =~ s/\//\\/g;
560         
561         print(OUT "\n");
562         foreach $file ( @list )
563         {
564                 print(OUT "\$(OBJS_DIR)\\$file : \$($def_dir)\\$file\n");
565                 print(OUT "\t\$(CMD_CP) \$($def_dir)\\$file \$(OBJS_DIR)\\\n");
566                 print(OUT "\n");
567         }
568 }
569
570 print(OUT "\n");
571 print(OUT "\n");
572 print(OUT "\n");
573 print(OUT "# ----------------------------------\n");
574 print(OUT "#  depend\n");
575 print(OUT "# ----------------------------------\n");
576
577 foreach $s ( @sources )
578 {
579         @list = @{$s};
580         $comment = shift(@list);
581         $depend  = shift(@list);
582         $path    = shift(@list);
583         $def_dir = shift(@list);
584         
585         $path =~ s/\//\\/g;
586         
587         print(OUT "\n");
588         foreach $file ( @list )
589         {
590                 $objfile =~ s/\.c//g;
591                 print(OUT "\$(OBJS_DIR)\\$objfile.\$(EXT_OBJ):\t\$(OBJS_DIR)\\$file\t$depend\n");
592         }
593 }
594
595
596 print(OUT "\n");
597 print(OUT "\n");
598 print(OUT "\n");
599 print(OUT "# end of file\n");
600
601 close(OUT);
602