caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Ocamlopt might output files in another directory!
@ 1996-12-10  8:07 Basile STARYNKEVITCH
  1996-12-11 17:19 ` Mark Hayden
  0 siblings, 1 reply; 2+ messages in thread
From: Basile STARYNKEVITCH @ 1996-12-10  8:07 UTC (permalink / raw)
  To: caml-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2864 bytes --]


Hello All,

May I suggest that Ocaml could have the possibility to write all it
machine or system dependent files elsewhere?

I'm working in a multiplatform environnement. (We have Suns/SunOS5,
HPs/HPUX10, PC/Linux2 on the same network).

So, in C or related langages, I do like to put object and executable
files elsewhere. I'm using GNU make and just have to write in my
GNUmakefile



    ## the machine suffix
    ifndef MACHSUFFIX
    export MACHSUFFIX := $(shell $machsuffix)
    endif 

    ## the top source directory
    ifndef TOPDIR
    export TOPDIR := $(shell pwd)
    endif 

    ## MACHSUFFIX is "x86-linux" on PC/Linux, "sparc-sunos5" on
    ##    Sparc/SunOS5, "hppa-hpux10" on "HP/PA/HPUX10

    OBJDIR := $(HOME)/bin.$(MACHSUFFIX)/Objs

    vpath %.o $(OBJDIR)

    $(OBJDIR)/%.o:  %.c
	    $(COMPILE.c) $< $(OUTPUT_OPTION) 

    sed_depend_objcmd:= 1,$$s:\([a-zA-Z0-9_]*\.o\):\$$(OBJDIR)/\1:
    sed_depend_inccmd:= 1,$$s:\($(TOPDIR)\):\$$(TOPDIR):
    define sed_depend
     $(SED) -e '$(sed_depend_inccmd)' -e '$(sed_depend_objcmd)'
    endef 

    CSRCFILES = foo.c bar.c
    COBJFILES := $(patsubst %.c, $(OBJDIR)/%.o, $(CSRCFILES))

    DEPEND:=_depend.$(MACHSUFFIX).mk

    -include $(DEPEND)

    depend: 
	    date "+ Making depend at %D %T %n"
	    date "+## $(DEPEND) file generated on %e %b %Y at %R" > $(DEPEND)
	    $(CC) -MM $(CFLAGS) $(CPPFLAGS)  $(CSRCFILES) | $(sed_depend)  >> $(DEPEND)


    $(OBJDIR)/prog: $(COBJFILES)
	$(LINK.c) -o $@ $< $(LOADIBES)


So with this trick I always do make in the source directory, and,
depending of the machine, it build object and executable file in the
system dependent $(OBJDIR).

I would like to use a similar trick with ocamlopt. But this requires
that all system dependent files, include *.cmx and *.o, go elsewhere. -the -o
ocamlopt flags does not do the trick)

So I wish a -objdir flag to the ocaml driver which gives the output
directory!

More generally, I think that a compiler should be able to compile in a
directory in which it just have read, not write, permissions.


I believe these changes are easy to fix -in
ocaml-1.03/driver/{compile,compileopt}.ml- I might even do them if
some people (besides myself) are interested!



N.B. Any opinions expressed here are solely mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.


----------------------------------------------------------------------
Basile STARYNKEVITCH   ----  Commissariat à l Energie Atomique 
DRN/DMT/SERMA * CEA/Saclay bat.470 * 91191 GIF/YVETTE CEDEX * France
fax: (33) 01,69.08.85.68; phone: 01,69.08.40.66; home: 01,46.65.45.53
email: Basile . Starynkevitch @ cea . fr  (but remove white space)
I speak french, english, russian. Je parle français, anglais, russe.
----------------------------------------------------------------------






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

* Re: Ocamlopt might output files in another directory!
  1996-12-10  8:07 Ocamlopt might output files in another directory! Basile STARYNKEVITCH
@ 1996-12-11 17:19 ` Mark Hayden
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Hayden @ 1996-12-11 17:19 UTC (permalink / raw)
  To: caml-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3388 bytes --]


We have this problem as well.  We structure my source files into multiple directories
and want the .cm* files to be put somewhere else.  Our solution is to use a separate
ML program that executes ocamlc/opt and then moves the output files to a destination
directory.  This program essentially implements the -o option found in C
compilers. It would be much nicer if the Ocaml compilers supported such an option
directly.

--Mark

>Hello All,
>
>May I suggest that Ocaml could have the possibility to write all it
>machine or system dependent files elsewhere?
>
>I'm working in a multiplatform environnement. (We have Suns/SunOS5,
>HPs/HPUX10, PC/Linux2 on the same network).
>
>So, in C or related langages, I do like to put object and executable
>files elsewhere. I'm using GNU make and just have to write in my
>GNUmakefile
>
>
>
>    ## the machine suffix
>    ifndef MACHSUFFIX
>    export MACHSUFFIX := $(shell $machsuffix)
>    endif 
>
>    ## the top source directory
>    ifndef TOPDIR
>    export TOPDIR := $(shell pwd)
>    endif 
>
>    ## MACHSUFFIX is "x86-linux" on PC/Linux, "sparc-sunos5" on
>    ##    Sparc/SunOS5, "hppa-hpux10" on "HP/PA/HPUX10
>
>    OBJDIR := $(HOME)/bin.$(MACHSUFFIX)/Objs
>
>    vpath %.o $(OBJDIR)
>
>    $(OBJDIR)/%.o:  %.c
>	    $(COMPILE.c) $< $(OUTPUT_OPTION) 
>
>    sed_depend_objcmd:= 1,$$s:\([a-zA-Z0-9_]*\.o\):\$$(OBJDIR)/\1:
>    sed_depend_inccmd:= 1,$$s:\($(TOPDIR)\):\$$(TOPDIR):
>    define sed_depend
>     $(SED) -e '$(sed_depend_inccmd)' -e '$(sed_depend_objcmd)'
>    endef 
>
>    CSRCFILES = foo.c bar.c
>    COBJFILES := $(patsubst %.c, $(OBJDIR)/%.o, $(CSRCFILES))
>
>    DEPEND:=_depend.$(MACHSUFFIX).mk
>
>    -include $(DEPEND)
>
>    depend: 
>	    date "+ Making depend at %D %T %n"
>	    date "+## $(DEPEND) file generated on %e %b %Y at %R" > $(DEPEND)
>	    $(CC) -MM $(CFLAGS) $(CPPFLAGS)  $(CSRCFILES) | $(sed_depend)  >> $(DEPEND)
>
>
>    $(OBJDIR)/prog: $(COBJFILES)
>	$(LINK.c) -o $@ $< $(LOADIBES)
>
>
>So with this trick I always do make in the source directory, and,
>depending of the machine, it build object and executable file in the
>system dependent $(OBJDIR).
>
>I would like to use a similar trick with ocamlopt. But this requires
>that all system dependent files, include *.cmx and *.o, go elsewhere. -the -o
>ocamlopt flags does not do the trick)
>
>So I wish a -objdir flag to the ocaml driver which gives the output
>directory!
>
>More generally, I think that a compiler should be able to compile in a
>directory in which it just have read, not write, permissions.
>
>
>I believe these changes are easy to fix -in
>ocaml-1.03/driver/{compile,compileopt}.ml- I might even do them if
>some people (besides myself) are interested!
>
>
>
>N.B. Any opinions expressed here are solely mine, and not of my organization.
>N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.
>
>
>----------------------------------------------------------------------
>Basile STARYNKEVITCH   ----  Commissariat à l Energie Atomique 
>DRN/DMT/SERMA * CEA/Saclay bat.470 * 91191 GIF/YVETTE CEDEX * France
>fax: (33) 01,69.08.85.68; phone: 01,69.08.40.66; home: 01,46.65.45.53
>email: Basile . Starynkevitch @ cea . fr  (but remove white space)
>I speak french, english, russian. Je parle français, anglais, russe.
>----------------------------------------------------------------------
>
>
>





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

end of thread, other threads:[~1996-12-11 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-10  8:07 Ocamlopt might output files in another directory! Basile STARYNKEVITCH
1996-12-11 17:19 ` Mark Hayden

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