forked from fibercrypto/libskyfiber-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
45 lines (40 loc) · 1.67 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
PWD = $(shell pwd)
GOPATH_DIR = $(PWD)/gopath
SKYCOIN_DIR = gopath/src/github.com/skycoin/skycoin
SKYBUILD_DIR = $(SKYCOIN_DIR)/build
BUILDLIBC_DIR = $(SKYBUILD_DIR)/libskycoin
LIBC_DIR = $(SKYCOIN_DIR)/lib/cgo
LIBSWIG_DIR = $(SKYCOIN_DIR)/lib/swig
BUILD_DIR = build
BIN_DIR = $(SKYCOIN_DIR)/bin
INCLUDE_DIR = $(SKYCOIN_DIR)/include
FULL_PATH_LIB = $(PWD)/$(BUILDLIBC_DIR)
LIB_FILES = $(shell find $(SKYCOIN_DIR)/lib/cgo -type f -name "*.go")
SRC_FILES = $(shell find $(SKYCOIN_DIR)/src -type f -name "*.go")
SWIG_FILES = $(shell find $(LIBSWIG_DIR) -type f -name "*.i")
HEADER_FILES = $(shell find $(SKYCOIN_DIR)/include -type f -name "*.h")
configure:
mkdir -p $(BUILD_DIR)/usr/tmp $(BUILD_DIR)/usr/lib $(BUILD_DIR)/usr/include
mkdir -p $(BUILDLIBC_DIR) $(BIN_DIR) $(INCLUDE_DIR)
$(BUILDLIBC_DIR)/libskycoin.a: $(LIB_FILES) $(SRC_FILES) $(HEADER_FILES)
rm -f $(BUILDLIBC_DIR)/libskycoin.a
GOPATH="$(GOPATH_DIR)" make -C $(SKYCOIN_DIR) build-libc-static
ls $(BUILDLIBC_DIR)
rm -f swig/include/libskycoin.h
mkdir -p swig/include
grep -v _Complex $(INCLUDE_DIR)/libskycoin.h > swig/include/libskycoin.h
## Build libskycoin C client library
build-libc: configure $(BUILDLIBC_DIR)/libskycoin.a
build-swig:
#Generate structs.i from skytypes.gen.h
rm -f $(LIBSWIG_DIR)/structs.i
cp $(INCLUDE_DIR)/skytypes.gen.h $(LIBSWIG_DIR)/structs.i
#sed -i 's/#/%/g' $(LIBSWIG_DIR)/structs.i
{ \
if [[ "$$(uname -s)" == "Darwin" ]]; then \
sed -i '.kbk' 's/#/%/g' $(LIBSWIG_DIR)/structs.i ;\
else \
sed -i 's/#/%/g' $(LIBSWIG_DIR)/structs.i ;\
fi \
}
swig -csharp -Iswig/include -I$(INCLUDE_DIR) -outdir ./LibskycoinNet/skycoin -o ./LibskycoinNet/skycoin/skycoin.cs $(LIBSWIG_DIR)/skycoin.i