-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
67 lines (53 loc) · 1.27 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
include $(GOROOT)/src/Make.inc
all: package
TARG=github.com/Shopify/gozk
GOFILES=\
server.go\
runserver.go\
CGOFILES=\
zk.go\
CGO_OFILES=\
helpers.o\
ifdef ZKROOT
LIBDIR=$(ZKROOT)/src/c/.libs
LD_LIBRARY_PATH:=$(LIBDIR):$(LD_LIBRARY_PATH)
CGO_CFLAGS+=-I$(ZKROOT)/src/c/include -I$(ZKROOT)/src/c/generated
CGO_LDFLAGS+=-L$(LIBDIR)
else
LIBDIR=/usr/lib
endif
# For static compilation, will have to take LDFLAGS out of gozk.go too.
ifdef STATIC
CGO_LDFLAGS+=-lm -lpthread
# XXX This has ordering issues with current Make.pkg:
#CGO_OFILES+=$(wildcard _lib/*.o)
#
#_lib:
# @mkdir -p _lib
# cd _lib && ar x $(LIBDIR)/libzookeeper_mt.a
#
#_cgo_defun.c: _lib
CGO_OFILES+=\
_lib/hashtable_itr.o\
_lib/libzkmt_la-zk_hashtable.o\
_lib/hashtable.o\
_lib/libzkmt_la-zk_log.o\
_lib/libzkmt_la-mt_adaptor.o\
_lib/libzkmt_la-zookeeper.jute.o\
_lib/libzkmt_la-recordio.o\
_lib/libzkmt_la-zookeeper.o\
_lib/%.o:
@mkdir -p _lib
cd _lib && ar x $(LIBDIR)/libzookeeper_mt.a
endif
CLEANFILES+=_lib
GOFMT=gofmt
BADFMT:=$(shell $(GOFMT) -l $(GOFILES) $(CGOFILES) $(wildcard *_test.go))
gofmt: $(BADFMT)
@for F in $(BADFMT); do $(GOFMT) -w $$F && echo $$F; done
ifneq ($(BADFMT),)
ifneq ($(MAKECMDGOALS),gofmt)
$(warning WARNING: make gofmt: $(BADFMT))
endif
endif
include $(GOROOT)/src/Make.pkg