Permalink
Browse files

Merge pull request #11 from jianingy/master

fixed ocaml range compilation problem on x86_64
  • Loading branch information...
2 parents ef1d7e9 + d4e361d commit 382512fee45e2b7e4a22bbe823a87bfce91f29ca @eam eam committed Jul 23, 2012
Showing with 7 additions and 4 deletions.
  1. +7 −4 librange/source/Makefile
View
11 librange/source/Makefile
@@ -8,10 +8,13 @@ LIBS = unix
PATH = /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
-LDPATH=-L /usr/lib/ocaml/site-lib/pcre/ -L /usr/local/lib -L /usr/lib
+LDPATH=-L /usr/lib/ocaml/site-lib/pcre/ -L /usr/local/lib -L /usr/lib
+
+OCAML_PCRE=$(shell ocamlfind query pcre)
+OCAML_STDLIB=$(shell ocamlfind query unix)
librange.so: camlcode.o librange.o
- ld -shared --whole-archive -o librange.so camlcode.o librange.o /usr/lib/ocaml/libunix.a /usr/lib/ocaml/libasmrun.a /usr/lib/ocaml/site-lib/pcre/libpcre_stubs.a -lm -lpcre -ldl
+ ld -fPIC -Bsymbolic -shared --whole-archive -o librange.so camlcode.o librange.o $(OCAML_STDLIB)/libunix.a $(OCAML_STDLIB)/libasmrun.a $(OCAML_PCRE)/libpcre_stubs.a -lm -lpcre -ldl
# unused
@@ -27,10 +30,10 @@ install:
install -m 755 librange.so $(DESTDIR)/usr/lib/
camlcode.o: ncl
- ocamlopt -I /usr/lib/ocaml/site-lib/pcre -output-obj -o camlcode.o unix.cmxa pcre.cmxa range_utils.cmx parser.cmx lexer.cmx memoize.cmx tinydns.cmx netmask.cmx admins.cmx netblocks.cmx hosts_netblocks.cmx evaluate.cmx range.cmx
+ ocamlopt -fPIC -I $(OCAML_PCRE) -output-obj -o camlcode.o unix.cmxa pcre/pcre.cmxa range_utils.cmx parser.cmx lexer.cmx memoize.cmx tinydns.cmx netmask.cmx admins.cmx netblocks.cmx hosts_netblocks.cmx evaluate.cmx range.cmx
librange.o: librange.c
- gcc -Wall -g -c librange.c -I /usr/lib/ocaml
+ gcc -fPIC -Wall -g -c librange.c -I $(OCAML_STDLIB)
cleaner: clean
rm -f librange.so librange.o testrange camlcode.o pcre_stubs.o

0 comments on commit 382512f

Please sign in to comment.