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

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