Add test target for figfs_test.
[figfs.git] / fuse / Makefile
blob732a0c8febeed5a36155679e5476386a4f802034
1 # Copyright (C) 2009 Reilly Grant
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 include ../common-defs.mk
19 all: $(if $(BYTE_ENABLED), fuse.cma) \
20 $(if $(NATIVE_ENABLED), fuse.cmxa) \
21 $(if $(BYTE_ENABLED), fusexmp) \
22 $(if $(NATIVE_ENABLED), fusexmp.opt)
24 CFLAGS = -fPIC -D_FILE_OFFSET_BITS=64 -pthread -I. -DPIC -DNATIVE_CODE -g
25 OCAMLFLAGS = -thread -package unix,threads,bigarray -warn-error -A -g -I .
27 GENERATED_FILES = Fuse_bindings_stubs.c \
28 Fuse_bindings.ml \
29 Fuse_bindings.mli \
30 Fuse_bindings.h
32 C_SOURCE = Fuse_bindings_stubs.c \
33 Fuse_util.c \
34 Unix_util_stubs.c
36 C_OBJECTS = $(C_SOURCE:.c=.o)
38 OCAML_SOURCE = Fuse_bindings.ml \
39 Result.ml \
40 Fuse_lib.ml \
41 Fuse.ml \
42 Unix_util.ml
44 OCAML_INTERFACES = Fuse_bindings.mli \
45 Fuse.mli
47 OCAML_BYTE_OBJECTS = $(OCAML_SOURCE:.ml=.cmo)
48 OCAML_BYTE_INTERFACES = $(OCAML_INTERFACES:.mli=.cmi)
49 OCAML_NATIVE_OBJECTS = $(OCAML_SOURCE:.ml=.cmx)
50 OCAML_CODE_OBJECTS = $(OCAML_SOURCE:.ml=.o)
52 $(GENERATED_FILES): Fuse_bindings.idl
53 camlidl -header $^
55 libfusestub.a: $(C_OBJECTS)
56 ar rcs $@ $^
58 dllfuse.so: $(C_OBJECTS)
59 gcc -o $@ -shared $(C_OBJECTS) -lfuse
61 fuse.cmxa fuse.a: $(OCAML_NATIVE_OBJECTS) libfusestub.a
62 $(OCAMLOPT) $(OCAMLFLAGS) -a -linkall -cclib -lfusestub -cclib -lfuse -cclib -lcamlidl -o $@ $(OCAML_NATIVE_OBJECTS)
64 fuse.cma: $(OCAML_BYTE_OBJECTS) libfusestub.a dllfuse.so
65 $(OCAMLC) $(OCAMLFLAGS) -custom -a -dllib dllfuse.so -linkall bigarray.cma -cclib -lfusestub -cclib -lfuse -cclib -lcamlidl -o $@ $(OCAML_BYTE_OBJECTS)
67 fusexmp: fuse.cma fusexmp.cmo
68 $(OCAMLC) $(OCAMLFLAGS) -custom -linkpkg -o $@ $^
70 fusexmp.opt: fuse.cmxa fusexmp.cmx
71 $(OCAMLOPT) $(OCAMLFLAGS) -linkpkg -o $@ $^
73 .PHONY: clean
75 clean:
76 rm .depend
77 rm -f $(GENERATED_FILES)
78 rm -f $(OCAML_BYTE_INTERFACES) fusexmp.cmi
79 ifdef BYTE_ENABLED
80 rm -f fuse.cma libfusestub.a
81 rm -f fusexmp fusexmp.cmo
82 rm -f $(OCAML_BYTE_OBJECTS)
83 endif
84 ifdef NATIVE_ENABLED
85 rm -f fuse.cmxa fuse.a libfusestub.a dllfuse.so
86 rm -f fusexmp.opt fusexmp.cmx fusexmp.o
87 rm -f $(OCAML_CODE_OBJECTS) $(OCAML_NATIVE_OBJECTS)
88 endif
89 rm -f $(C_OBJECTS)
92 .depend: $(OCAML_SOURCE) $(OCAML_INTERFACES)
93 ocamldep $^ > .depend
95 include ../common-rules.mk
96 include .depend