aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile49
1 files changed, 38 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 681cc70..0b80ce0 100644
--- a/Makefile
+++ b/Makefile
@@ -2,15 +2,32 @@
DESTDIR = /
-OCAMLC = ocamlc -g
+DEBUG = n
+
+
+OCAMLC = ocamlc
OCAMLMLI = ocamlc
OCAMLOPT = ocamlopt -unsafe
OCAMLDEP=ocamldep
-OCAMLFLAGS=
+
+ifeq ($(DEBUG),y)
+OCAMLFLAGS = -g
+else
+OCAMLFLAGS =
+endif
+
OCAMLOPTFLAGS=
-CFLAGS=-Wall
+CFLAGS+=-Wall
+OCAMLINC=-I `ocamlc -where`
GLIBINC=`pkg-config --cflags glib-2.0`
+LBITS := $(shell getconf LONG_BIT)
+ifeq ($(LBITS),64)
+ FPIC=-fPIC
+endif
+
+
+
IVY = ivy.ml ivyLoop.ml
IVYCMO= $(IVY:.ml=.cmo)
@@ -30,12 +47,21 @@ TKIVYCMO= $(TKIVY:.ml=.cmo)
TKIVYCMI= $(TKIVY:.ml=.cmi)
TKIVYCMX= $(TKIVY:.ml=.cmx)
+UNAME = $(shell uname -s)
+
+ifeq ("$(UNAME)","Darwin")
+ LIBRARYS = -L/opt/local/lib
+endif
+
LIBS = ivy-ocaml.cma ivy-ocaml.cmxa glibivy-ocaml.cma glibivy-ocaml.cmxa
# tkivy-ocaml.cma tkivy-ocaml.cmxa
all : $(LIBS)
+DISTRO=`ocamlc -version`
+
deb :
+ cp debian/changelog.$(DISTRO) debian/changelog
dpkg-buildpackage -rfakeroot
ivy : ivy-ocaml.cma ivy-ocaml.cmxa
@@ -53,22 +79,22 @@ desinstall :
cd `ocamlc -where`; rm -f $(INST_FILES)
ivy-ocaml.cma : $(IVYCMO) civy.o civyloop.o
- ocamlmklib -o ivy-ocaml $^ -livy
+ ocamlmklib -o ivy-ocaml $^ $(LIBRARYS) -livy
ivy-ocaml.cmxa : $(IVYCMX) civy.o civyloop.o
- ocamlmklib -o ivy-ocaml $^ -livy
+ ocamlmklib -o ivy-ocaml $^ $(LIBRARYS) -livy
glibivy-ocaml.cma : $(GLIBIVYCMO) civy.o cglibivy.o
- ocamlmklib -o glibivy-ocaml $^ -lglibivy `pkg-config --libs glib-2.0` -lpcre
+ ocamlmklib -o glibivy-ocaml $^ $(LIBRARYS) -lglibivy `pkg-config --libs glib-2.0` -lpcre
glibivy-ocaml.cmxa : $(GLIBIVYCMX) civy.o cglibivy.o
- ocamlmklib -o glibivy-ocaml $^ -lglibivy `pkg-config --libs glib-2.0` -lpcre
+ ocamlmklib -o glibivy-ocaml $^ $(LIBRARYS) -lglibivy `pkg-config --libs glib-2.0` -lpcre
tkivy-ocaml.cma : $(TKIVYCMO) civy.o ctkivy.o
- ocamlmklib -o tkivy-ocaml $^ -livy -ltclivy
+ ocamlmklib -o tkivy-ocaml $^ $(LIBRARYS) -livy -ltclivy
tkivy-ocaml.cmxa : $(TKIVYCMX) civy.o ctkivy.o
- ocamlmklib -o tkivy-ocaml $^ -livy -ltclivy
+ ocamlmklib -o tkivy-ocaml $^ $(LIBRARYS) -livy -ltclivy
.SUFFIXES:
.SUFFIXES: .ml .mli .mly .mll .cmi .cmo .cmx .c .o .out .opt
@@ -76,7 +102,8 @@ tkivy-ocaml.cmxa : $(TKIVYCMX) civy.o ctkivy.o
.ml.cmo :
$(OCAMLC) $(OCAMLFLAGS) $(INCLUDES) -c $<
.c.o :
- $(CC) -Wall -c $(GLIBINC) $<
+
+ $(CC) -Wall -c $(FPIC) -I /opt/local/include/ $(OCAMLINC) $(GLIBINC) $<
.mli.cmi :
$(OCAMLMLI) $(OCAMLFLAGS) -c $<
.ml.cmx :
@@ -91,7 +118,7 @@ tkivy-ocaml.cmxa : $(TKIVYCMX) civy.o ctkivy.o
$(OCAMLOPT) -o $@ unix.cmxa -I . ivy-ocaml.cmxa $< -cclib -livy
clean:
- \rm -f *.cm* *.o *.a .depend *~ *.out *.opt .depend *.so *_stamp
+ \rm -fr *.cm* *.o *.a .depend *~ *.out *.opt .depend *.so *-stamp debian/ivy-ocaml debian/files debian/ivy-ocaml.debhelper.log debian/ivy-ocaml.substvars debian/*~
.depend:
$(OCAMLDEP) $(INCLUDES) *.mli *.ml > .depend