Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debian fixes #410

Merged
merged 4 commits into from
Jun 24, 2016
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.SECONDEXPANSION:

BEST:=$(shell if which ocamlopt > /dev/null; then echo native; else echo byte; fi)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the which be dropped here, like this:

BEST:=$(shell if ocamlopt > /dev/null; then echo native; else echo byte; fi)
?

Some systems, such as NixOS, apparently don't include which by default, and I'd rather avoid adding another opam dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In shell, it seems that the error message in case of a missing command is printed on stderr. So the following is better (tested with bash and dash):

BEST:=$(shell if ocamlopt > /dev/null 2>&1; then echo native; else echo byte; fi)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks good to me!

DEBUG=false
COVERAGE=false
OCAML=ocaml
Expand Down
15 changes: 12 additions & 3 deletions Makefile.rules
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,24 @@ CMX_OPTS = $($(PROJECT).cmx_opts)
CMA_OPTS = $(if $(C_OBJECTS),-cclib -l$(PROJECT)_stubs -dllib -l$(PROJECT)_stubs)
SUBPROJECT_DEPS = $($(PROJECT).subproject_deps)
LOCAL_CMXAS = $(SUBPROJECT_DEPS:%=$(BUILDDIR)/%.cmxa)
LOCAL_CMAS = $(SUBPROJECT_DEPS:%=$(BUILDDIR)/%.cma)
CMXA_OPTS = $(if $(C_OBJECTS),-cclib -l$(PROJECT)_stubs)

OCAMLINCLUDES = -I $(BUILDDIR)/$($(PROJECT).dir) \
$(foreach spdep,$($(PROJECT).subproject_deps),\
-I $(BUILDDIR)/$($(spdep).dir))
NATIVE_LIB=$(BUILDDIR)/$(PROJECT).cmxa
NATIVE_TARGET=$(BUILDDIR)/$(PROJECT).native
BEST_TARGET=$(BUILDDIR)/$(PROJECT).$(BEST)
LIB_TARGETS = $(BUILDDIR)/$(PROJECT).cma \
$(STUB_LIB) \
$(XEN_LIB) \
$(BUILDDIR)/$(PROJECT).cmxa \
$(BUILDDIR)/$(PROJECT).cmxs
$(XEN_LIB)
ifeq ($(BEST),native)
LIB_TARGETS += $(BUILDDIR)/$(PROJECT).cmxa
endif
ifneq ($(wildcard $(shell ocamlc -where)/dynlink.cmxa),)
LIB_TARGETS += $(BUILDDIR)/$(PROJECT).cmxs
endif
LIB_TARGET_EXTRAS = $(if $(STUB_LIB),$(BUILDDIR)/lib$(PROJECT)_stubs.a) \
$(if $(XEN_LIB),$(BUILDDIR)/lib$(PROJECT)_stubs_xen.a) \
$(BUILDDIR)/$(PROJECT).a
Expand Down Expand Up @@ -112,3 +118,6 @@ $(BUILDDIR)/%.cmi : %.mli

$(BUILDDIR)/%.native : $$(NATIVE_OBJECTS) $$(C_OBJECTS)
$(OCAMLFIND) opt -I $(BUILDDIR) -linkpkg $(OCAMLFLAGS) $(THREAD_FLAG) $(OCAMLFIND_PACKAGE_FLAGS) $(LOCAL_CMXAS) -o $@ $(NATIVE_OBJECTS) $(C_OBJECTS) $(OCAML_LINK_FLAGS)

$(BUILDDIR)/%.byte : $$(BYTE_OBJECTS) $$(C_OBJECTS)
$(OCAMLFIND) ocamlc -custom -I $(BUILDDIR) -linkpkg $(OCAMLFLAGS) $(THREAD_FLAG) $(OCAMLFIND_PACKAGE_FLAGS) $(LOCAL_CMAS) -o $@ $(BYTE_OBJECTS) $(C_OBJECTS) $(OCAML_LINK_FLAGS)
Loading