caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocamlmake problem
@ 2005-09-27  2:03 Pietro Abate
  2005-09-28  1:03 ` [Caml-list] " Pietro Abate
  0 siblings, 1 reply; 2+ messages in thread
From: Pietro Abate @ 2005-09-27  2:03 UTC (permalink / raw)
  To: ocaml ml

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Caml-list] ocamlmake problem
  2005-09-27  2:03 ocamlmake problem Pietro Abate
@ 2005-09-28  1:03 ` Pietro Abate
  0 siblings, 0 replies; 2+ messages in thread
From: Pietro Abate @ 2005-09-28  1:03 UTC (permalink / raw)
  To: ocaml ml

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-09-28  1:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-27  2:03 ocamlmake problem Pietro Abate
2005-09-28  1:03 ` [Caml-list] " Pietro Abate

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).