Browse Source

Makefile stuff

async_key_management
vb 7 years ago
parent
commit
d679fa2e81
5 changed files with 33 additions and 20 deletions
  1. +4
    -1
      Makefile.conf
  2. +7
    -7
      src/Makefile
  3. +8
    -5
      src/cryptotech.c
  4. +9
    -2
      src/pgp_gpg.c
  5. +5
    -5
      test/Makefile

+ 4
- 1
Makefile.conf View File

@ -1,7 +1,10 @@
BUILD_ON=$(shell uname)
BUILD_FOR=$(BUILD_ON)
OPTIMIZE=-g -O0
#OPTIMIZE=-O3 -DNDEBUG
#OPTIMIZE=-O3 -DNDEBUG -std=c99
LD=$(CC)
#CC=gcc-mp-4.9 -std=c99 -fstrict-aliasing -Wstrict-aliasing=3
#LD=gcc-mp-4.9
# the next two lines are ignored on Windoze
SYSTEM_DB=/usr/local/share/pEp/system.db
PREFIX=$(HOME)

+ 7
- 7
src/Makefile View File

@ -7,11 +7,11 @@ TARGET=libpEpEngine.dylib
MACOSX_VERSION_MIN=10.6
GPGME_IN=$(HOME)
LIBGPGME=libgpgme-pthread.dylib
CC=clang -std=c99 -pthread
LD=clang
CFLAGS=-I$(GPGME_IN)/include -I/opt/local/include $(OPTIMIZE) -pedantic \
CC?=clang -std=c99 -pthread
LD?=clang
CFLAGS?=-I$(GPGME_IN)/include -I/opt/local/include $(OPTIMIZE) -pedantic \
-DSYSTEM_DB=\"$(SYSTEM_DB)\" -DLIBGPGME=\"$(LIBGPGME)\"
LDFLAGS=-lc -shared -arch x86_64 \
LDFLAGS?=-lc -shared -arch x86_64 \
-L/opt/local/lib -letpan -lgpgme-pthread -lsqlite3
else
@ -24,10 +24,10 @@ ifeq ($(BUILD_FOR),Linux)
TARGET=libpEpEngine.so
GPGME_IN=$(HOME)
LIBGPGME=libgpgme.so.11
CC=gcc -std=c99
CFLAGS=-I$(GPGME_IN)/include $(OPTIMIZE) -fPIC -pedantic \
CC?=gcc -std=c99
CFLAGS?=-I$(GPGME_IN)/include $(OPTIMIZE) -fPIC -pedantic \
-DSYSTEM_DB=\"$(SYSTEM_DB)\" -DLIBGPGME=\"$(LIBGPGME)\" -DSQLITE_THREADSAFE=1
LDFLAGS=-L$(GPGME_IN) -shared -lc -ldl -letpan -lgpgme-pthread -lsqlite3
LDFLAGS?=-L$(GPGME_IN) -shared -lc -ldl -letpan -lgpgme-pthread -lsqlite3
else
$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))


+ 8
- 5
src/cryptotech.c View File

@ -13,7 +13,7 @@
PEP_STATUS init_cryptotech(PEP_SESSION session, bool in_first)
{
static PEP_cryptotech_t cryptotech[PEP_crypt__count];
PEP_STATUS _status;
PEP_STATUS status = PEP_STATUS_OK;
assert(PEP_crypt__count == 2);
@ -42,12 +42,15 @@ PEP_STATUS init_cryptotech(PEP_SESSION session, bool in_first)
session->cryptotech = cryptotech;
_status = pgp_init(session, in_first);
assert(_status == PEP_STATUS_OK);
if (_status != PEP_STATUS_OK)
return _status;
status = pgp_init(session, in_first);
if (status != PEP_STATUS_OK)
goto pep_error;
return PEP_STATUS_OK;
pep_error:
pgp_release(session, in_first);
return status;
}
void release_cryptotech(PEP_SESSION session, bool out_last)


+ 9
- 2
src/pgp_gpg.c View File

@ -56,6 +56,7 @@ static bool ensure_keyserver()
PEP_STATUS pgp_init(PEP_SESSION session, bool in_first)
{
PEP_STATUS status = PEP_STATUS_OK;
static struct gpg_s gpg;
static void *gpgme;
gpgme_error_t gpgme_error;
@ -67,7 +68,8 @@ PEP_STATUS pgp_init(PEP_SESSION session, bool in_first)
gpgme = dlopen(LIBGPGME, RTLD_LAZY);
if (gpgme == NULL) {
return PEP_INIT_CANNOT_LOAD_GPGME;
status = PEP_INIT_CANNOT_LOAD_GPGME;
goto pep_error;
}
memset(&gpg, 0, sizeof(struct gpg_s));
@ -244,7 +246,8 @@ PEP_STATUS pgp_init(PEP_SESSION session, bool in_first)
gpgme_error = gpg.gpgme_new(&session->ctx);
gpgme_error = _GPGERR(gpgme_error);
if (gpgme_error != GPG_ERR_NO_ERROR) {
return PEP_INIT_GPGME_INIT_FAILED;
status = PEP_INIT_GPGME_INIT_FAILED;
goto pep_error;
}
assert(session->ctx);
@ -255,6 +258,10 @@ PEP_STATUS pgp_init(PEP_SESSION session, bool in_first)
gpg.gpgme_set_armor(session->ctx, 1);
return PEP_STATUS_OK;
pep_error:
pgp_release(session, in_first);
return status;
}
void pgp_release(PEP_SESSION session, bool out_last)


+ 5
- 5
test/Makefile View File

@ -1,10 +1,10 @@
include ../Makefile.conf
CC=g++ -std=gnu++11 -pthread
CXX=g++ -std=gnu++11 -pthread
LD=$(CXX)
LDFLAGS=-L$(HOME)/lib -lpEpEngine -lstdc++
CXXFLAGS=-g -O0 -I../src
CC?=g++ -std=gnu++11 -pthread
CXX?=g++ -std=gnu++11 -pthread
LD?=$(CXX)
LDFLAGS?=-L$(HOME)/lib -lpEpEngine -lstdc++
CXXFLAGS?=-g -O0 -I../src
# CXXFLAGS=-O3 -DNDEBUG
TARGET=pEpEngineTest


Loading…
Cancel
Save