Skip to content

Commit

Permalink
Merge pull request #15 from rgrinberg/jbuilder
Browse files Browse the repository at this point in the history
Port to jbuilder
  • Loading branch information
mjambon committed Jul 3, 2017
2 parents f903391 + 9c2d4a6 commit dba77db
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 111 deletions.
26 changes: 3 additions & 23 deletions .gitignore
@@ -1,23 +1,3 @@
*~
*.cmi
*.cmo
*.cmx
*.cma
*.cmxa
*.cmxs
*.a
*.o
*.annot
*.run
*.opt
*.exe
META
bytecode
nativecode
*.out
lambda_example
simple_example
test_easy_format
easy_format_example.html
easy_format_example.ml
ocamldoc
_build
.merlin
*.install
5 changes: 0 additions & 5 deletions META.tpl

This file was deleted.

84 changes: 7 additions & 77 deletions Makefile
@@ -1,82 +1,12 @@
VERSION = 1.2.0
export VERSION

NATDYNLINK := $(shell if [ -f `ocamlfind ocamlc -where`/dynlink.cmxa ]; \
then echo YES; else echo NO; fi)

ifeq "${NATDYNLINK}" "YES"
CMXS=easy_format.cmxs
endif

.PHONY: default all opt test doc soft-clean clean
default: all opt
all:
ocamlfind ocamlc -c easy_format.mli
ocamlfind ocamlc -c -dtypes easy_format.ml
touch bytecode

opt: easy_format.cmx $(CMXS)
touch nativecode

easy_format.cmx:
ocamlfind ocamlc -c easy_format.mli
ocamlfind ocamlopt -c -dtypes easy_format.ml

easy_format.cmxs: easy_format.cmx
ocamlfind ocamlopt -I . -shared -linkall \
-o easy_format.cmxs easy_format.cmx

test: all simple_example.out
ocamlfind ocamlc -o test_easy_format -dtypes \
easy_format.cmo test_easy_format.ml
./test_easy_format > test_easy_format.out
ocamlfind ocamlc -o lambda_example -dtypes \
easy_format.cmo lambda_example.ml
./lambda_example > lambda_example.out

simple_example: all simple_example.ml
ocamlfind ocamlc -o simple_example -dtypes \
easy_format.cmo simple_example.ml
simple_example.out: simple_example
./simple_example > simple_example.out

doc: ocamldoc/index.html easy_format_example.html
ocamldoc/index.html: easy_format.mli
mkdir -p ocamldoc
ocamlfind ocamldoc -d ocamldoc -html $<
easy_format_example.html: simple_example.out simple_example.ml
cat simple_example.ml > easy_format_example.ml
echo '(* Output: ' >> easy_format_example.ml
cat simple_example.out >> easy_format_example.ml
echo '*)' >> easy_format_example.ml
ocamlfind ocamlc -c -dtypes easy_format_example.ml
caml2html easy_format_example.ml -t -o easy_format_example.html

soft-clean:
rm -f *.cm[iox] *.cmxs *.o *.annot \
test_easy_format lambda_example simple_example \
bytecode nativecode

clean: soft-clean
rm -f *.out ocamldoc/* \
easy_format_example.*
cd examples; $(MAKE) clean
@jbuilder build @install @DEFAULT

test:
@jbuilder runtest

COMMON_INSTALL_FILES = META easy_format.cmi easy_format.mli
BC_INSTALL_FILES = easy_format.cmo
NC_INSTALL_FILES = easy_format.cmx easy_format.o $(CMXS)
check: test

install:
echo "version = \"$(VERSION)\"" > META; cat META.tpl >> META
INSTALL_FILES="$(COMMON_INSTALL_FILES)"; \
if test -f bytecode; then \
INSTALL_FILES="$$INSTALL_FILES $(BC_INSTALL_FILES)"; \
fi; \
if test -f nativecode; then \
INSTALL_FILES="$$INSTALL_FILES $(NC_INSTALL_FILES)"; \
fi; \
ocamlfind install easy-format $$INSTALL_FILES
.PHONY: clean all test check

uninstall:
ocamlfind remove easy-format
clean:
jbuilder clean
15 changes: 15 additions & 0 deletions easy-format.opam
@@ -0,0 +1,15 @@
opam-version: "1.2"
maintainer: "martin@mjambon.com"
authors: ["Martin Jambon"]
homepage: "http://mjambon.com/easy-format.html"
bug-reports: "https://github.com/mjambon/easy-format/issues"
dev-repo: "https://github.com/mjambon/easy-format.git"
build: [
["jbuilder" "build" "-p" name "-j" jobs]
]

build-test: [
["jbuilder" "runtest" "-p" name]
]
depends: ["jbuilder" {build}]
available: [ ocaml-version >= "4.02.3"]
6 changes: 0 additions & 6 deletions examples/Makefile

This file was deleted.

11 changes: 11 additions & 0 deletions examples/jbuild
@@ -0,0 +1,11 @@
(jbuild_version 1)

;; we don't include jsonpp here b/c it requires json-wheel
(executables
((names (simple_example lambda_example))
(modules (:standard \ jsonpp))
(libraries (easy-format))))

(alias
((name DEFAULT)
(deps (simple_example.exe lambda_example.exe))))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions src/jbuild
@@ -0,0 +1,6 @@
(jbuild_version 1)

(library
((name easy_format)
(public_name easy-format)
(synopsis "Indentation made easy(ier)")))
10 changes: 10 additions & 0 deletions test/jbuild
@@ -0,0 +1,10 @@
(jbuild_version 1)

(executable
((name test_easy_format)
(libraries (easy-format))))

(alias
((name runtest)
(deps (test_easy_format.exe))
(action (run ${<}))))
File renamed without changes.

0 comments on commit dba77db

Please sign in to comment.