-
Notifications
You must be signed in to change notification settings - Fork 0
/
OMakefile
79 lines (62 loc) · 1.59 KB
/
OMakefile
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
# Change this to the name of the lua library on your system
LUA_LIB = lua5.2
# change this to the directory where the lua header files are stored
LUA_INCLUDE_DIR = /usr/include/lua5.2
if $(not $(defined DEST_DIR))
DEST_DIR = ""
export
_LIB_DIR =
if $(defined LIB_DIR)
_LIB_DIR = $(LIB_DIR)
export
else
if $(defined OCAMLLIB)
_LIB_DIR = $(OCAMLLIB)
export
else
_LIB_DIR = $(nth 0, $(shell ocamlc -where))
export
export
OBJ =
TARGETS = libocamlua.a
USE_CUSTOM = false
MKLIB_FLAGS =
if $(NATIVE_ENABLED)
TARGETS += ocamlua.cmxa ocamlua.a
OBJ += ocamlua.cmx
export
if $(BYTE_ENABLED)
TARGETS += ocamlua.cma
OBJ += ocamlua.cmo
if $(USE_CUSTOM)
MKLIB_FLAGS += -custom
export
else
TARGETS += dllocamlua.so
export
export
C_OBJ = ocamlua_stubs.o
$(C_OBJ): ocamlua_stubs.c
$(OCAMLC) -ccopt -Wall -ccopt -fPIC -I $(LUA_INCLUDE_DIR) $<
$(TARGETS): $(C_OBJ) $(OBJ)
ocamlmklib $(MKLIB_FLAGS) -o ocamlua $^ -l$(LUA_LIB)
.DEFAULT: $(TARGETS)
.PHONY: clean install
INSTALL_DIR = $(DEST_DIR)$(DIRSEP)$(_LIB_DIR)
install: $(TARGETS)
$(INSTALL) -d $(INSTALL_DIR)
$(INSTALL) -t $(INSTALL_DIR) $(filter-out dllocamlua.so, $(TARGETS))
if $(and $(BYTE_ENABLED) $(USE_CUSTOM))
install -d $(INSTALL_DIR)$(DIRSEP)stublibs
$(INSTALL) -t $(INSTALL_DIR)$(DIRSEP)stublibs dllocamlua.so
OCAML_LIBS += ocamlua
OCAML_NATIVE_LINK_FLAGS += -cclib -L.
OCAMLPACKS[] =
oUnit
FILES[] =
ocamlua_test
PROGRAM = ocamlua_test
USE_OCAMLFIND = true
OCamlProgram($(PROGRAM), $(FILES))
clean:
rm -f $(TARGETS) $(C_OBJ) dllocamlua.so libocamlua.a ocamlua.a *.cm* *.o ocamlua_test.opt ocamlua_test ocamlua_test.run