55 lines
1.1 KiB
Makefile
55 lines
1.1 KiB
Makefile
# Copyright 2022, pEp Foundation
|
|
# This file is part of pEpTransportUDP
|
|
# 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=pEpTransportUDP
|
|
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
|
|
CFLAGS+=-std=c17 -fPIC
|
|
|
|
# Overrides
|
|
-include $(HERE)local.conf
|
|
|
|
# Constants
|
|
CFLAGS+=-I$(PREFIX)/include
|
|
CFLAGS+=-I$(SYS_PREFIX)/include
|
|
CFLAGS+=-fPIC -pthread -DSQLITE_THREADSAFE=1
|
|
LDFLAGS+=-L$(PREFIX)/lib
|
|
LDFLAGS+=-L$(SYS_PREFIX)/lib
|
|
|
|
CXXFLAGS+=-std=c++11 -fPIC
|
|
CXXFLAGS+=-Wall -pedantic-errors -Wno-unused-parameter -Wno-reorder-ctor
|
|
CXXFLAGS+=-isystem $(PREFIX)/include
|
|
|
|
ifneq (,$(findstring g++,$(CC)))
|
|
CFLAGS+=-fdiagnostics-color=always
|
|
else ifneq (,$(findstring clang,$(CC)))
|
|
CFLAGS+=-fcolor-diagnostics
|
|
endif
|
|
|
|
ifeq ($(DEBUG),1)
|
|
CXXFLAGS+=-g -O0
|
|
CFLAGS+=-g -O0
|
|
else
|
|
CXXFLAGS+=-DNDEBUG=1 -O3
|
|
CFLAGS+=-DNDEBUG=1 -O3
|
|
endif
|