caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Makefile for wxcaml on Windows using Microsoft tools
@ 2005-10-31 14:46 Jeremy O'Donoghue
  0 siblings, 0 replies; only message in thread
From: Jeremy O'Donoghue @ 2005-10-31 14:46 UTC (permalink / raw)
  To: caml-list

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

Hi all,

I've been working to get wxCaml to compile and run using the Microsoft tools.

This seems only to require some small changes to the Makefile, and I
attach a (rather messy) modified version.

The user will need to change

PWD (wxCaml build directory)
OCAMLDIR (Ocaml installation directory)
WXWINDOWS (wxWidgets installation directory)
WXHASKELL (wxHaskell build directory)
VCLIBDIR (Visual Studio library directory)

to reflect the appropriate values for their build environment.

I have added support for both bytecode and native code versions of the
wxcaml library. Both version compile and run the test application, but
both generate a memory leak indication on exit. I will look into this
when time allows.

I can confirm that the wxcaml tarball worked successfully with up to
date versions of wxWidgets and wxHaskell - wxWidgets 2.6.2 and
wxHaskell 0.9.4 in this case.

There appears to be no license file with the wxCaml tarball. I have
licensed the Makefile attached under the wxWindows library license, as
it seems most appropriate (wxWindows and wxHaskell, the main
components use this license).

However, I will be happy to change to any recognised Open Source
license if SooHyoung Oh, the wxCaml author, requests - this
contributon is trivial.

I would prefer that there is some clarity in the licensing of wxCaml
in any case - it is really impossible to do anything more than play
with it until this is done.

Regards
Jeremy

[-- Attachment #2: Makefile.msvc --]
[-- Type: application/octet-stream, Size: 4337 bytes --]

# Makefile.msvc - Makefile for wxCaml using Microsoft tools.
#
# (c) 2005 SooHyoung Oh, Jeremy O'Donoghue
#
# Licensed under wxWindows library license: see http://www.wxwindows.org/

# You probably need to change these

PWD = c:/jodonoghue/scripts/ocaml/wxcaml
OCAMLDIR = c:/utils/ocaml
WXWINDOWS = c:/utils/wx
WXHASKELL = c:/jodonoghue/scripts/haskell/wxhaskell-0.9.4
VCLIBDIR = "C:/Program Files/Microsoft Visual Studio/VC98/Lib"

# You should not need to change anything below here

OCAMLLIBDIR = $(OCAMLDIR)/lib
INSTALL_DIR = $(OCAMLLIBDIR)/wxcaml
WXCAMLLIB = libwxcaml.lib

INCLUDES = \
	-I$(PWD) \
	-I$(WXWINDOWS)/include -I$(WXWINDOWS)/lib/mswd \
	-I$(WXHASKELL)/wxc/include \
	-I$(OCAMLLIBDIR)

CLIBDIRS = /LIBPATH:$(OCAMLLIBDIR)
CFLAGS = $(WINDOWS) $(DEBUG) $(INCLUDES)

GL_LIBS = glu32.lib opengl32.lib

WXLIBS = $(GL_LIBS) wxcd-msw2.4.2-0.9.4.lib msvcrt.lib libcamlidl.lib ole32.lib

MLFLAGS = -verbose -I +lablGL -ccopt "$(CFLAGS)"
MLLFLAGS = -verbose -I +lablGL -ccopt "$(CFLAGS) /link $(CLIBDIRS)"
CC=cl

OBJS = main.o
LOBJS = modcaml.obj modwrap.obj cprint.obj tst.obj wxcaml_stubs.o
MLOBJS = event.cmo start.obj modwrap.obj tst.obj wxcaml_stubs.obj misc.cmo wx.cmo main.cmo
CMA_OBJS = \
	key.cmo \
	event.cmo \
	wObject.cmo \
	misc.cmo \
	wxcaml.cmo \
	wx.cmo \
	wTimer.cmo \
	configBase.cmo \
	htmlHelpController.cmo

CMXA_OBJS = \
	key.cmx \
	event.cmx \
	wObject.cmx \
	misc.cmx \
	wxcaml.cmx \
	wx.cmx \
	wTimer.cmx \
	configBase.cmx \
	htmlHelpController.cmx

CAML_OBJS = hello.cmo

POST_MLLIBS = \
	-cclib glu32.lib \
	-cclib opengl32.lib \
	-cclib wxcd-msw2.4.2-0.9.4.lib \
	-cclib libcamlidl.lib \
	-cclib ole32.lib

TARGET = tst.exe tstopt.exe
WXCD = wxcd-msw2.4.2-0.9.4.lib

TAR_FILES = \
	.depend \
	Makefile \
	Readme \
	log.make \
	configBase.ml \
	event.ml \
	help.ml \
	htmlHelpController.ml \
	key.ml \
	misc.ml \
	main.ml \
	wObject.ml \
	wTimer.ml \
	wx.ml \
	$(WXCD) \
	misc.h \
	misc_stubs.c \
	modwrap.c \
	start.c \
	wxcaml_stubs.c \
	wxdefs.h \
	examples \
	wxc \
	wxcaml

all: $(TARGET)

mkevent.exe: mkevent.c
	$(CC) $(CFLAGS) -o $@ mkevent.c $(WXLIBS)

tst.exe: $(WXCAMLLIB) wxcaml.cma main.cmo
	ocamlc -custom $(MLLFLAGS) -o $@ wxcaml.cma main.cmo

tstopt.exe: $(WXCAMLLIB) wxcaml.cmxa main.cmx
	ocamlopt $(MLLFLAGS) -o $@ wxcaml.cmxa main.cmx

$(WXCAMLLIB): modwrap.obj wxcaml_stubs.obj misc_stubs.obj start.obj
	-rm $(WXCAMLLIB)
	lib /out:$(WXCAMLLIB) modwrap.obj wxcaml_stubs.obj misc_stubs.obj start.obj

wxcaml.cma: $(WXCD) $(WXCAMLLIB) $(CMA_OBJS)
	ocamlc -custom -linkall -a $(MLFLAGS) -o $@ $(CMA_OBJS) -cclib -lwxcaml $(POST_MLLIBS)

wxcaml.cmxa: $(WXCD) $(WXCAMLLIB) $(CMXA_OBJS)
	ocamlopt -linkall -a $(MLFLAGS) -o $@ $(CMXA_OBJS) -cclib -lwxcaml $(POST_MLLIBS)

$(WXCD): $(WXHASKELL)/out/wxc/wxcd-msw2.4.2-0.9.4.lib
	cp $(WXHASKELL)/out/wxc/wxcd-msw2.4.2-0.9.4.lib .

wxcaml.h: wxcaml/wxcaml.h
	cp wxcaml/wxcaml.h .
wxcaml.ml: wxcaml/wxcaml.ml
	cp wxcaml/wxcaml.ml .
wxcaml.mli: wxcaml/wxcaml.mli
	cp wxcaml/wxcaml.mli .
wxcaml_stubs.c: wxcaml.h wxcaml/wxcaml_stubs.c
	cp wxcaml/wxcaml_stubs.c .

misc.h: wxcaml/misc.h
	cp wxcaml/misc.h .
misc.ml: wxcaml/misc.ml
	cp wxcaml/misc.ml .
misc.mli: wxcaml/misc.mli
	cp wxcaml/misc.mli .
misc_stubs.c: misc.h wxcaml/misc_stubs.c
	cp wxcaml/misc_stubs.c .

install: $(WXCAMLLIB) wxcaml.cma wx.cmo
	rm -rf $(INSTALL_DIR)
	mkdir $(INSTALL_DIR)
	cp $(WXCAMLLIB) *.cma *.cmi *.cmo *.mli \
	  $(WXCD) *.cmx *.cmxa \
	  $(INSTALL_DIR)

main.o: main.c
	$(CC) $(CFLAGS) -c main.c

libmod.a: $(LOBJS)
	cp $(OCAMLLIBDIR)/libcamlrun.a $@
	ar r $@ $(LOBJS)

modcaml.o: mod.cmo
	ocamlc -custom -output-obj -o modcaml.obj mod.cmo

wx.cmo wx.cmi: wx.ml
	ocamlc $(MLFLAGS) -c $<

dep:
	ocamldep *.ml *.mli > .depend

clean:
	rm -rf *.obj *.cmi *.cmo $(TARGET) *.exe
	rm -rf wxcaml.ml wxcaml.mli wxcaml.h
	rm -rf $(WXCAMLLIB)

tar:
	rm -rf ../wxcaml_dist
	mkdir ../wxcaml_dist
	cp -r $(TAR_FILES) ../wxcaml_dist
	(cd ..; tar cvf - wxcaml_dist | gzip -c > wxcaml.tar.gz)

.SUFFIXES: .c .obj .ml .mli .cmo .cmi .cmx
.c.obj:
	ocamlc $(MLFLAGS) -c $<
.ml.cmo:
	ocamlc $(MLFLAGS) -c $<
.ml.cmx:
	ocamlopt $(MLFLAGS) -c $<
.mli.cmi:
	ocamlc $(MLFLAGS) -c $<

include .depend

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-10-31 14:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-31 14:46 Makefile for wxcaml on Windows using Microsoft tools Jeremy O'Donoghue

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