-
Notifications
You must be signed in to change notification settings - Fork 86
/
Makefile
38 lines (28 loc) · 1.26 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
PKG_CONFIG ?= pkg-config
CAPNP_CXX_FLAGS=$(shell $(PKG_CONFIG) capnp --cflags --libs)
ifeq ($(CAPNP_CXX_FLAGS),)
$(warning "Warning: pkg-config failed to find compilation configuration for capnp.")
$(warning "Falling back to a guess based on the location of the capnp executable.")
CAPNP_PREFIX=$(shell dirname $(shell which capnp))/..
CAPNP_CXX_FLAGS=-I $(CAPNP_PREFIX)/include -L $(CAPNP_PREFIX)/lib -lkj -lcapnp
endif
PREFIX ?= /usr/local
CXX ?= g++
CXX_FLAGS=-std=c++14 $(CAPNP_CXX_FLAGS)
CAPNPC_JAVA_SOURCES=compiler/src/main/cpp/capnpc-java.c++
.PHONY: all clean
all : capnpc-java
clean :
rm -f capnpc-java capnpc-java.exe
capnpc-java : $(CAPNPC_JAVA_SOURCES)
$(CXX) $(CAPNPC_JAVA_SOURCES) $(CXX_FLAGS) $(CFLAGS) $(LDFLAGS) -o capnpc-java
install:
mkdir -p ${PREFIX}/bin
mkdir -p ${PREFIX}/include/capnp/
cp capnpc-java ${PREFIX}/bin
cp compiler/src/main/schema/capnp/java.capnp ${PREFIX}/include/capnp/
MINGW_LIBS=~/src/capnproto/c++/build-mingw/.libs/libcapnp.a ~/src/capnproto/c++/build-mingw/.libs/libkj.a
MINGW_CXX=i686-w64-mingw32-g++
MINGW_FLAGS=-O2 -DNDEBUG -I/usr/local/include -std=c++14 -static -static-libgcc -static-libstdc++
capnpc-java.exe : $(CAPNPC_JAVA_SOURCES)
$(MINGW_CXX) $(MINGW_FLAGS) $(CAPNPC_JAVA_SOURCES) $(MINGW_LIBS) -o capnpc-java.exe