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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
(library
(name posix_base)
(public_name posix-base)
(modules posix_base system_detect lfs_detect clibs_include_path)
(synopsis
"posix-base provides the base tools to generate the various posix bindings")
(libraries ctypes.stubs integers))
(executable
(modules gen_clibs_include_path)
(name gen_clibs_include_path))
(executable
(modules gen_exec_path)
(name gen_exec_path)
(libraries unix))
(rule
(target exec_path)
(deps exec.sh)
(action
(with-stdout-to
%{target}
(run %{exe:gen_exec_path.exe} exec.sh))))
(rule
(target clibs_include_path.ml)
(action
(with-stdout-to
%{target}
(run
%{exe:gen_clibs_include_path.exe}
%{lib:ctypes:ctypes_cstubs_internals.h}))))
(rule
(targets target_system_detect.exe)
(deps target_system_detect.c)
(action
(run
%{ocaml-config:c_compiler}
-DOCAML_POSIX_ERRNO_SYSTEM=ocaml_posix_%{system}
-o
%{targets}
target_system_detect.c)))
(rule
(targets off_t_size_native.exe)
(deps off_t_size.c)
(action
(run %{ocaml-config:c_compiler} -o %{targets} off_t_size.c)))
(rule
(targets off_t_size_lfs.exe)
(deps off_t_size.c)
(action
(run
%{ocaml-config:c_compiler}
-D_FILE_OFFSET_BITS=64
-o
%{targets}
off_t_size.c)))
(rule
(targets off_t_size_native)
(enabled_if
(= %{ocaml-config:host} %{ocaml-config:target}))
(deps off_t_size_native.exe)
(action
(with-stdout-to
%{targets}
(run ./off_t_size_native.exe))))
(rule
(targets off_t_size_native)
(enabled_if
(<> %{ocaml-config:host} %{ocaml-config:target}))
(deps exec_path off_t_size_native.exe)
(action
(with-stdout-to
%{targets}
(system
"%{read:exec_path} %{ocaml-config:system} ./off_t_size_native.exe"))))
(rule
(targets off_t_size_lfs)
(enabled_if
(= %{ocaml-config:host} %{ocaml-config:target}))
(deps off_t_size_lfs.exe)
(action
(with-stdout-to
%{targets}
(run ./off_t_size_lfs.exe))))
(rule
(targets off_t_size_lfs)
(enabled_if
(<> %{ocaml-config:host} %{ocaml-config:target}))
(deps exec_path off_t_size_lfs.exe)
(action
(with-stdout-to
%{targets}
(system "%{read:exec_path} %{ocaml-config:system} ./off_t_size_lfs.exe"))))
(executable
(name gen_lfs_detect)
(modules gen_lfs_detect))
(rule
(targets lfs_detect.ml)
(deps off_t_size_native off_t_size_lfs gen_lfs_detect.exe)
(action
(with-stdout-to
%{targets}
(run ./gen_lfs_detect.exe off_t_size_native off_t_size_lfs))))
(executable
(name gen_config)
(modules gen_config)
(libraries posix-base))
(rule
(targets c_flags.inc)
(deps gen_config.exe)
(action
(with-stdout-to
%{targets}
(run ./gen_config.exe dune))))
(rule
(targets c_flags)
(deps gen_config.exe)
(action
(with-stdout-to
%{targets}
(run ./gen_config.exe include))))
(rule
(targets system_detect.ml)
(enabled_if
(<> %{ocaml-config:host} %{ocaml-config:target}))
(deps
exec_path
(:gen target_system_detect.exe))
(action
(with-stdout-to
%{targets}
(system "%{read:exec_path} %{ocaml-config:system} %{gen}"))))
(rule
(targets system_detect.ml)
(enabled_if
(= %{ocaml-config:host} %{ocaml-config:target}))
(deps
(:gen target_system_detect.exe))
(action
(with-stdout-to
%{targets}
(run %{gen}))))
|