aboutsummaryrefslogtreecommitdiff
path: root/stub/Makefile
blob: ea4ddde61decf29c6937b8dad06f8a5bc9fb7331 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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: $(LIBRARY)

%.o: %.c
	ocamlc -o $@ $<

$(LIBRARY): $(OBJ_FILES)
	ocamlmklib -I ../_build -oc $(LIB_STUB) $(LINK_FLAG) $^
	test -d ../_build || mkdir ../_build
	cp $(LIBRARY) ../_build/
	cp lib$(LIB_STUB).a ../_build/

clean:
	rm $(OBJ_FILES) $(LIBRARY) *.a