Browse Source

add Makefile targets install/uninstall (to $PREFIX)

update local.conf.example
JNI-106
heck 2 years ago
parent
commit
0f04448905
4 changed files with 45 additions and 21 deletions
  1. +8
    -1
      Makefile
  2. +10
    -9
      Makefile.conf
  3. +15
    -10
      local.conf.example
  4. +12
    -1
      src/Makefile

+ 8
- 1
Makefile View File

@ -3,7 +3,7 @@
# This file may be used under the terms of the GNU General Public License version 3
# see LICENSE.txt
.PHONY: all src test clean doxy-all doxy-cxx doxy-java doxy-clean
.PHONY: all src test clean doxy-all doxy-cxx doxy-java doxy-clean install uninstall
all: src
@ -29,3 +29,10 @@ doxy-java: src
doxy-clean:
rm -rf doc/doxygen/cxx
rm -rf doc/doxygen/java
install:
$(MAKE) -C src install
uninstall:
$(MAKE) -C src uninstall

+ 10
- 9
Makefile.conf View File

@ -10,24 +10,20 @@ PLATFORM:=$(shell uname | tr A-Z a-z)
# The dev environment paths and configs are set to a default value which can be overridden by ./local.conf and overridden again by <subdir>/local.conf
######### Build Config Defaults #########
DEBUG=1
PREFIX=$(HOME)/local
YML2_PATH=$(HOME)/yml2
YML2_PROC=$(YML2_PATH)/yml2proc $(YML2_OPTS)
YML2_OPTS=--encoding=utf8
ENGINE_LIB_PATH=$(HOME)/lib
ENGINE_INC_PATH=$(HOME)/include
AD_LIB_PATH=$(HOME)/lib
AD_INC_PATH=$(HOME)/include
ENGINE_LIB_PATH=$(PREFIX)/lib
ENGINE_INC_PATH=$(PREFIX)/include
AD_LIB_PATH=$(PREFIX)/lib
AD_INC_PATH=$(PREFIX)/include
### Guessing JAVA_HOME
ifeq ($(PLATFORM),linux)
JAVA_HOME=$(subst /bin,,$(dir $(realpath /usr/bin/javac)))
endif
ifndef JAVA_HOME
$(error JAVA_HOME is not set!)
endif
JAVA_BIN_DIR=$(JAVA_HOME)/bin
# Old versions of a Java distribution have a `javah` binary, new versions do not. This checks whether or not `javah` can be found in the Java distribution found in the directory `$JAVA_HOME`.
DUMMY:=$(shell which $(JAVA_HOME)/bin/javah)
@ -49,6 +45,11 @@ ENGINE_INC=-I$(ENGINE_INC_PATH)
AD_LIB=-L$(AD_LIB_PATH)
AD_INC=-I$(AD_INC_PATH)
ifndef JAVA_HOME
$(error JAVA_HOME is not set!)
endif
JAVA_BIN_DIR=$(JAVA_HOME)/bin
######### C and C++ #########
CXXFLAGS+=-O0 -std=c++11 -fpermissive -fPIC -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/$(PLATFORM) $(AD_INC) $(ENGINE_INC)


+ 15
- 10
local.conf.example View File

@ -2,23 +2,28 @@
# you might not need this file, but if the defaults dont work for you
# You can override them here.
# Tweak the values to your needs and rename it to local.conf
# These example values here reflect the defaults
############ Install ###########
# PREFIX=$(HOME)/local
######### C++ Compiler #########
# Should work with clang and g++
# CXX=g++
# DEBUG=1 # DEBUG Build (Default)
# DEBUG=0 # RELEASE Build
# DEBUG=0 # RELEASE Build / set to 1 for DEBUG build
######### JAVA #########
############ JAVA ##############
# JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home
######### YML2 #########
############ YML2 ##############
# YML2_PATH=$(HOME)/code/yml2
######### Engine #########
# ENGINE_LIB_PATH=$(HOME)/local/lib
# ENGINE_INC_PATH=$(HOME)/local/include
########### Engine #############
# ENGINE_LIB_PATH=$(PREFIX)/lib
# ENGINE_INC_PATH=$(PREFIX)/include
########## libAdapter ##########
# AD_LIB_PATH=$(PREFIX)/lib
# AD_INC_PATH=$(PREFIX)/include
######### libAdapter #########
# AD_LIB_PATH=$(HOME)/local/lib
# AD_INC_PATH=$(HOME)/local/include

+ 12
- 1
src/Makefile View File

@ -89,7 +89,7 @@ tmp=$(SOURCES:.cc=.o)
OBJECTS=$(addprefix $(OBJ_DIR), $(tmp))
DEPENDS=$(OBJECTS:.o=.d)
.PHONY: all lib-java lib-cxx compile-java compile-cxx gen-jni-headers codegen clean create-dirs remove-dirs
.PHONY: all lib-java lib-cxx compile-java compile-cxx gen-jni-headers codegen clean create-dirs remove-dirs install uninstall
$(info SOURCES: $(SOURCES))
$(info OBJECTS: $(OBJECTS))
@ -167,3 +167,14 @@ clean: remove-dirs
rm -f $(DEPENDS)
rm -f $(OBJECTS)
install: $(LIB_JAVA) $(LIB_CXX_STATIC) $(LIB_CXX_DYN)
mkdir -p $(PREFIX)/lib
cp -v $(DIST_DIR)/$(LIB_JAVA) $(PREFIX)/lib/
cp -v $(DIST_DIR)/$(LIB_CXX_STATIC) $(PREFIX)/lib/
cp -v $(DIST_DIR)/$(LIB_CXX_DYN) $(PREFIX)/lib/
uninstall:
cd $(PREFIX)/lib && rm -vf $(LIB_JAVA)
cd $(PREFIX)/lib && rm -vf $(LIB_CXX_STATIC)
cd $(PREFIX)/lib && rm -vf $(LIB_CXX_DYN)

Loading…
Cancel
Save