home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / unzip540.zip / vms / make_unz.com < prev    next >
Text File  |  1997-10-05  |  11KB  |  309 lines

  1. $ ! MAKE_UNZ.COM
  2. $ !
  3. $ !    "Makefile" for VMS versions of UnZip/ZipInfo and UnZipSFX
  4. $ !
  5. $ !    last revised:  14 September 1997
  6. $ !
  7. $ !    Command args:
  8. $ !    - select compiler environment: "VAXC", "DECC", "GNUC"
  9. $ !    - select installation of CLI interface version of unzip:
  10. $ !      "VMSCLI" or "CLI"
  11. $ !    - force installation of UNIX interface version of unzip
  12. $ !      (override LOCAL_UNZIP environment): "NOVMSCLI" or "NOCLI"
  13. $ !
  14. $ !    To define additional options, define the global symbol
  15. $ !    LOCAL_UNZIP prior to executing MAKE_UNZ.COM, e.g.:
  16. $ !
  17. $ !        $ LOCAL_UNZIP == "RETURN_CODES,"
  18. $ !        $ @MAKE_UNZ
  19. $ !
  20. $ !    The trailing "," may be omitted.  Valid VMS-specific options
  21. $ !    include VMSWILD and RETURN_CODES; see the INSTALL file
  22. $ !    for other options (e.g., CHECK_VERSIONS).
  23. $ !    NOTE: This command procedure does always generate both the
  24. $ !          "default" UnZip containing the UNIX style command interface
  25. $ !          and the "VMSCLI" UnZip containing the CLI compatible command
  26. $ !          interface. There is no need to add "VMSCLI" to the LOCAL_UNZIP
  27. $ !          symbol. (The only effect of "VMSCLI" is now the selection of the
  28. $ !          CLI style UnZip executable in the foreign command definition.)
  29. $ !
  30. $ !
  31. $ on error then goto error
  32. $ on control_y then goto error
  33. $ OLD_VERIFY = f$verify(0)
  34. $!
  35. $ edit := edit            ! override customized edit commands
  36. $ say := write sys$output
  37. $!##################### Read settings from environment ########################
  38. $!
  39. $ if f$type(LOCAL_UNZIP).eqs.""
  40. $ then
  41. $    local_unzip = ""
  42. $ else    ! Trim blanks and append comma if missing
  43. $    local_unzip = f$edit(local_unzip, "TRIM")
  44. $    if f$extract(f$length(local_unzip)-1, 1, local_unzip).nes."," then -
  45.         local_unzip = local_unzip + ","
  46. $ endif
  47. $! Check for the presence of "VMSCLI" in local_unzip. If yes, we will define
  48. $! the foreign command for "unzip" to use the executable containing the
  49. $! CLI interface.
  50. $ pos_cli = f$locate("VMSCLI",local_unzip)
  51. $ len_local_unzip = f$length(local_unzip)
  52. $ if pos_cli.ne.len_local_unzip
  53. $ then
  54. $   CLI_IS_DEFAULT = 1
  55. $   ! Remove "VMSCLI" macro from local_unzip. The UnZip executable including
  56. $   ! the CLI interface is now created unconditionally.
  57. $   local_unzip = f$extract(0, pos_cli, local_unzip) + -
  58. $        f$extract(pos_cli+7, len_local_unzip-(pos_cli+7), local_unzip)
  59. $ else
  60. $   CLI_IS_DEFAULT = 0
  61. $ endif
  62. $ delete/symbol/local pos_cli
  63. $ delete/symbol/local len_local_unzip
  64. $!##################### Customizing section #############################
  65. $!
  66. $ unzx_unx = "unzip"
  67. $ unzx_cli = "unzip_cli"
  68. $ unzsfx_unx = "unzipsfx"
  69. $ unzsfx_cli = "unzipsfx_cli"
  70. $!
  71. $ MAY_USE_DECC = 1
  72. $ MAY_USE_GNUC = 0
  73. $!
  74. $! Process command line parameters requesting optional features:
  75. $ arg_cnt = 1
  76. $ argloop:
  77. $  current_arg_name = "P''arg_cnt'"
  78. $  curr_arg = f$edit('current_arg_name',"UPCASE")
  79. $  IF curr_arg .eqs. "" THEN GOTO argloop_out
  80. $  IF curr_arg .eqs. "VAXC"
  81. $  THEN MAY_USE_DECC = 0
  82. $    MAY_USE_GNUC = 0
  83. $  ENDIF
  84. $  IF curr_arg .eqs. "DECC"
  85. $  THEN MAY_USE_DECC = 1
  86. $    MAY_USE_GNUC = 0
  87. $  ENDIF
  88. $  IF curr_arg .eqs. "GNUC"
  89. $  THEN MAY_USE_DECC = 0
  90. $    MAY_USE_GNUC = 1
  91. $  ENDIF
  92. $  IF (curr_arg .eqs. "VMSCLI") .or. (curr_arg .eqs. "CLI")
  93. $  THEN
  94. $    CLI_IS_DEFAULT = 1
  95. $  ENDIF
  96. $  IF (curr_arg .eqs. "NOVMSCLI") .or. (curr_arg .eqs. "NOCLI")
  97. $  THEN
  98. $    CLI_IS_DEFAULT = 0
  99. $  ENDIF
  100. $  arg_cnt = arg_cnt + 1
  101. $ GOTO argloop
  102. $ argloop_out:
  103. $!
  104. $ if CLI_IS_DEFAULT
  105. $ then
  106. $    UNZEXEC = unzx_cli
  107. $ else
  108. $    UNZEXEC = unzx_unx
  109. $ endif
  110. $!
  111. $!#######################################################################
  112. $!
  113. $ ! Find out current disk, directory, compiler and options
  114. $ !
  115. $ my_name = f$env("procedure")
  116. $ workdir = f$env("default")
  117. $ here = f$parse(workdir,,,"device") + f$parse(workdir,,,"directory")
  118. $ axp = f$getsyi("HW_MODEL").ge.1024
  119. $ if axp
  120. $ then
  121. $    ! Alpha AXP
  122. $    ARCH_NAME == "Alpha"
  123. $    ARCH_PREF = "AXP_"
  124. $    HAVE_DECC_VAX = 0
  125. $    USE_DECC_VAX = 0
  126. $    if MAY_USE_GNUC
  127. $    then say "GNU C has not yet been ported to OpenVMS AXP."
  128. $         say "You must use DEC C to build UnZip."
  129. $         goto error
  130. $    endif
  131. $    ARCH_CC_P = ARCH_PREF
  132. $    cc = "cc/standard=relax/prefix=all/ansi"
  133. $    defs = "''local_unzip'MODERN"
  134. $    opts = ""
  135. $    say "Compiling on AXP using DEC C"
  136. $ else
  137. $    ! VAX
  138. $    ARCH_NAME == "VAX"
  139. $    ARCH_PREF = "VAX_"
  140. $    HAVE_DECC_VAX = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes."")
  141. $    HAVE_VAXC_VAX = (f$search("SYS$SYSTEM:VAXC.EXE").nes."")
  142. $    MAY_HAVE_GNUC = (f$trnlnm("GNU_CC").nes."")
  143. $    IF HAVE_DECC_VAX .AND. MAY_USE_DECC
  144. $    THEN
  145. $!      We use DECC:
  146. $      USE_DECC_VAX = 1
  147. $      ARCH_CC_P = "''ARCH_PREF'DECC_"
  148. $      cc = "cc/decc/standard=vaxc/prefix=all"
  149. $      defs = "''local_unzip'MODERN"
  150. $      opts = ""
  151. $      say "Compiling on VAX using DEC C"
  152. $    ELSE
  153. $!      We use VAXC (or GNU C):
  154. $      USE_DECC_VAX = 0
  155. $      defs = "''local_unzip'VMS"
  156. $      opts = ",SYS$DISK:[.VMS]VAXCSHR.OPT/OPTIONS"
  157. $      if (.not.HAVE_VAXC_VAX .and. MAY_HAVE_GNUC) .or. (MAY_USE_GNUC)
  158. $      then
  159. $        ARCH_CC_P = "''ARCH_PREF'GNUC_"
  160. $        cc = "gcc"
  161. $        opts = ",GNU_CC:[000000]GCCLIB.OLB/LIB ''opts'"
  162. $        say "Compiling on VAX using GNU C"
  163. $      else
  164. $        ARCH_CC_P = "''ARCH_PREF'VAXC_"
  165. $        if HAVE_DECC_VAX
  166. $        then
  167. $            cc = "cc/vaxc"
  168. $        else
  169. $            cc = "cc"
  170. $        endif
  171. $        say "Compiling on VAX using VAX C"
  172. $      endif
  173. $    ENDIF
  174. $ endif
  175. $ DEF_UNX = "/define=(''defs')"
  176. $ DEF_CLI = "/define=(''defs',VMSCLI)"
  177. $ DEF_SXUNX = "/define=(''defs',SFX)"
  178. $ DEF_SXCLI = "/define=(''defs',VMSCLI,SFX)"
  179. $ LFLAGS = "/notrace"
  180. $ if (opts .nes. "") .and. (f$search("[.vms]vaxcshr.opt") .eqs. "")
  181. $ then    create [.vms]vaxcshr.opt
  182. $    open/append tmp [.vms]vaxcshr.opt
  183. $    write tmp "SYS$SHARE:VAXCRTL.EXE/SHARE"
  184. $    close tmp
  185. $ endif
  186. $ !
  187. $ ! Currently, the following section is not needed, as vms.c does no longer
  188. $ ! include any of the headers from SYS$LIB_C.TLB.
  189. $ ! The commented section is solely maintained for reference.
  190. $ ! In case system headers from SYS$LIB_C.TLB are needed again,
  191. $ ! just append "'x'" to the respective source file specification.
  192. $! x = f$search("SYS$LIBRARY:SYS$LIB_C.TLB")
  193. $! if x .nes. "" then x = "+" + x
  194. $ !
  195. $ tmp = f$verify(1)    ! Turn echo on to see what's happening
  196. $ !
  197. $ !------------------------------- UnZip section ------------------------------
  198. $ !
  199. $ runoff/out=unzip.hlp [.vms]unzip_def.rnh
  200. $ !
  201. $ cc/NOLIST'DEF_UNX' /OBJ=unzip.'ARCH_CC_P'obj unzip.c
  202. $ cc/NOLIST'DEF_UNX' /OBJ=crc32.'ARCH_CC_P'obj crc32.c
  203. $ cc/NOLIST'DEF_UNX' /OBJ=crctab.'ARCH_CC_P'obj crctab.c
  204. $ cc/NOLIST'DEF_UNX' /OBJ=crypt.'ARCH_CC_P'obj crypt.c
  205. $ cc/NOLIST'DEF_UNX' /OBJ=envargs.'ARCH_CC_P'obj envargs.c
  206. $ cc/NOLIST'DEF_UNX' /OBJ=explode.'ARCH_CC_P'obj explode.c
  207. $ cc/NOLIST'DEF_UNX' /OBJ=extract.'ARCH_CC_P'obj extract.c
  208. $ cc/NOLIST'DEF_UNX' /OBJ=fileio.'ARCH_CC_P'obj fileio.c
  209. $ cc/NOLIST'DEF_UNX' /OBJ=globals.'ARCH_CC_P'obj globals.c
  210. $ cc/NOLIST'DEF_UNX' /OBJ=inflate.'ARCH_CC_P'obj inflate.c
  211. $ cc/NOLIST'DEF_UNX' /OBJ=list.'ARCH_CC_P'obj list.c
  212. $ cc/NOLIST'DEF_UNX' /OBJ=match.'ARCH_CC_P'obj match.c
  213. $ cc/NOLIST'DEF_UNX' /OBJ=process.'ARCH_CC_P'obj process.c
  214. $ cc/NOLIST'DEF_UNX' /OBJ=ttyio.'ARCH_CC_P'obj ttyio.c
  215. $ cc/NOLIST'DEF_UNX' /OBJ=unreduce.'ARCH_CC_P'obj unreduce.c
  216. $ cc/NOLIST'DEF_UNX' /OBJ=unshrink.'ARCH_CC_P'obj unshrink.c
  217. $ cc/NOLIST'DEF_UNX' /OBJ=zipinfo.'ARCH_CC_P'obj zipinfo.c
  218. $ cc/INCLUDE=SYS$DISK:[]'DEF_UNX' /OBJ=vms.'ARCH_CC_P'obj; [.vms]vms.c
  219. $ !
  220. $ if f$search("unzip.''ARCH_CC_P'olb") .eqs. "" then -
  221.     lib/obj/create unzip.'ARCH_CC_P'olb
  222. $ lib/obj/replace unzip.'ARCH_CC_P'olb -
  223.     unzip.'ARCH_CC_P'obj;, crc32.'ARCH_CC_P'obj;, -
  224.     crctab.'ARCH_CC_P'obj;, crypt.'ARCH_CC_P'obj;, -
  225.     envargs.'ARCH_CC_P'obj;, explode.'ARCH_CC_P'obj;, -
  226.     extract.'ARCH_CC_P'obj;, fileio.'ARCH_CC_P'obj;, -
  227.     globals.'ARCH_CC_P'obj;, inflate.'ARCH_CC_P'obj;, -
  228.     list.'ARCH_CC_P'obj;, match.'ARCH_CC_P'obj;, -
  229.     process.'ARCH_CC_P'obj;, ttyio.'ARCH_CC_P'obj;, -
  230.     unreduce.'ARCH_CC_P'obj;, unshrink.'ARCH_CC_P'obj;, -
  231.     zipinfo.'ARCH_CC_P'obj;, vms.'ARCH_CC_P'obj;
  232. $ !
  233. $ link'LFLAGS'/exe='unzx_unx'.'ARCH_CC_P'exe -
  234.     unzip.'ARCH_CC_P'olb;/incl=(unzip)/lib -
  235.     'opts', [.VMS]unzip.opt/opt
  236. $ !
  237. $ !----------------------- UnZip (CLI interface) section ----------------------
  238. $ !
  239. $ set default [.vms]
  240. $ edit/tpu/nosection/nodisplay/command=cvthelp.tpu unzip_cli.help
  241. $ set default [-]
  242. $ runoff/out=unzip_cli.hlp [.vms]unzip_cli.rnh
  243. $ !
  244. $ cc/NOLIST'DEF_CLI' /OBJ=unzipcli.'ARCH_CC_P'obj unzip.c
  245. $ cc/INCLUDE=SYS$DISK:[]'DEF_CLI' /OBJ=cmdline.'ARCH_CC_P'obj; -
  246.         [.vms]cmdline.c
  247. $ set command/obj=unz_cli.'ARCH_CC_P'obj [.vms]unz_cli.cld
  248. $ !
  249. $ if f$search("unzipcli.''ARCH_CC_P'olb") .eqs. "" then -
  250.     lib/obj/create unzipcli.'ARCH_CC_P'olb
  251. $ lib/obj/replace unzipcli.'ARCH_CC_P'olb -
  252.     unzipcli.'ARCH_CC_P'obj;, -
  253.     cmdline.'ARCH_CC_P'obj;, unz_cli.'ARCH_CC_P'obj;
  254. $ !
  255. $ link'LFLAGS'/exe='unzx_cli'.'ARCH_CC_P'exe -
  256.     unzipcli.'ARCH_CC_P'olb;/incl=(unzip)/lib, -
  257.     unzip.'ARCH_CC_P'olb;/lib -
  258.     'opts', [.VMS]unzip.opt/opt
  259. $ !
  260. $ !-------------------------- UnZipSFX section --------------------------------
  261. $ !
  262. $ cc/NOLIST'DEF_SXUNX' /OBJ=unzipsfx.'ARCH_CC_P'obj unzip.c
  263. $ cc/NOLIST'DEF_SXUNX' /OBJ=extract_.'ARCH_CC_P'obj extract.c
  264. $ cc/NOLIST'DEF_SXUNX' /OBJ=process_.'ARCH_CC_P'obj process.c
  265. $ cc/NOLIST'DEF_SXUNX'/INCLUDE=SYS$DISK:[] /OBJ=vms_.'ARCH_CC_P'obj; -
  266.     [.vms]vms.c
  267. $ if f$search("unzipsfx.''ARCH_CC_P'olb") .eqs. "" then -
  268.     lib/obj/create unzipsfx.'ARCH_CC_P'olb
  269. $ lib/obj/replace unzipsfx.'ARCH_CC_P'olb -
  270.     unzipsfx.'ARCH_CC_P'obj, crc32.'ARCH_CC_P'obj, -
  271.     crctab.'ARCH_CC_P'obj, crypt.'ARCH_CC_P'obj, -
  272.     extract_.'ARCH_CC_P'obj, fileio.'ARCH_CC_P'obj, -
  273.     globals.'ARCH_CC_P'obj, inflate.'ARCH_CC_P'obj, -
  274.     match.'ARCH_CC_P'obj, process_.'ARCH_CC_P'obj, -
  275.     ttyio.'ARCH_CC_P'obj, vms_.'ARCH_CC_P'obj
  276. $ !
  277. $ link'LFLAGS'/exe='unzsfx_unx'.'ARCH_CC_P'exe -
  278.     unzipsfx.'ARCH_CC_P'olb;/lib/incl=unzip -
  279.     'opts', [.VMS]unzipsfx.opt/opt
  280. $ !
  281. $ !--------------------- UnZipSFX (CLI interface) section ---------------------
  282. $ !
  283. $ cc/NOLIST'DEF_SXCLI' /OBJ=unzsxcli.'ARCH_CC_P'obj unzip.c
  284. $ cc/NOLIST/INCLUDE=SYS$DISK:[]'DEF_SXCLI' /OBJ=cmdline_.'ARCH_CC_P'obj; -
  285.         [.vms]cmdline.c
  286. $ if f$search("unzsxcli.''ARCH_CC_P'olb") .eqs. "" then -
  287.     lib/obj/create unzsxcli.'ARCH_CC_P'olb
  288. $ lib/obj/replace unzsxcli.'ARCH_CC_P'olb -
  289.     unzsxcli.'ARCH_CC_P'obj;, -
  290.     cmdline_.'ARCH_CC_P'obj;, unz_cli.'ARCH_CC_P'obj;
  291. $ !
  292. $ link'LFLAGS'/exe='unzsfx_cli'.'ARCH_CC_P'exe -
  293.     unzsxcli.'ARCH_CC_P'olb;/lib/incl=unzip, -
  294.     unzipsfx.'ARCH_CC_P'olb;/lib -
  295.     'opts', [.VMS]unzipsfx.opt/opt
  296. $ !
  297. $ !----------------------------- Symbols section ------------------------------
  298. $ !
  299. $ ! Next line:  put similar lines (full pathname for unzip.'ARCH_CC_P'exe) in
  300. $ ! login.com.  Remember to include the leading "$" before disk name.
  301. $ !
  302. $ unzip   == "$''here'''UNZEXEC'.''ARCH_CC_P'exe"
  303. $ zipinfo == "$''here'''UNZEXEC'.''ARCH_CC_P'exe ""-Z"""
  304. $ !
  305. $error:
  306. $ if here .nes. "" then set default 'here'
  307. $ tmp = f$verify(OLD_VERIFY)
  308. $ exit
  309.