ACCUMULO-1843 Use the correct name that Platform.getPlatform generates
[accumulo.git] / server / native / src / main / resources / Makefile
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements. See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 SRCS=$(wildcard nativeMap/*.cc)
17 HDRS=$(wildcard nativeMap/*.h) $(wildcard javah/*.h)
18 TESTSRCS=$(wildcard testNativeMap/*.cc)
19 CXX=g++
20
21 ifeq ($(shell uname),Linux)
22 JAVA_HOME=$(shell dirname $$(dirname $$(readlink -ef $$(which javah))))
23 NATIVE_LIB := libaccumulo.so
24 CXXFLAGS=-m64 -g -fPIC -shared -O2 -fno-omit-frame-pointer -fno-strict-aliasing -Wall -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -Ijavah
25 endif
26
27 ifeq ($(shell uname),Darwin)
28 JAVA_HOME=$(shell /usr/libexec/java_home)
29 NATIVE_LIB:= libNativeMap-Mac_OS_X-x86_64-64.dylib
30 # Update flags for OSX-10.9 and Xcode 5.0.1
31 # I think that we should be able to remove the `-undefined dynamic_lookup` option,
32 # but I don't know exactly how to go about this.
33 CXXFLAGS=-m64 -dynamiclib -undefined dynamic_lookup -O3 -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin -I/usr/include/c++/4.2.1 -Ijavah
34 endif
35
36 all : $(NATIVE_LIB)
37
38 $(NATIVE_LIB) : $(SRCS) $(HDRS)
39 $(CXX) $(CXXFLAGS) -o $@ $(SRCS)
40
41 test : $(NATIVE_LIB) testJavaHome runTests
42
43 testJavaHome :
44 @echo JAVA_HOME is $(JAVA_HOME)
45
46 runTests : clean $(TESTSRCS) $(NATIVE_LIB)
47 $(CXX) -g -Wall -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -InativeMap -o $@ $(TESTSRCS) $(NATIVE_LIB)
48 LD_LIBRARY_PATH=./ ./$@ 20 20 20 20 20 20 20 20 true
49
50 clean :
51 rm -f $(NATIVE_LIB) runTests

Copyright 2016, The Apache Software Foundation.