caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pietro Abate <Pietro.Abate@anu.edu.au>
To: ocaml ml <caml-list@inria.fr>
Subject: ocamlmake problem
Date: Tue, 27 Sep 2005 12:03:08 +1000	[thread overview]
Message-ID: <20050927020308.GA9665@pulp.anu.edu.au> (raw)

[-- Attachment #1: Type: text/plain, Size: 651 bytes --]

Hi all,
I'm trying to use ocmalmake + camlp4 to re-use the same
code with dynlink in byte-code or without dynlink in native 
code. Do to this I'm using pa_macro to remove dynlink part of
the code. Now I'm trying to glue everything together with ocamlmake.

Attached there is a small example. Basically the problem is that if
I use the SUBPROJS pragma, the PRE_TARGETS are ignored. How can I 
do this ?

:)
p

-- 
++ Blog: http://blog.rsise.anu.edu.au/?q=pietro
++ 
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
   See http://www.fsf.org/philosophy/no-word-attachments.html

[-- Attachment #2: c4ex.ml --]
[-- Type: text/plain, Size: 69 bytes --]

(*pp camlp4o pa_macro.cmo *)

IFNDEF NATIVE THEN open Dynlink ENDIF


[-- Attachment #3: ex1.ml --]
[-- Type: text/plain, Size: 24 bytes --]


print_endline "ex1!!!"

[-- Attachment #4: ex2.ml --]
[-- Type: text/plain, Size: 24 bytes --]


print_endline "ex2!!!"

[-- Attachment #5: Makefile --]
[-- Type: text/plain, Size: 804 bytes --]

# Set OCamlMakefile to use
export OCAMLMAKEFILE = /usr/share/ocaml-tools/OCamlMakefile

# Define project "ex1"
# this project should be compiled in bc
define PROJ_ex1
  USE_CAMLP4 := yes
  PRE_TARGETS := c4ex.cmi c4ex.cmo

  SOURCES = ex1.ml
  RESULT = ex1
  PACKS := dynlink unix 
endef
export PROJ_ex1

# Define project "ex2"
# this subprojet should use NATIVE and remove 
# dynlink functions
define PROJ_ex2
  USE_CAMLP4 := yes
  PRE_TARGETS := c4ex.cmi c4ex.cmo

  SOURCES = ex2.ml
  RESULT = ex2
  PACKS := unix
  PPFLAGS := -DNATIVE
endef
export PROJ_ex2

# by default I want to compile the bc
ifndef SUBPROJS
  export SUBPROJS = ex1 
endif

# Default target to use
all:	bc

# Catch-all target will be applied to all subprojects automatically
%:
	@$(MAKE) -f $(OCAMLMAKEFILE) subprojs SUBTARGET=$@

             reply	other threads:[~2005-09-27  2:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-27  2:03 Pietro Abate [this message]
2005-09-28  1:03 ` [Caml-list] " Pietro Abate

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=20050927020308.GA9665@pulp.anu.edu.au \
    --to=pietro.abate@anu.edu.au \
    --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;
as well as URLs for NNTP newsgroup(s).