@ -1,21 +1,30 @@ | |||
# Copyright 2017, pEp Foundation | |||
# This file is part of pEpEngine | |||
# This file may be used under the terms of the GNU General Public License version 3 | |||
# see LICENSE.txt | |||
# this file is in the Public Domain | |||
# This file assembles all the make variables that a maintainer or dev may want to taylor to his or her needs on a given platform. | |||
BUILD_ON=$(shell uname) | |||
BUILD_FOR=$(BUILD_ON) | |||
OPTIMIZE=-g -Wall -O0 -fPIC -DDEBUG_ERRORSTACK | |||
#OPTIMIZE=-O3 -Wall -DNDEBUG -std=c99 | |||
LD=$(CC) | |||
#CC=gcc-mp-4.9 -std=c99 -fstrict-aliasing -Wstrict-aliasing=3 | |||
#LD=gcc-mp-4.9 | |||
SYSTEM_DB=/usr/local/share/pEp/system.db | |||
PREFIX=$(HOME) | |||
YML2PROC=$(HOME)/yml2/yml2proc | |||
YML_OPTS=--encoding=utf8 | |||
YML_PATH=$(HOME)/yml2 | |||
ASN1C=asn1c | |||
ASN1C_INCLUDE=/opt/local/share/asn1c | |||
#ETPAN_IN=$(HOME) | |||
#LIBGPGME=/opt/local/lib/libgpgme.11.dylib | |||
# To use custom build configuration variables, put them in a new file with the path `build-config/<name>.conf`. Execute `export PLATFORM_OVERRIDE=<name>` before running make. If this environment variable is not set, make will load a default configuration for your platform. | |||
# C makros (not environment variables) to overwrite: | |||
# | |||
# DEFAULT_KEYSERVER - string with default keyserver | |||
# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps | |||
BUILD_CONFIG:=$(dir $(lastword $(MAKEFILE_LIST)))build-config | |||
#EXTRAMACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23 | |||
include $(BUILD_CONFIG)/common.conf | |||
# cross-compiling is currently not supported, but maybe you can hack something with `PLATFORM_OVERRIDE` | |||
ifeq ($(BUILD_ON),$(BUILD_FOR)) | |||
include $(BUILD_CONFIG)/$(BUILD_ON).conf | |||
else | |||
$(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON)) | |||
endif | |||
ifdef PLATFORM_OVERRIDE | |||
include $(BUILD_CONFIG)/$(PLATFORM_OVERRIDE).conf | |||
endif | |||
# second instance for testing | |||
#EXTRAMACROS=-DLOCAL_DB_FILENAME=\".pEp_management2.db\" | |||
#TARGET=libpEpEngine2.dylib |
@ -1,35 +1,37 @@ | |||
# Copyright 2017, pEp Foundation | |||
# This file is part of pEpEngine | |||
# This file may be used under the terms of the GNU General Public License version 3 | |||
# This file is under GNU General Public License 3.0 | |||
# see LICENSE.txt | |||
include ../Makefile.conf | |||
ALL_SOURCE=$(wildcard *.c) | |||
ifeq ($(BUILD_ON),Linux) | |||
ifeq ($(BUILD_FOR),Linux) | |||
CC=gcc | |||
CFLAGS?=-fPIC | |||
else | |||
$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON)) | |||
endif | |||
endif | |||
ALL_SOURCE=$(subst $(NO_SOURCE),,$(wildcard *.c)) | |||
ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE)) | |||
libasn1.a: $(ALL_OBJECTS) | |||
ar -rc $@ $^ | |||
ar -rc $@ $(ALL_OBJECTS) | |||
# "converter-sample.c" is the example file containing a "main()" function generated by ans1c. | |||
.PHONY: generate | |||
generate: Sync-Protocols.c | |||
rm -f converter-sample.c | |||
%.o: %.c %.h | |||
$(CC) $(CFLAGS) $(CFLAGS_GENERATED) -I. $(ASN1C_INC) -c $< -o $@ | |||
$(CC) $(CFLAGS) $(OPTIMIZE) -I. -I$(ASN1C_INCLUDE) -c $< -o $@ | |||
Sync-Protocols.c: pEp.asn1 devicegroup.asn1 protocols.asn1 | |||
$(ASN1C) -gen-PER -fincludes-quoted -fcompound-names -pdu=PEP.Message $^ | |||
Sync-Protocols.c: protocols.asn1 devicegroup.asn1 pEp.asn1 | |||
$(ASN1C) -gen-PER -fincludes-quoted -fcompound-names -pdu=PEP.Message pEp.asn1 devicegroup.asn1 $< | |||
.PHONY: clean | |||
clean: | |||
rm -f *.a *.o *.c *.h *.sample | |||
.PHONY: install | |||
install: libasn1.a | |||
cp $< $(PREFIX)/lib/ | |||
.PHONY: uninstall | |||
uninstall: | |||
rm -f $(PREFIX)/lib/libasn1.a |
@ -1,55 +0,0 @@ | |||
# Copyright 2017, pEp Foundation | |||
# This file is part of pEpEngine | |||
# This file may be used under the terms of the GNU General Public License version 3 | |||
# see LICENSE.txt | |||
######### General ######### | |||
TARGET=libpEpEngine.dylib | |||
######### C ######### | |||
# clang issues a warning when "-pthread" is used for linking. So, include it in CFLAGS, and not in CC | |||
CC=clang -std=c99 | |||
CFLAGS=-pthread -fPIC -fstrict-aliasing -fcolor-diagnostics | |||
ifdef WARN | |||
CFLAGS+= -Wall -pedantic | |||
else | |||
CFLAGS+= -w | |||
endif | |||
ifdef DEBUG | |||
CFLAGS+= -O0 -g -DDEBUG_ERRORSTACK | |||
else | |||
CFLAGS+= -O3 -DNDEBUG | |||
endif | |||
CFLAGS_GENERATED= | |||
######### C++ ######### | |||
# clang issues a warning when "-pthread" is used for linking. So, include it in CXXFLAGS, and not in CXX | |||
CXX=clang -std=c++11 | |||
CXXFLAGS=-pthread -fcolor-diagnostics -I../src -I../asn.1 $(ETPAN_INC) | |||
ifdef WARN | |||
CXXFLAGS+= | |||
else | |||
CXXFLAGS+= -w | |||
endif | |||
ifdef DEBUG | |||
CXXFLAGS+= -O0 -g | |||
else | |||
CXXFLAGS+= -O3 -DNDEBUG | |||
endif | |||
######### C and C++ ######### | |||
######### YML2 ######### | |||
######### asn1c ######### | |||
######### libetpan ######### | |||
######### OpenPGP ######### | |||
LIBGPGME=libgpgme.dylib | |||
GPGME_LIB=-L/opt/local/lib | |||
GPGME_INC=-I/opt/local/include | |||
######### Engine internals ######### | |||
######### Misc ######### |
@ -1,54 +0,0 @@ | |||
# Copyright 2017, pEp Foundation | |||
# This file is part of pEpEngine | |||
# This file may be used under the terms of the GNU General Public License version 3 | |||
# see LICENSE.txt | |||
######### General ######### | |||
TARGET=libpEpEngine.so | |||
######### C ######### | |||
CC=gcc -std=c99 -pthread | |||
CFLAGS=-fPIC -fstrict-aliasing -fdiagnostics-color=always | |||
ifdef WARN | |||
CFLAGS+= -Wall -pedantic -Wstrict-aliasing=3 | |||
else | |||
CFLAGS+= -w | |||
endif | |||
ifdef DEBUG | |||
CFLAGS+= -Og -ggdb -DDEBUG_ERRORSTACK | |||
else | |||
CFLAGS+= -O3 -DNDEBUG | |||
endif | |||
# '-Wno-cpp' is required to suppress the warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" otherwise printed during the compilation of every asn1c-generated C file. | |||
CFLAGS_GENERATED=-Wno-cpp | |||
######### C++ ######### | |||
CXX=g++ -std=gnu++11 -pthread | |||
CXXFLAGS=-fdiagnostics-color=always -I../src -I../asn.1 $(ETPAN_INC) | |||
ifdef WARN | |||
CXXFLAGS+= | |||
else | |||
CXXFLAGS+= -w | |||
endif | |||
ifdef DEBUG | |||
CXXFLAGS+= -Og -ggdb | |||
else | |||
CXXFLAGS+= -O3 -DNDEBUG | |||
endif | |||
######### C and C++ ######### | |||
######### YML2 ######### | |||
######### asn1c ######### | |||
######### libetpan ######### | |||
######### OpenPGP ######### | |||
LIBGPGME=libgpgme.so.11 | |||
GPGME_LIB= | |||
GPGME_INC= | |||
######### Engine internals ######### | |||
######### Misc ######### |
@ -1,88 +0,0 @@ | |||
# Copyright 2017, pEp Foundation | |||
# This file is part of pEpEngine | |||
# This file may be used under the terms of the GNU General Public License version 3 | |||
# see LICENSE.txt | |||
# General remark: to use (only) system libraries, set all the *_INC and *_LIB variables to the empty string. | |||
######### General ######### | |||
BUILD_ON:=$(shell uname) | |||
BUILD_FOR=$(BUILD_ON) | |||
# Installation path prefix for libraries and binaries, except for system.db | |||
PREFIX=$(HOME) | |||
# Installation path for system.db | |||
SYSTEM_DB=/usr/local/share/pEp/system.db | |||
# Filename of the pEpEngine library | |||
#TARGET This option is platform-specific | |||
# If not empty, create a debug build | |||
DEBUG=placeholder | |||
# If not empty, print compiler warnings | |||
WARN=placeholder | |||
######### C ######### | |||
#CC This option is platform-specific | |||
CPPFLAGS= | |||
#CFLAGS This option is platform-specific | |||
# Additional CFLAGS used for compiling ASN1C-generated code | |||
#CFLAGS_GENERATED This option is platform-specific | |||
######### C++ ######### | |||
#CXX This option is platform-specific | |||
#CXXFLAGS This option is platform-specific | |||
######### C and C++ ######### | |||
TARGET_ARCH= | |||
# The following two variables will be appended to. You can thus not set them to a fixed value here. | |||
LDFLAGS= | |||
LDLIBS= | |||
######### YML2 ######### | |||
YML2_PATH=$(HOME)/yml2 | |||
YML2_PROC=$(YML2_PATH)/yml2proc | |||
YML2_OPTS=--encoding=utf8 | |||
######### asn1c ######### | |||
# asn1c binary | |||
ASN1C=asn1c | |||
# asn1c include search flag | |||
ASN1C_INC= | |||
#ASN1C_INC= -I$(HOME)/include | |||
######### libetpan ######### | |||
# libetpan library search flag | |||
ETPAN_LIB=-L$(PREFIX)/lib | |||
# libetpan include search flag | |||
ETPAN_INC=-I$(PREFIX)/include | |||
######### OpenPGP ######### | |||
# Path of GPG binary | |||
GPG_CMD=gpg | |||
ifneq ($(shell which gpg2),) | |||
GPG_CMD = gpg2 | |||
endif | |||
# Selects OpenPGP implementation. must be either `GPG` or `NETPGP` | |||
OPENPGP=GPG | |||
# Path of libGPGME binary | |||
#LIBGPGME This option is platform-specific | |||
# libGPGME library search flag | |||
#GPGME_LIB= This option is platform-specific | |||
# libGPGME include search flag | |||
#GPGME_INC= This option is platform-specific | |||
# NETPGP library search flag | |||
NETPGP_LIB= | |||
#NETPGP_LIB=-L$(PREFIX)/lib | |||
# libGPGME include search flag | |||
NETPGP_INC= | |||
#NETPGP_INC=-I$(PREFIX)/include | |||
######### Engine internals ######### | |||
# C macros (not environment variables) that can be overridden: | |||
# DEFAULT_KEYSERVER - string with default keyserver | |||
# CRASHDUMP_DEFAULT_LINES - number of log lines to deliver for crashdumps | |||
# Example: | |||
# EXTRA_MACROS=-DDEFAULT_KEYSERVER=\"default-server.org\" -DCRASHDUMP_DEFAULT_LINES=23 | |||
EXTRA_MACROS= | |||
######### Misc ######### | |||
# FIXME Maybe include these variables here. Check how they are used throughout the project before setting them here | |||
#LLDB_BIN |
@ -1,26 +1,22 @@ | |||
# Copyright 2017, pEp Foundation | |||
# This file is part of pEpEngine | |||
# This file may be used under the terms of the GNU General Public License version 3 | |||
# This file is under GNU General Public License 3.0 | |||
# see LICENSE.txt | |||
include ../Makefile.conf | |||
.PHONY: db | |||
db: system.db | |||
DICOS = $(wildcard *.csv) | |||
dicos=$(wildcard *.csv) | |||
# The 'mv' keeps a backup db around | |||
system.db: create_system_db.sql $(DICOS) | |||
system.db: create_system_db.sql $(dicos) | |||
-mv -f $@ $@~ | |||
sqlite3 -batch $@ < $< | |||
for c in $(DICOS) ; do echo "$$c" ; echo .import "$$c" wordlist | sqlite3 -batch -csv $@ ; done | |||
for c in $(dicos); do echo $$c ; echo .import "$$c" wordlist | sqlite3 -batch -csv $@ ; done | |||
.PHONY: clean install | |||
.PHONY: install | |||
install: system.db | |||
mkdir -p `dirname $(SYSTEM_DB)` | |||
cp system.db $(SYSTEM_DB) | |||
.PHONY: clean | |||
clean: | |||
rm -f system.db system.db~ | |||
rm -f system.db |
@ -1,38 +1,35 @@ | |||
# Copyright 2017, pEp Foundation | |||
# This file is part of pEpEngine | |||
# This file may be used under the terms of the GNU General Public License version 3 | |||
# This file is under GNU General Public License 3.0 | |||
# see LICENSE.txt | |||
include ../Makefile.conf | |||
.PHONY: all | |||
all: .codegen | |||
# Currently not in use, kept for historic reasons | |||
skeleton: .actions | |||
.codegen: .statemachines .actions | |||
cp -f generated/*.* ../src | |||
touch $@ | |||
touch .codegen | |||
.actions: devicegroup.fsm gen_actions.ysl2 fsm.yml2 functions.ysl2 | |||
$(YML2_PROC) $(YML2_OPTS) -y gen_actions.ysl2 $< -o $@ | |||
$(YML2PROC) $(YML_OPTS) -y gen_actions.ysl2 $< -o $@ | |||
.statemachines: devicegroup.fsm gen_statemachine.ysl2 fsm.yml2 functions.ysl2 | |||
$(YML2_PROC) $(YML2_OPTS) -y gen_statemachine.ysl2 $< -o $@ | |||
$(YML2PROC) $(YML_OPTS) -y gen_statemachine.ysl2 $< -o $@ | |||
.PHONY: clean | |||
clean: | |||
rm -f *.xml *.xsl *.dot *.svg \ | |||
$(patsubst generated/%,../src/%,$(wildcard generated/*.*)) \ | |||
../generated/* ../skeletons/* .statemachines .actions .codegen \ | |||
generated/Makefile.protocols | |||
rm -f *.xml *.xsl \ | |||
$(pathsub generated/%, ../src/% $(wildcard generated/*.*)) \ | |||
../generated/* ../skeletons/* .statemachines .actions *.dot *.svg | |||
%.xml: %.fsm | |||
$(YML2_PATH)/yml2c $< -o $@ | |||
yml2c $< -o $@ | |||
%.dot: gen_dot.ysl2 devicegroup.fsm | |||
$(YML2_PROC) $(YML2_OPTS) -y $^ | |||
%.dot: devicegroup.fsm gen_dot.ysl2 | |||
$(YML2PROC) $(YML_OPTS) -y gen_dot.ysl2 $< | |||
%.svg: %.dot | |||
dot -Tsvg -o $@ $< |