Browse Source

Makefile structure similar to engine, recursively specializing local.conf with defaults in Makefile.conf

JNI-88
heck 6 years ago
parent
commit
41fb26b250
  1. 21
      Makefile
  2. 25
      Makefile.conf
  3. 16
      README.md
  4. 16
      src/Makefile

21
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

25
src/Makefile.conf → 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 <subdir>/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)

16
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).

16
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 \

Loading…
Cancel
Save