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