Skip to content

Commit

Permalink
Migration to dune
Browse files Browse the repository at this point in the history
  • Loading branch information
pbaudin committed Jan 28, 2019
1 parent 20593f9 commit 73dd7e6
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
config_builtin.ml
_build
*.native
.merlin
headache.install
23 changes: 7 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,29 @@
# #
##########################################################################

OCAMLBUILD = ocamlbuild -package camomile -package unix -package str
.PHONY: headache clean install test

.PHONY: headache mkconfig clean install bootstrap test

headache: config_builtin.ml
$(OCAMLBUILD) headache.native

mkconfig:
$(OCAMLBUILD) mkconfig.native

config_builtin.ml: config_builtin.txt mkconfig
_build/mkconfig.native
headache:
dune build

clean::
$(OCAMLBUILD) -clean
rm -f config_builtin.ml example.txt
dune clean

# install
install:
ifndef INSTALLDIR
$(error "Please define INSTALLDIR.")
else
mkdir -p $(INSTALLDIR)
cp -f _build/headache.native $(INSTALLDIR)/headache
cp -f _build/install/default/bin/headache $(INSTALLDIR)/headache
endif

# test
bootstrap: headache
_build/headache.native -h example $(filter-out config_builtin.ml, $(wildcard *.ml*)) Makefile doc-src/Makefile doc-src/manual.tex
dune exec -- headache -h example $(filter-out config_builtin.ml, $(wildcard *.ml*)) Makefile doc-src/Makefile doc-src/manual.tex

test: bootstrap
_build/headache.native -e Makefile > example.txt
dune exec -- headache -e Makefile > example.txt
diff -q example example.txt
rm -f example.txt

Expand Down
2 changes: 1 addition & 1 deletion config_lex.mll
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ let char_for_backslash =
| 't' -> '\009'
| c -> c
end
| x -> (* TEMPORARY Error "Unknown system type" *) assert false
| _ -> (* TEMPORARY Error "Unknown system type" *) assert false

let char_for_decimal_code lexbuf i =
let c = 100 * (Char.code(Lexing.lexeme_char lexbuf i) - 48) +
Expand Down
32 changes: 32 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
(library
(name headache)
(modules Model Config_lex Config_parse Config Info Skip)
(libraries camomile str bytes)
)

(ocamllex config_lex)
(ocamlyacc config_parse)

(executable
(name mkconfig)
(modules Mkconfig)
(libraries headache)
)

(rule
(targets config_builtin.ml)
(deps mkconfig.exe config_builtin.txt)
(action (run ./mkconfig.exe))
)

(executable
(name headache_tool)
(public_name headache)
(modules Headache_tool Config_builtin)
(libraries headache unix)
)

(install
(section doc)
(files "doc/manual.pdf" "doc/manual.html" "doc/manual.txt")
)
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 1.6)
9 changes: 5 additions & 4 deletions headache.opam
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ authors: [
]

maintainer: "Patrick Baudin"
homepage: "https://github.com/frama-c/headache/"
bug-reports: "https://github.com/frama-c/headache/issues"
homepage: "https://github.com/Frama-C/headache/"
bug-reports: "https://github.com/Frama-C/headache/issues"
dev-repo: "git+https://github.com/Frama-C/headache.git"

depends: [
"camomile"
"ocamlbuild" {build}
"dune" {build}
]

build: [
[make]
[ "dune" "build" "-p" "headache" ]
]

install: [
Expand Down
2 changes: 1 addition & 1 deletion headache.ml → headache_tool.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

open Printf
open Config_builtin

open Headache


(***************************************************************************)
Expand Down
1 change: 1 addition & 0 deletions mkconfig.ml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
(**************************************************************************)

open Printf
open Headache

let file_in = "config_builtin.txt"
let file_out = "config_builtin.ml"
Expand Down

0 comments on commit 73dd7e6

Please sign in to comment.