-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (41 loc) · 1.74 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
GO ?= go
GOMOBILE ?= gomobile
build-client-go:
$(GO) vet .
$(GO) build .
all: build-client-go lib/libninchat.a lib/ninchat-client.aar lib/NinchatLowLevelClient.framework/NinchatLowLevelClient
check: check-client check-api check-message check-c
check-client: check-client-go check-client-js
check-client-go: build-client-go
$(GO) test -v .
check-client-js: bin/gopherjs
bin/gopherjs build
check-api:
$(GO) vet ./ninchatapi
$(GO) test -v ./ninchatapi
check-message:
$(GO) vet ./ninchatmessage
$(GO) test -v ./ninchatmessage
bin/gopherjs: Makefile
$(GO) get -d github.com/gopherjs/gopherjs
$(GO) build -o bin/gopherjs github.com/gopherjs/gopherjs
lib/libninchat.a: $(wildcard *.go c/*.go include/*.h) Makefile
@ mkdir -p lib
$(GO) build -buildmode=c-archive -o $@ c/library.go
bin/c-test: $(wildcard c/test/*.c include/*.h) lib/libninchat.a Makefile
@ mkdir -p bin
$(CC) $(CPPFLAGS) $(CFLAGS) -pthread -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -g -o $@ c/test/test.c lib/libninchat.a
check-c: bin/c-test
bin/c-test
lib/ninchat-client.aar: $(wildcard *.go mobile/*.go) Makefile
@ mkdir -p lib
$(GOMOBILE) bind -target=android -javapkg=com.ninchat -o $@ github.com/ninchat/ninchat-go/mobile
lib/NinchatLowLevelClient.framework/NinchatLowLevelClient: $(wildcard *.go mobile/*.go) Makefile
@ mkdir -p lib
$(GOMOBILE) bind -target=ios -prefix=NINLowLevel -o $(patsubst %/,%,$(dir $@)) github.com/ninchat/ninchat-go/mobile
mv $(dir $@)/Versions/Current/Client $(dir $@)/Versions/Current/NinchatLowLevelClient
rm $(dir $@)/Client
ln -sf Versions/Current/NinchatLowLevelClient $@
clean:
rm -rf bin lib pkg
.PHONY: all build-client-go check check-client check-client-go check-client-js check-api check-message check-c clean