Skip to content

Commit

Permalink
builds and installs cmxs (#13)
Browse files Browse the repository at this point in the history
also adds the META file.

Fixes #12
  • Loading branch information
ivg authored Apr 22, 2021
1 parent 4b25892 commit a313b21
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ calipso/calipso
calipso/calipso_stat
ctoxml/ctoxml
printc/printc
*.cmxs
7 changes: 7 additions & 0 deletions META
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
description = "Parser for the C language"
version = "3.4.3"
requires = "unix"
archive(byte) = "frontc.cma"
archive(native) = "frontc.cmxa"
plugin(byte) = "frontc.cma"
plugin(native) = "frontc.cmxs"
27 changes: 17 additions & 10 deletions Makefile.head
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ endef
# Library compilation
define ocaml_byte_code_lib

_ALL += $(1).cma
_ALL += $(1).cma
$(1)_MLO = $(call ocaml_sources,$(2))
$(1)_CMO = $$(patsubst %.ml,%.cmo,$$($(1)_MLO))
$(1)_MLLO = $$(filter %.mll,$(2))
Expand All @@ -84,14 +84,14 @@ $(1).cma: $$($(1)_CMO)
$$(OCAMLC) -a $$($(1)_LDFLAGS) $$(OCAMLC_LDFLAGS) -o $$@ $$($(1)_CMO) $$(OCAMLC_LIBS)

_install_$(1)_CMA:
install -d $(OCAML_SITE)/$(1)
install $(1).cma $$($(1)_CMIO) $(OCAML_SITE)/$(1)
install -d $(OCAML_SITE)/FrontC
install $(1).cma $$($(1)_CMIO) $(OCAML_SITE)/FrontC

endef

define ocaml_native_lib

_ALL += $(1).cmxa
_ALL += $(1).cmxa $(1).cmxs
$(1)_MLX = $(call ocaml_sources,$(2))
$(1)_CMX = $$(patsubst %.ml,%.cmx,$$($(1)_MLX))
$(1)_MLLX = $$(filter %.mll,$(2))
Expand All @@ -107,16 +107,23 @@ _CLEAN += $$($(1)_CMX) \
$$(patsubst %.mly,%.ml,$$($(1)_MLYX)) \
$$(patsubst %.mly,%.mli,$$($(1)_MLYX))
_DIST += $(2)
_BINARY_DIST += $(1).cmxa $(1).a $(patsubst %.cmx,%.cmi,$$($(1)_CMX))
_INSTALL += _install_$(1)_CMXA
_BINARY_DIST += $(1).cmxa $(1).cmxs $(1).a $(patsubst %.cmx,%.cmi,$$($(1)_CMX))
_INSTALL += _install_$(1)_CMXA _install_$(1)_CMXS

$(1).cmxa: $$($(1)_CMX)
$$(OCAMLOPT) -a $$($(1)_LDFLAGS) $$(OCAMLOPT_LDFLAGS) -o $$@ $$($(1)_CMX) $$(OCAMLOPT_LIBS)

$(1).cmxs: $$($(1).cmxa)
$$(OCAMLOPT) -shared -linkall $$($(1).cmxa) -o $$@

_install_$(1)_CMXA:
install -d $(OCAML_SITE)/$(1)
install $(1).cmxa $(1).a $$($(1)_CMIX) $(OCAML_SITE)/$(1)

install -d $(OCAML_SITE)/FrontC
install $(1).cmxa $(1).a $$($(1)_CMIX) $(OCAML_SITE)/FrontC

_install_$(1)_CMXS:
install -d $(OCAML_SITE)/FrontC
install $(1).cmxs $(OCAML_SITE)/FrontC

endef

define ocaml_lib
Expand Down

0 comments on commit a313b21

Please sign in to comment.