diff options
Diffstat (limited to 'stub/Makefile')
-rwxr-xr-x | stub/Makefile | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/stub/Makefile b/stub/Makefile index 462ba73..ea4ddde 100755 --- a/stub/Makefile +++ b/stub/Makefile @@ -3,20 +3,23 @@ LIB_STUB = $(LIB)_stub C_FILES = $(wildcard *.c)
OBJ_FILES = $(patsubst %.c,%.o,$(C_FILES))
+SHARED_EXTENSION=$(shell ocamlc -config | grep ext_dll | cut -d' ' -f2)
+LIBRARY=dll$(LIB_STUB)$(SHARED_EXTENSION)
+
#LINK_FLAG = $(shell pkg-config --libs $(LIB))
LINK_FLAG=
-all: dll$(LIB_STUB).so
+all: $(LIBRARY)
%.o: %.c
ocamlc -o $@ $<
-dll$(LIB_STUB).so: $(OBJ_FILES)
+$(LIBRARY): $(OBJ_FILES)
ocamlmklib -I ../_build -oc $(LIB_STUB) $(LINK_FLAG) $^
test -d ../_build || mkdir ../_build
- ln -sf ../stub/dll$(LIB_STUB).so ../_build/
- ln -sf ../stub/lib$(LIB_STUB).a ../_build/
+ cp $(LIBRARY) ../_build/
+ cp lib$(LIB_STUB).a ../_build/
clean:
- rm $(OBJ_FILES) *.so *.a
+ rm $(OBJ_FILES) $(LIBRARY) *.a
|