This repository has been archived by the owner on Feb 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathMakefile
82 lines (65 loc) · 1.73 KB
/
Makefile
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#
# Copyright (c) 2014, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the Boost-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
VERSION=0.4.0-dev
INTERNAL_VERSION=0004
product=libdfuse-$(VERSION)
PREFIX=/usr/local
DMD=dmd
DMDFLAGS=
sources = source/c/fuse/fuse.d source/c/fuse/common.d source/dfuse/fuse.d
uname := $(shell uname -s)
# Define variables and buildmodes depending on ENABLE_DEBUG, ENABLE_64BIT and
# operating system.
buildmode=release
ifeq ($(ENABLE_DEBUG),1)
MODE=-debug -g
buildmode=debug
else
MODE=-release -O -inline
buildmode=release
endif
bitmode=64
ifeq ($(uname),Darwin)
ifeq ($(ENABLE_64BIT),1)
MODE+=-version=DARWIN_USE_64_BIT_INODE
LIBS=-L-losxfuse
bitmde=64
else
LIBS=-L-losxfuse_i32
bitmode=32
endif
endif
ifeq ($(uname),Linux)
LIBS=-L-lfuse
bitmode=64
endif
# Define build directories and main target for libs
builddir=build/$(buildmode)/$(bitmode)
ifeq ($(uname),Linux)
artifact=$(builddir)/$(product).so
endif
ifeq ($(uname),Darwin)
artifact=$(builddir)/$(product).dylib
endif
all:: dfuse
$(builddir):
mkdir -p $(builddir)
$(builddir)/$(product).so: $(sources)
$(DMD) -w $(MODE) -shared $(LIBS) -version=$(INTERNAL_VERSION) -of$@ $(sources)
$(builddir)/$(product).dylib: $(sources)
$(DMD) -w $(MODE) -shared $(LIBS) -version=$(INTERNAL_VERSION) -of$@ $(sources)
simplefs: example/simplefs.d $(sources)
$(DMD) -w -debug -g $(LIBS) -of$@ example/simplefs.d $(sources)
examples: simplefs
dfuse: $(artifact)
clean:
@(rm simplefs 2>/dev/null || exit 0)
@(rm -r $(artifact) || exit 0)
@(rm -rf build/ || exit 0)
.PHONY: dfuse all clean examples