From: Joel Reymont <joelr1@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: Can this OMakefile be simplified?
Date: Wed, 28 Mar 2007 09:28:46 +0100 [thread overview]
Message-ID: <755EDEB6-46CF-4212-8D37-2F83E62550E2@gmail.com> (raw)
I found this OMakefile in the sqlite3 bindings for OCaml. I'm trying
to package my translator as a set of C bindings and I wonder if this
Omakefile can be made simpler.
Any suggestions? Pointers to simpler Omakefiles for other C bindings?
Thanks in advance, Joel
###########################################
SubstVersion(output, input) =
# should use fsubst, but it doesn't seem to be
# working properly in 0.9.2.
$(output) : $(input)
sed "s%@VERSION@%$(VERSION)%g" < $< > $@
###########################################
OCamlLibraryExt(name, files, cfiles) =
OFILES = $(addsuffix $(EXT_OBJ), $(cfiles))
CMOFILES = $(addsuffix .cmo, $(files))
CMXFILES = $(addsuffix .cmx, $(files))
CMIFILES = $(addsuffix .cmi, $(files))
CLIB = $(file $(name)$(EXT_LIB))
BYTELIB = $(file $(name).cma)
NATIVELIB = $(file $(name).cmxa)
STUBLIB = lib$(name)_stubs
# Create C library to contain all the object files...
StaticCLibrary($(STUBLIB), $(cfiles))
# Link commands
# TODO: Doesn't work with ddls...
$(BYTELIB): $(CMOFILES) $(STUBLIB)$(EXT_LIB)
$(OCAMLFIND) $(OCAMLLINK) $(OCAMLFLAGS) $(OCAMLCFLAGS) \
$(OCAML_LIB_FLAGS) -a -custom -cclib -l$(name)_stubs \
-o $@ $(OCamlLinkSort $(CMOFILES))
$(NATIVELIB) $(CLIB): $(CMXFILES) $(STUBLIB)$(EXT_LIB)
$(OCAMLFIND) $(OCAMLOPTLINK) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) \
$(OCAML_LIB_FLAGS) -a -cclib -l$(name)_stubs -o \
$(NATIVELIB) $(OCamlLinkSort $(CMXFILES))
# Add to targets
if $(NATIVE_ENABLED)
library: $(NATIVELIB)
if $(BYTE_ENABLED)
library: $(BYTELIB)
# Program with tag for executables
OCamlProgramExt(tag, name, sources) =
OCamlProgram($(name), $(sources))
if $(NATIVE_ENABLED)
$(tag) : $(name).opt
if $(BYTE_ENABLED)
$(tag) : $(name).run
###############################
.PHONY : library examples install dist
VERSION = $(nth 0, $(rev $(split -, $(dir .))))
OCAMLFLAGS = -w A
OCAMLPPFLAGS = -pp camlp4r
OCAMLDEPFLAGS = -pp camlp4r
BYTE_ENABLED = true
NATIVE_ENABLED = true
OCAMLLIBDIR = $(shell ocamlfind printconf stdlib)
CFLAGS = -Wall -Werror -I $(OCAMLLIBDIR)
PKG = $(basename $(absname $(dir .)))
# Targets in subdirectories...
.SUBDIRS: lib examples
# Targets:
.DEFAULT: library examples
# Distribution:
dist : .DEFAULT
tar -C $(dir ..) -c -j -f $(dir ..)/$(PKG).tar.bz2 \
$(addprefix $(PKG)/, $(shell bzr inventory --kind file))
--
http://wagerlabs.com/
next reply other threads:[~2007-03-28 8:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-28 8:28 Joel Reymont [this message]
2007-03-28 21:01 ` [Caml-list] " Aleksey Nogin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=755EDEB6-46CF-4212-8D37-2F83E62550E2@gmail.com \
--to=joelr1@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox