Initial commit

This commit is contained in:
Fabien Freling 2019-05-10 13:45:32 +02:00
parent 6499d7d7ae
commit 18f29579e0
7 changed files with 78 additions and 0 deletions

29
Makefile Normal file
View file

@ -0,0 +1,29 @@
BUILD:=_build
OCAML_ROOT:=$(shell ocamlopt -where)
OCAMLOPT_FLAGS:=-output-complete-obj
.PHONY: ocaml
ocaml:
dune build ocaml/hello.a
cp _build/default/ocaml/hello.a $(BUILD)/libfoo.a
ocaml-manual:
mkdir -p $(BUILD)
ocamlopt $(OCAMLOPT_FLAGS) ocaml/hello.ml -o $(BUILD)/hello_obj.o
ocamlopt $(OCAMLOPT_FLAGS) ocaml/bye.ml -o $(BUILD)/bye_obj.o
ar -rs $(BUILD)/libfoo.a $(BUILD)/hello_obj.o $(BUILD)/bye_obj.o
.PHONY: c
c:
gcc -c c/main.c -I$(OCAML_ROOT) -o $(BUILD)/main.o
gcc -o $(BUILD)/test.exe $(BUILD)/main.o -L$(OCAML_ROOT) -L$(BUILD) -lfoo -lm -ldl -lasmrun
run:
$(BUILD)/test.exe
clean:
dune clean
rm -rf $(BUILD)
bootstrap:
opam install . --deps-only