| 1 |
$! |
| 2 |
$! |
| 3 |
$ olddir = f$environment("default") |
| 4 |
$ on control_y then goto YExit |
| 5 |
$! |
| 6 |
$ gosub Init |
| 7 |
$ if .not. init_status then goto YExit |
| 8 |
$! |
| 9 |
$ if what .eqs. "ALL" |
| 10 |
$ then |
| 11 |
$ call MakeAll |
| 12 |
$ else |
| 13 |
$ call Make |
| 14 |
$endif |
| 15 |
$! |
| 16 |
$YExit: |
| 17 |
$ set noon |
| 18 |
$! deassign exadir |
| 19 |
$! deassign objdir |
| 20 |
$ delete 'link_opts';* |
| 21 |
$ set default 'olddir' |
| 22 |
$exit |
| 23 |
|
| 24 |
$MakeAll: subroutine |
| 25 |
$! |
| 26 |
$ set noon |
| 27 |
$Loop: |
| 28 |
$ this = f$search("exadir:*.c;0") |
| 29 |
$ if this .eqs. "" then goto EndLoop |
| 30 |
$! |
| 31 |
$ what = f$parse( this,,,"name") |
| 32 |
$ if what .eqs. "x11" then goto loop ! not portable yet |
| 33 |
$ call Make |
| 34 |
$! |
| 35 |
$ goto Loop |
| 36 |
$EndLoop: |
| 37 |
$! |
| 38 |
$exit |
| 39 |
$endsubroutine |
| 40 |
|
| 41 |
|
| 42 |
$Make: subroutine |
| 43 |
$! |
| 44 |
$ set noon |
| 45 |
$! |
| 46 |
$ cc 'cc_include' 'cc_flags'/object=objdir:'what' exadir:'what' |
| 47 |
$ sev = $severity |
| 48 |
$ if sev .and. 2 |
| 49 |
$ then |
| 50 |
$ say "Error compiling ''what', not linked." |
| 51 |
$ else |
| 52 |
$ if .not. (sev .and. 1) |
| 53 |
$ then |
| 54 |
$ say "Compile warnings in ''what'" |
| 55 |
$ endif |
| 56 |
$ link/exe='what'.exe objdir:'what'.obj, 'link_opts'/opt |
| 57 |
$ endif |
| 58 |
$! |
| 59 |
$! |
| 60 |
$End: |
| 61 |
$ delete objdir:'what'.obj;* |
| 62 |
$exit |
| 63 |
$endsubroutine |
| 64 |
|
| 65 |
|
| 66 |
$Init: |
| 67 |
$! |
| 68 |
$! |
| 69 |
$ init_status = 1 |
| 70 |
$ thisid = f$integer( %x'f$getjpi(0,"pid")') + "''f$cvtime(,,"second")'" |
| 71 |
$ mdir = f$environment("procedure") |
| 72 |
$ mdir = mdir - f$parse(mdir,,,"name") - f$parse(mdir,,,"type") - f$parse(mdir,,,"version") |
| 73 |
$ set default 'mdir' |
| 74 |
$! |
| 75 |
$ objdir = "[.example_objects]" |
| 76 |
$ exadir = "[-.example]" |
| 77 |
$! |
| 78 |
$ objdirfile = objdir - "[." - "]" + ".dir" |
| 79 |
$ if f$search( objdirfile ) .eqs. "" |
| 80 |
$ then |
| 81 |
$ create/directory 'objdir' |
| 82 |
$ endif |
| 83 |
$! |
| 84 |
$ define objdir 'objdir' |
| 85 |
$ define exadir 'exadir' |
| 86 |
$! |
| 87 |
$ cc_include = "/include=([],[-.include])" |
| 88 |
$ cc_flags = "/name=shortened/show=all/define=(_USE_STD_STAT=1)" |
| 89 |
$ link_opts = "objdir:libssh2_''thisid'.opt" |
| 90 |
$! |
| 91 |
$! |
| 92 |
$ what = "''p1'" |
| 93 |
$ if what .eqs. "" .or. f$edit(p1,"trim,collapse,upcase") .eqs. "ALL" |
| 94 |
$ then |
| 95 |
$ what = "ALL" |
| 96 |
$ else |
| 97 |
$ what = f$parse(what,,,"name") |
| 98 |
$ if f$search("exadir:''what'.c") .eqs. "" |
| 99 |
$ then |
| 100 |
$ write sys$output "Can't make ''what'" |
| 101 |
$ init_status = 0 |
| 102 |
$ endif |
| 103 |
$ endif |
| 104 |
$! |
| 105 |
$ currentlib = f$search("libssh2*.exe") |
| 106 |
$! |
| 107 |
$ define libssh2 'currentlib' |
| 108 |
$! |
| 109 |
$ how = "''p2'" |
| 110 |
$ if how .eqs. "" .or. f$edit(p2,"trim,collapse,upcase") .eqs. "STATIC" |
| 111 |
$ then |
| 112 |
$ open/write lout 'link_opts' |
| 113 |
$ write lout "libssh2.olb/lib" |
| 114 |
$ write lout "sys$share:ssl$libcrypto_shr32.exe/share" |
| 115 |
$ write lout "sys$share:ssl$libssl_shr32.exe/share" |
| 116 |
$ write lout "gnv$libzshr/share" |
| 117 |
$ close lout |
| 118 |
$ else |
| 119 |
$ how = "SHARED" |
| 120 |
$ open/write lout 'link_opts' |
| 121 |
$ write lout "libssh2/share" |
| 122 |
$ close lout |
| 123 |
$ endif |
| 124 |
$! |
| 125 |
$return |