This repository has been archived by the owner on Nov 14, 2024. It is now read-only.
forked from yallop/ocaml-ctypes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.examples
147 lines (126 loc) · 5.02 KB
/
Makefile.examples
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
# -*- Makefile -*-
# subproject: fts with stub generation
fts-stubs.install = no
fts-stubs.dir = examples/fts/stub-generation/bindings
fts-stubs.threads = yes
fts-stubs.deps = integers
fts-stubs.subproject_deps = ctypes ctypes-foreign
fts-stubs: PROJECT=fts-stubs
fts-stubs: $$(LIB_TARGETS)
fts-stub-generator.install = no
fts-stub-generator.dir = examples/fts/stub-generation/stub-generator
fts-stub-generator.threads = yes
fts-stub-generator.deps = integers
fts-stub-generator.subproject_deps = ctypes cstubs \
ctypes-foreign fts-stubs
fts-stub-generator.deps = str unix bigarray-compat integers
fts-stub-generator: PROJECT=fts-stub-generator
fts-stub-generator: $$(NATIVE_TARGET)
fts-cmd.install = no
fts-cmd.dir = examples/fts/stub-generation
fts-cmd.threads = yes
fts-cmd.subproject_deps = ctypes \
ctypes-foreign fts-stubs
fts-cmd.deps = str unix bigarray-compat integers
fts-cmd.extra_mls = fts_generated.ml
fts-cmd.extra_cs = fts_stubs.c
fts-cmd: CFLAGS+=-D_FILE_OFFSET_BITS=32
fts-cmd: PROJECT=fts-cmd
fts-cmd: $$(NATIVE_TARGET)
fts-cmd-build: examples/fts/stub-generation/fts_generated.ml
examples/fts/stub-generation/fts_generated.ml: fts-stub-generator
_build/fts-stub-generator.native
# subproject: fts using dynamic linking (foreign)
fts.install = no
fts.dir = examples/fts/foreign
fts.threads = yes
fts.deps = unix bigarray-compat str integers
fts.subproject_deps = ctypes ctypes-foreign
fts: PROJECT=fts
fts: $$(NATIVE_TARGET)
# subproject: date with stub generation
date-stubs.install = no
date-stubs.dir = examples/date/stub-generation/bindings
date-stubs.subproject_deps = ctypes
date-stubs: PROJECT=date-stubs
date-stubs: $$(LIB_TARGETS)
date-stub-generator.install = no
date-stub-generator.dir = examples/date/stub-generation/stub-generator
date-stub-generator.subproject_deps = ctypes cstubs date-stubs
date-stub-generator.deps = str unix bigarray-compat integers
date-stub-generator: PROJECT=date-stub-generator
date-stub-generator: $$(NATIVE_TARGET)
date-cmd.install = no
date-cmd.dir = examples/date/stub-generation
date-cmd.subproject_deps = ctypes date-stubs
date-cmd.deps = str unix bigarray-compat integers
date-cmd.extra_mls = date_generated.ml
date-cmd.extra_cs = date_stubs.c
date-cmd: PROJECT=date-cmd
date-cmd: $$(NATIVE_TARGET)
date-cmd-build: examples/date/stub-generation/date_generated.ml
examples/date/stub-generation/date_generated.ml:
_build/date-stub-generator.native
# subproject: date using dynamic linking (foreign)
date.install = no
date.dir = examples/date/foreign
date.threads = yes
date.subproject_deps = ctypes ctypes-foreign
date.deps = unix bigarray-compat str integers
date: PROJECT=date
date: $$(NATIVE_TARGET)
# subproject: ncurses with stub generation
ncurses-stubs.install = no
ncurses-stubs.dir = examples/ncurses/stub-generation/bindings
ncurses-stubs.subproject_deps = ctypes
ncurses-stubs.deps = str unix bigarray-compat integers
ncurses-stubs: PROJECT=ncurses-stubs
ncurses-stubs: $$(NATIVE_TARGET) $$(LIB_TARGETS)
ncurses-stub-generator.install = no
ncurses-stub-generator.dir = examples/ncurses/stub-generation/stub-generator
ncurses-stub-generator.threads = yes
ncurses-stub-generator.deps = integers
ncurses-stub-generator.subproject_deps = ctypes cstubs \
ctypes-foreign ncurses-stubs
ncurses-stub-generator.deps = str unix bigarray-compat integers
ncurses-stub-generator: PROJECT=ncurses-stub-generator
ncurses-stub-generator: $$(NATIVE_TARGET)
ncurses-cmd.install = no
ncurses-cmd.dir = examples/ncurses/stub-generation
ncurses-cmd.subproject_deps = ctypes ncurses-stubs
ncurses-cmd.deps = str unix bigarray-compat integers
ncurses-cmd.extra_mls = ncurses_generated.ml
ncurses-cmd.extra_cs = ncurses_stubs.c
ncurses-cmd.link_flags = -lncurses
ncurses-cmd: PROJECT=ncurses-cmd
ncurses-cmd: $$(NATIVE_TARGET)
ncurses-cmd-build: examples/ncurses/stub-generation/ncurses_generated.ml
examples/ncurses/stub-generation/ncurses_generated.ml: ncurses-stubs
_build/ncurses-stub-generator.native
# subproject: ncurses using dynamic linking (foreign)
ncurses.install = no
ncurses.dir = examples/ncurses/foreign
ncurses.threads = yes
ncurses.subproject_deps = ctypes ctypes-foreign
ncurses.deps = unix bigarray-compat str integers
ncurses.link_flags = -lncurses
ncurses: PROJECT=ncurses
ncurses: $$(NATIVE_TARGET)
EXAMPLES =
EXAMPLES += ncurses ncurses-stubs ncurses-stub-generator ncurses-cmd-build ncurses-cmd
EXAMPLES += fts fts-stubs fts-stub-generator fts-cmd-build fts-cmd
EXAMPLES += date date-stubs date-stub-generator date-cmd-build date-cmd
run-examples: examples
# this doesn't run the ncurses example, which takes control of the terminal
_build/date.native
_build/date-cmd.native
_build/fts-cmd.native src
EXAMPLES_GENERATED=$(foreach example,$(EXAMPLES),\
$(if $($(example).extra_mls), \
$($(example).dir)/$($(example).extra_mls)) \
$(if $($(example).extra_cs), \
$($(example).dir)/$($(example).extra_cs)))
clean-examples:
rm -f $(EXAMPLES_GENERATED)
.PHONY: build $(EXAMPLES) clean-examples
examples: build $(EXAMPLES)