mk_config 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. : This script creates a configuration tree.
  2. : Should be called with 3 parameters: the configuration root, the source
  3. : root, and a file containing the makefile definitions.
  4. set -e
  5. USAGE="Usage: $0 <config_root> <source_root> <macro_file>"
  6. case $# in
  7. 3) ;;
  8. *) echo $USAGE 1>&2
  9. exit 1
  10. ;;
  11. esac
  12. CONFIG=$1
  13. SRC_HOME=$2
  14. MACROS=$3
  15. if [ -d $SRC_HOME ]
  16. then :
  17. else echo "$0: $SRC_HOME is not a directory" 1>&2
  18. exit 2
  19. fi
  20. if [ -f $MACROS ]
  21. then :
  22. else echo "$0: $MACROS not found" 1>&2
  23. exit 3
  24. fi
  25. case ${CONFIG}XX${MACROS}XX${SRC_HOME} in
  26. /*XX/*XX/*) ;;
  27. *) echo "$0: all arguments should be absolute path names" 1>&2
  28. exit 4
  29. ;;
  30. esac
  31. create_dir $CONFIG
  32. cd $SRC_HOME
  33. find . -type d -print > $CONFIG/dir_list
  34. cd $CONFIG
  35. for i in `cat dir_list`
  36. do
  37. create_dir $i
  38. if [ -f $SRC_HOME/$i/proto.make ]
  39. then mk_makefile $MACROS $SRC_HOME/$i/proto.make > $i/Makefile
  40. fi
  41. if [ -f $SRC_HOME/$i/Action ]
  42. then
  43. cp $SRC_HOME/$i/Action $i/Action
  44. fi
  45. done
  46. cd $SRC_HOME/util/ceg/util
  47. for i in make_*
  48. do
  49. mk_makefile $MACROS $i > $CONFIG/util/ceg/util/$i
  50. done
  51. cd $CONFIG
  52. for i in lang/cem/cemcom.ansi lang/cem/cemcom lang/m2/comp
  53. do
  54. cp $SRC_HOME/$i/BigPars $CONFIG/$i/Parameters
  55. done
  56. for i in lang/pc/comp lang/cem/cpp.ansi
  57. do
  58. cp $SRC_HOME/$i/Parameters $CONFIG/$i/Parameters
  59. done
  60. cd $CONFIG/mach
  61. for i in *
  62. do
  63. if [ -d $i ]
  64. then
  65. if [ -d $i/as ]
  66. then
  67. cd $i/as
  68. mk_makefile $MACROS $SRC_HOME/mach/proto/as/proto.make | sed -e "/#MACH_DEFINE/,/^MACH/s/=.*/= $i/" > Makefile
  69. cd ../..
  70. fi
  71. if [ -d $i/top ]
  72. then
  73. cd $i/top
  74. mk_makefile $MACROS $SRC_HOME/mach/proto/top/proto.make | sed -e "/#MACH_DEFINE/,/^MACH/s/=.*/= $i/" > Makefile
  75. cd ../..
  76. fi
  77. if [ -d $i/cg ]
  78. then
  79. cd $i/cg
  80. mk_makefile $MACROS $SRC_HOME/mach/proto/cg/proto.make | sed -e "/#MACH_DEFINE/,/^MACH/s/=.*/= $i/" > Makefile
  81. cd ../..
  82. fi
  83. if [ -d $i/ncg ]
  84. then
  85. cd $i/ncg
  86. mk_makefile $MACROS $SRC_HOME/mach/proto/ncg/proto.make | sed -e "/#MACH_DEFINE/,/^MACH/s/=.*/= $i/" > Makefile
  87. if [ -f $SRC_HOME/mach/$i/ncg/table_dir ]
  88. then
  89. ed - Makefile <<EOF
  90. /^#TABLE_DEFINE/+1r $SRC_HOME/mach/$i/ncg/table_dir
  91. w
  92. q
  93. EOF
  94. fi
  95. cd ../..
  96. fi
  97. for j in libem libend libmon libfp libsys libdb
  98. do
  99. if [ -d $i/$j ]
  100. then
  101. cd $i/$j
  102. mk_makefile $MACROS $SRC_HOME/mach/proto/libg/proto.$j | sed -e "/#MACH_PARAMS/r $SRC_HOME/mach/$i/mach_params" > Makefile
  103. cd ../..
  104. fi
  105. done
  106. for j in libbsd4_1a libbsd4_2 libsysV_2
  107. do
  108. if [ -d $i/$j ]
  109. then
  110. cd $i/$j
  111. mk_makefile $MACROS $SRC_HOME/mach/proto/libg/proto.libsys | sed -e "/#MACH_PARAMS/r $SRC_HOME/mach/$i/mach_params" -e "s/libsys/$j/g" > Makefile
  112. cd ../..
  113. fi
  114. done
  115. for j in libcc libcc.ansi libm2 libpc libbc liboc libf77
  116. do
  117. create_dir $i/$j
  118. cd $i/$j
  119. mk_makefile $MACROS $SRC_HOME/mach/proto/libg/proto.$j | sed -e "/#MACH_PARAMS/r $SRC_HOME/mach/$i/mach_params" > Makefile
  120. cd ../..
  121. done
  122. if [ $i = vax4 ]
  123. then :
  124. elif [ -d $i/libsys ]
  125. then :
  126. else
  127. create_dir $i/libsys
  128. cd $i/libsys
  129. mk_makefile $MACROS $SRC_HOME/mach/proto/libg/proto.sysmon | sed -e "/#MACH_PARAMS/r $SRC_HOME/mach/$i/mach_params" > Makefile
  130. cd ../..
  131. fi
  132. fi
  133. done