Skip to content

Commit f5b7c12

Browse files
committed
Switch to jbuilder
1 parent c0ae4d9 commit f5b7c12

9 files changed

Lines changed: 68 additions & 89 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ asm
88
*/*.o
99
*/*.byte
1010
*/*.opt
11+
_build

.merlin

Lines changed: 0 additions & 2 deletions
This file was deleted.

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0.1
2+
3+
------------
4+
5+
* Initial release

Makefile

Lines changed: 16 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,24 @@
1-
COMPILE_ARG=-g -bin-annot -annot -keep-locs -w +a-37 -warn-error +a
2-
COMPILE_OPT_ARG=$(COMPILE_ARG)
1+
INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),)
32

4-
all: natdynlink
3+
# Default rule
4+
default:
5+
jbuilder build @install
56

6-
byte: lib/nullable_array.cma
7-
native: lib/nullable_array.cmxa byte
8-
natdynlink: lib/nullable_array.cmxs native
7+
test:
8+
jbuilder runtest
99

10-
lib/nullable_array.cmi: lib/nullable_array.mli
11-
ocamlc $(COMPILE_ARG) -c $< -o $@
12-
13-
lib/nullable_array.cmo: lib/nullable_array.ml lib/nullable_array.cmi
14-
ocamlc $(COMPILE_ARG) -I lib -c $< -o $@
15-
16-
lib/nullable_array.cmx: lib/nullable_array.ml lib/nullable_array.cmi
17-
ocamlopt $(COMPILE_OPT_ARG) -I lib -c $< -o $@
18-
19-
lib/nullable_array.cmxa: lib/nullable_array.cmx
20-
ocamlopt $(COMPILE_OPT_ARG) -I lib -a $? -o $@
21-
22-
lib/nullable_array.cmxs: lib/nullable_array.cmx
23-
ocamlopt $(COMPILE_OPT_ARG) -I lib -shared $? -o $@
24-
25-
lib/nullable_array.cma: lib/nullable_array.cmo
26-
ocamlc $(COMPILE_ARG) -I lib -a $? -o $@
27-
28-
clean::
29-
rm -f lib/*.a lib/*.o lib/*.cma lib/*.cmo lib/*.cmx lib/*.cmi \
30-
lib/*.cmxa lib/*.cmxs lib/*.cmt lib/*.cmti lib/*.annot
31-
32-
TEST_COMPILE_ARG=-g -I lib -I test -w +a
33-
34-
test: test_native
35-
36-
test_byte: test/basic.byte test/basic_float.byte
37-
test_native: test_byte test/basic.opt test/basic_float.opt
38-
39-
test/basic.byte: test/basic.mli test/basic.ml byte
40-
ocamlc $(TEST_COMPILE_ARG) lib/nullable_array.cma test/basic.mli test/basic.ml -o $@
41-
$@
42-
43-
test/basic.opt: test/basic.mli test/basic.ml native
44-
ocamlopt $(TEST_COMPILE_ARG) lib/nullable_array.cmxa test/basic.mli test/basic.ml -o $@
45-
$@
46-
47-
test/basic_float.byte: test/basic_float.mli test/basic_float.ml byte
48-
ocamlc $(TEST_COMPILE_ARG) lib/nullable_array.cma test/basic_float.mli test/basic_float.ml -o $@
49-
$@
50-
51-
test/basic_float.opt: test/basic_float.mli test/basic_float.ml native
52-
ocamlopt $(TEST_COMPILE_ARG) lib/nullable_array.cmxa test/basic_float.mli test/basic_float.ml -o $@
53-
$@
54-
55-
html:
56-
mkdir -p html
57-
58-
html_doc: lib/nullable_array.mli | html
59-
ocamldoc -html -d html/ $?
60-
61-
man:
62-
mkdir -p man
63-
64-
man_doc: lib/nullable_array.mli | man
65-
ocamldoc -man -man-mini -d man/ $?
66-
67-
doc: man_doc html_doc
68-
69-
clean::
70-
rm -f test/*.a test/*.o test/*.cma test/*.cmo test/*.cmx test/*.cmi \
71-
test/*.cmxa test/*.cmxs test/*.cmt test/*.cmti test/*.annot \
72-
html/* man/* test/*.byte test/*.opt
73-
rmdir -p html man
10+
dev:
11+
jbuilder build --dev @install
7412

7513
install:
76-
ocamlfind install nullable_array META \
77-
lib/*.a lib/*.o lib/*.cma lib/*.cmo lib/*.cmx lib/*.cmi \
78-
lib/*.cmxa lib/*.cmxs lib/*.cmt lib/*.cmti lib/*.annot
14+
jbuilder install $(INSTALL_ARGS)
7915

8016
uninstall:
81-
ocamlfind remove nullable_array
17+
jbuilder uninstall $(INSTALL_ARGS)
18+
19+
reinstall: uninstall reinstall
20+
21+
clean:
22+
rm -rf _build
8223

83-
.PHONY: all html_doc man_doc doc install uninstall clean
24+
.PHONY: default test dev install uninstall reinstall clean

lib/jbuild

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(jbuild_version 1)
2+
3+
(library
4+
((name nullable_array)
5+
(public_name nullable-array)
6+
(modules (nullable_array))
7+
(flags (:standard "-keep-docs" "-keep-locs"))))

lib/nullable_array.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
7878
*)
7979

80+
[@@@ocaml.warning "-37"] (* The type elt is never built *)
8081

8182
type elt =
8283
| Constant

lib/nullable_array.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(************************************************************************)
22
(* nullable-array *)
33
(* *)
4-
(* Copyright 2016 OCamlPro *)
4+
(* Copyright 2016-2017 OCamlPro *)
55
(* *)
66
(* This file is distributed under the terms of the MIT License *)
77
(* *)

opam renamed to nullable-array.opam

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,20 @@ license: "MIT"
99
dev-repo: "https://github.com/OCamlPro/ocplib-nullable-array.git"
1010

1111
build: [
12-
[make "byte"]
13-
[make "native"] { ocaml-native }
14-
[make "natdynlink"] { ocaml-native-dynlink }
12+
["jbuilder" "build" "--only-packages" "nullable-array" "--root" "." "-j" jobs "@install"]
1513
]
1614

1715
build-test: [
18-
[make "test_byte"]
19-
[make "test_native"] { ocaml-native }
20-
]
21-
22-
build-doc: [
23-
[make "doc"]
16+
["jbuilder" "runtest"]
2417
]
2518

2619
install: [] (* no install rules: done through a .install file *)
2720

2821
available: [
2922
ocaml-version >= "4.02" (* use -keep-locs and attributes *)
30-
& ocaml-version <= "4.04" (* need to be tested before announcing that a version is correct *)
23+
& ocaml-version <= "4.05" (* need to be tested before announcing that a version is correct *)
3124
]
3225

33-
depends: []
26+
depends: [
27+
"jbuilder" {build & >= "1.0+beta8"}
28+
]

test/jbuild

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
(jbuild_version 1)
2+
3+
(executables
4+
((names (basic))
5+
(modules (basic))
6+
(libraries (nullable_array))))
7+
8+
(alias
9+
((name runtest)
10+
(deps (basic.exe))
11+
(action (run ${<}))))
12+
13+
(alias
14+
((name runtest)
15+
(deps (basic.bc))
16+
(action (run ${<}))))
17+
18+
(executables
19+
((names (basic_float))
20+
(modules (basic_float))
21+
(libraries (nullable_array))))
22+
23+
(alias
24+
((name runtest)
25+
(deps (basic_float.exe))
26+
(action (run ${<}))))
27+
28+
(alias
29+
((name runtest)
30+
(deps (basic_float.bc))
31+
(action (run ${<}))))

0 commit comments

Comments
 (0)