You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.1 KiB
Makefile

# Copyright 2023, pEp Foundation
# This file is part of pEpTransportMail
# This file may be used under the terms of the GNU General Public License version 3
# see LICENSE.txt
HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
LIBNAME=pEpTransportMail
LIBNAME_UNIX=lib$(LIBNAME)
LIB_STATIC=$(LIBNAME_UNIX).a
BUILD_ON:=$(shell uname)
ifeq ($(BUILD_ON),Darwin)
LIB_DYN=$(LIBNAME_UNIX).dylib
else
LIB_DYN=$(LIBNAME_UNIX).so
endif
TARGETS=$(LIB_DYN) $(LIB_STATIC)
# Build config
# Defaults
DEBUG=1
PREFIX?=$(HOME)
SYS_PREFIX=/usr
CXXFLAGS+=-std=c++17 -fPIC
OPENSSL_INCLUDE=/opt/local/include
OPENSSL_LIB=/opt/local/libexec/openssl3/lib
# Overrides
-include $(HERE)local.conf
# Constants
CXXFLAGS+=-I$(PREFIX)/include
LDFLAGS+=-L$(PREFIX)/lib
CXXFLAGS+=-I$(SYS_PREFIX)/include -I$(OPENSSL_INCLUDE)
LDFLAGS+=-L$(SYS_PREFIX)/lib -L$(OPENSSL_LIB)
# Probably needs a way to add this automatically?
ifneq (,$(findstring g++,$(CXX)))
CXXFLAGS+=-fdiagnostics-color=always
else ifneq (,$(findstring clang,$(CXX)))
CXXFLAGS+=-fcolor-diagnostics
endif
ifeq ($(DEBUG),1)
CXXFLAGS+=-g -O0
else
CXXFLAGS+=-DNDEBUG=1 -O3
endif