ocaml-native-lib/Makefile

34 lines
853 B
Makefile
Raw Normal View History

2019-05-10 13:45:32 +02:00
BUILD:=_build
OCAML_ROOT:=$(shell ocamlopt -where)
OCAMLOPT_FLAGS:=-output-complete-obj
.PHONY: ocaml
ocaml:
2019-05-10 15:10:55 +02:00
dune build --verbose ocaml/hello.exe.o
ar -rs $(BUILD)/libfoo.a _build/default/ocaml/hello.exe.o
2019-05-10 13:45:32 +02:00
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
2020-04-24 16:34:32 +02:00
cpp:
g++ -c c/main.cpp -I$(OCAML_ROOT) -o $(BUILD)/main.o
g++ -o $(BUILD)/test.exe $(BUILD)/main.o -L$(OCAML_ROOT) -L$(BUILD) -lfoo -lm -ldl -lasmrun
2019-05-10 13:45:32 +02:00
run:
$(BUILD)/test.exe
clean:
dune clean
rm -rf $(BUILD)
bootstrap:
opam install . --deps-only