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: Re: [Caml-list] ocamlmake problem
Date: Wed, 28 Sep 2005 11:03:10 +1000	[thread overview]
Message-ID: <20050928010310.GA25159@pulp.anu.edu.au> (raw)
In-Reply-To: <20050927020308.GA9665@pulp.anu.edu.au>

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

I know, I know... tried harder, try in the morning...

attached the answer to my question... I suppose there is a
better way of doing it...

:)
pp

On Tue, Sep 27, 2005 at 12:03:08PM +1000, Pietro Abate wrote:
> 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

> (*pp camlp4o pa_macro.cmo *)
> 
> IFNDEF NATIVE THEN open Dynlink ENDIF
> 

> 
> print_endline "ex1!!!"

> 
> print_endline "ex2!!!"

> # 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=$@

> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


-- 
++ 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: Makefile --]
[-- Type: text/plain, Size: 956 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
  SOURCES = ex1.ml c4ex.ml
  RESULT = ex1
  export 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
  PPFLAGS = -DNATIVE
  SOURCES = ex2.ml c4ex.ml
  RESULT = ex2
  export PACKS = unix
endef
export PROJ_ex2

#ifndef SUBPROJS 
#export SUBPROJS = ex2 clean ex1
#endif

# Default target to use
#all:	bc
ex1:
	@$(MAKE) -f $(OCAMLMAKEFILE) subprojs SUBTARGET=bc SUBPROJS=ex1

ex2:
	@$(MAKE) -f $(OCAMLMAKEFILE) subprojs SUBTARGET=nc SUBPROJS=ex2

clean:
	@$(MAKE) -f $(OCAMLMAKEFILE) subprojs SUBTARGET=clean SUBPROJS="ex1 ex2"

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

      reply	other threads:[~2005-09-28  1:03 UTC|newest]

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

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=20050928010310.GA25159@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).