PageRenderTime 39ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/src/tet3/bin/w32_symbuild.ksh

#
Korn Shell | 90 lines | 34 code | 7 blank | 49 comment | 4 complexity | 3707ec20c545b1c2d4436ebfc21df485 MD5 | raw file
  1. #
  2. # SCCS: @(#)w32_symbuild.ksh 1.1 (98/09/01)
  3. #
  4. # UniSoft Ltd., London, England
  5. #
  6. # Copyright (c) 1998 The Open Group
  7. # All rights reserved.
  8. #
  9. # No part of this source code may be reproduced, stored in a retrieval
  10. # system, or transmitted, in any form or by any means, electronic,
  11. # mechanical, photocopying, recording or otherwise, except as stated in
  12. # the end-user licence agreement, without the prior permission of the
  13. # copyright owners.
  14. # A copy of the end-user licence agreement is contained in the file
  15. # Licence which accompanies this distribution.
  16. #
  17. # Motif, OSF/1, UNIX and the "X" device are registered trademarks and
  18. # IT DialTone and The Open Group are trademarks of The Open Group in
  19. # the US and other countries.
  20. #
  21. # X/Open is a trademark of X/Open Company Limited in the UK and other
  22. # countries.
  23. #
  24. # ************************************************************************
  25. #
  26. # SCCS: @(#)w32_symbuild.ksh 1.1 98/09/01 TETware release 3.3
  27. # NAME: w32_symbuild.ksh
  28. # PRODUCT: TETware
  29. # AUTHOR: Andrew Dingwall, UniSoft Ltd.
  30. # DATE CREATED: July 1998
  31. #
  32. # DESCRIPTION:
  33. # shell script to extract the imported and exported symbols
  34. # from a .c file, then compile the .c file so that a reference
  35. # to a symbol that is exported from a program to a DLL is changed
  36. # to an indirect reference via a pointer
  37. #
  38. #
  39. # MODIFICATIONS:
  40. #
  41. # ************************************************************************
  42. # determine the name of the .c file
  43. cfile=
  44. for arg
  45. do
  46. case $arg in
  47. *.c)
  48. if test -z "$cfile"
  49. then
  50. cfile=$arg
  51. else
  52. echo $0: can only handle one .c file 1>&2
  53. exit 2
  54. fi
  55. ;;
  56. esac
  57. done
  58. if test -z "$cfile"
  59. then
  60. echo $0: need a .c file name 1>&2
  61. exit 2
  62. fi
  63. # extract the symbols
  64. CC=${CC:?} sh ../bin/symbols.sh "$@"
  65. # for each symbol that is exported from a program to a DLL, a cdef is
  66. # generated of the form:
  67. #
  68. # -Dfoo=(*tet_dll_foo)
  69. #
  70. x=${cfile##*/}
  71. symfile=${x%.c}.sym
  72. cdefs=
  73. while read impexp type name junk
  74. do
  75. case $impexp in
  76. EXPORT)
  77. cdefs="$cdefs${cdefs:+ }-D$name=(*tet_dll_$name)"
  78. ;;
  79. esac
  80. done < $symfile
  81. # do the compilation
  82. echo $CC $cdefs "$@"
  83. $CC $cdefs "$@"