diff --git a/Makefile b/Makefile index 58be3c8..b329780 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,24 @@ +# Copyright 2017, pEp Foundation +# This file is part of pEp JNI Adapter +# This file may be used under the terms of the GNU General Public License version 3 +# see LICENSE.txt + +HERE_REL := $(notdir $(CURDIR)) + +include Makefile.conf + +ifneq ($(wildcard local.conf),) + $(info ================================================) + $(info Overrides in `local.conf` are used.) + $(info ================================================) +endif + +ifdef BUILD_CONFIG + $(info ================================================) + $(info Overrides in `$(BUILD_CONFIG)` are used.) + $(info ================================================) +endif + .PHONY: all src test clean all: src test diff --git a/src/Makefile.conf b/Makefile.conf similarity index 79% rename from src/Makefile.conf rename to Makefile.conf index 02482af..c5a71e6 100644 --- a/src/Makefile.conf +++ b/Makefile.conf @@ -35,33 +35,24 @@ else ifeq ($(BUILD_FOR),Darwin) CXXFLAGS+=-fcolor-diagnostics -fpermissive -fPIC -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin $(AD_INC) $(ENGINE_INC) endif - +# DEV ENV PATHS & CFG +# The dev environment paths and configs are set to a default value which can be overridden by ./local.conf and overridden again by /local.conf ######### YML2 ######### YML2_PATH=$(HOME)/yml2 - YML2_PROC=$(YML2_PATH)/yml2proc $(YML2_OPTS) - YML2_OPTS=--encoding=utf8 - ######### Engine ######### -ENGINE_LIB= -#ENGINE_LIB=-L$(HOME)/lib - -ENGINE_INC= -#ENGINE_INC=-I$(ENGINE_INC_DIR) - +ENGINE_LIB=-L$(HOME)/lib +ENGINE_INC=-I$(HOME)/include ######### libAdapter ######### -AD_LIB= -#AD_LIB=-L$(HOME)/local/lib - -AD_INC= -#AD_INC=-I$(HOME)/local/inc - +AD_LIB=-L$(HOME)/lib +AD_INC=-I$(HOME)/include -######### Footer ######### +######### Overrides ######### -include $(HERE)/local.conf +-include $(HERE)/src/local.conf ifdef BUILD_CONFIG include $(BUILD_CONFIG) diff --git a/README.md b/README.md index aacc7b8..ff17ee9 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,13 @@ sudo port install openjdk11 ~~~ ## Building -Customization of the build can be done in `src/Makefile.conf`, or in a file `src/local.conf` which is not part of the source code distribution. -An example `src/local.conf` looks like this: +Build configuration will be the result of including these files in the following order: +* `Makefile.conf` - Defaults +* `local.conf` - optional cfg (overwrites existing values) +* `src/local.conf`- optional cfg for src dir (overwrites existing values) + +An example `local.conf` looks like this: ~~~ JAVA_HOME=/Library/Java/JavaVirtualMachines/openjdk8/Contents/Home @@ -49,15 +53,13 @@ Now, build the Adapter with On Linux: ~~~ -cd src -make +make src ~~~ On macOS: ~~~ -cd src -gmake +make src ~~~ -(The GNU Make distributed with macOS is too old, install GNU Make "gmake" from macPorts). +(The GNU Make distributed with macOS might be too old, in this case install GNU Make "gmake" from macPorts). diff --git a/src/Makefile b/src/Makefile index b7adb3e..38404ab 100644 --- a/src/Makefile +++ b/src/Makefile @@ -3,19 +3,7 @@ # This file may be used under the terms of the GNU General Public License version 3 # see LICENSE.txt -include Makefile.conf - -ifneq ($(wildcard local.conf),) - $(info ================================================) - $(info Overrides in `local.conf` are used.) - $(info ================================================) -endif - -ifdef BUILD_CONFIG - $(info ================================================) - $(info Overrides in `$(BUILD_CONFIG)` are used.) - $(info ================================================) -endif +include ../Makefile.conf ifndef JAVA_HOME $(error JAVA_HOME is not set!) @@ -37,7 +25,7 @@ ifeq ($(BUILD_FOR),Linux) else ifeq ($(BUILD_FOR),Darwin) SHARED=libpEpJNI.dylib else - $(error I don't know how to build for $(BUILD_FOR).) + $(error I dont know how to build for $(BUILD_FOR).) endif JAVA_SOURCES=foundation/pEp/jniadapter/AbstractEngine.java \