2 print_string
"usage: ";
3 print_string
(Filename.basename
Sys.executable_name
);
4 print_endline
" command [ command-argument ] [ arguments ... ]";
5 print_endline
"command is one of: ";
6 List.iter
(fun s
-> print_string
" "; print_endline s
)
8 " run `cl [arguments]' sanitizing output (converting paths etc)";
12 " run `cl /E [arguments]'";
13 " search output for headers";
14 " print `target: <list-of-headers>' to standard output";
18 " run `cl /showIncludes /Zs [arguments]'";
23 " test if cl is new enough and has /showIncludes option";
26 "cldep7 target depfile";
27 " run `cl /showIncludes [arguments]'";
28 " same as cl+dep7 but put the dependency information into file <depfile>";
33 " run `link [arguments]'";
37 " show this help screen";
40 let exp_cmd, run_cmd
=
43 "C:\\> set ", "C:\\> "
47 List.iter print_endline
48 ["If environment variable IMT_[CL|LINK] is set it will be used as the ";
49 "path to respective utility, otherwise [cl.exe|link.exe] will be used";
51 "If environment variable IMT_VIA is set it will be used as the path ";
52 "to the application to run instead of [cl.exe|link.exe]";
53 "IMT_VIA_PASS_NAME environment variable can be used to specify the name";
54 "of the corresponding utility down the chain";
55 "IMT_VIA_PASS_ARGS can be used to pass parameters of the utility";
57 "Headers produced by [cl]dep[7] commands will be tested against IMT_REJ";
58 "environment variable (: separated list of OCaml style regular expressions)";
59 "if the path to header matches it will be excluded from the printout";
60 "(paths are tested after windows to unix translation (nop on Win platforms))";
63 exp_cmd ^
"IMT_REJ=/mnt/windows/msc/include:/mnt/psdk/include";
64 exp_cmd ^
"IMT_CL=/mnt/windows/msc/bin/cl.exe";
65 run_cmd ^
"imt cldep7 moo.obj moo.dep -c moo.c";
67 exp_cmd ^
"IMT_VIA=ocamlc";
68 exp_cmd ^
"IMT_VIA_PASS_NAME=-cc";
69 exp_cmd ^
"IMT_VIA_PASS_ARGS=-ccopt";
70 run_cmd ^
"imt cl -c moo.ml";
71 "will result in execution of `ocamlc -cc \"cl\" -ccopt \"-nologo\" moo.ml'";
74 print_endline
"Have a nice day";
78 print_endline
"Incredible Mega Thing by extremely cool hacker, Version 1.01";
80 print_string
"usage: ";
81 print_string
(Filename.basename
Sys.executable_name
);
82 print_endline
" command [ command-argument ] [ arguments ... ]";
83 print_endline
"command is one of: ";
84 List.iter
(fun s
-> print_string
" "; print_endline s
)
86 "dep target: invoke cl /E, parse output, print dependencies to stdout";
87 "dep7 target: invoke cl /showIncludes /Zs, same as dep";
88 "dep7-test: test if /showIncludes is available, exit with non-zero if not";
89 "cldep7 target depfile: cl+dep7 combined, put dependencies into depfile";
91 "help: show extended help"
93 print_endline
"Have a nice day";
97 if Array.length argv
< 2
109 if Array.length argv
< 3
113 let target = argv
.(2) in
114 Dep7.invoke
target argv
3
117 if Array.length argv
< 3
121 let target = argv
.(2) in
122 Dep.invoke
target argv
3
131 if Array.length argv
< 4
135 let target = argv
.(2)
136 and depfile
= argv
.(3) in
137 Dep7.invoke2
target depfile argv
4
143 prerr_string
"invalid command: ";
144 prerr_string
(String.escaped cmd
);