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

86 lines
1.9 KiB

LIBNAME:=orca
LIB:=lib$(LIBNAME).a
C_LANG_VERSION=c99
CXX_LANG_VERSION=c++17
# Build option defaults
PREFIX?=$(HOME)/local
SYS_PREFIX?=/opt/local
DEBUG?=1
PORTMIDI_ENABLED?=1
MOUSE_ENABLED?=1
COMPILE_FLAGS:= -MMD
CFLAGS:=-std=$(C_LANG_VERSION)
CFLAGS+=\
-finput-charset=UTF-8 \
-Wpedantic \
-Wextra \
-Wwrite-strings \
-Wconversion \
-Wshadow \
# -Wstrict-prototypes \
# -Werror=implicit-function-declaration \
-Werror=implicit-int \
-Werror=incompatible-pointer-types \
-Werror=int-conversion \
-Wno-missing-field-initializers \
-DORCA_OS_MAC \
-D_XOPEN_SOURCE_EXTENDED=1 \
-march=nehalem \
CXXFLAGS:=-std=$(CXX_LANG_VERSION)
CXXFLAGS+=\
-fPIC \
-Wall \
-Wextra \
-pedantic
ifneq (,$(findstring g++,$(CXX)))
COMPILE_FLAGS+=-fdiagnostics-color=always
else ifneq (,$(findstring clang,$(CXX)))
COMPILE_FLAGS+=-fcolor-diagnostics
endif
LIBS:=-lstdc++ -lpEpCxx11
# ncurses
LDFLAGS_NCURSES=$(shell pkg-config --libs ncursesw formw)
LDFLAGS+=$(LDFLAGS_NCURSES)
LDFLAGS+=$(LIBS)
######### Overrides from build.conf #########
HERE:=$(dir $(lastword $(MAKEFILE_LIST)))
-include $(HERE)build.conf
COMPILE_FLAGS+=-isystem$(SYS_PREFIX)/include
COMPILE_FLAGS+=-I$(PREFIX)/include
LDFLAGS+=-L$(SYS_PREFIX)/lib
LDFLAGS+=-L$(PREFIX)/lib
ifeq ($(DEBUG),1)
COMPILE_FLAGS+=-g -O0 -DDEBUG
# -fsanitize=address \
# -fsanitize=undefined \
# -fsanitize=float-divide-by-zero \
# -fsanitize=implicit-conversion \
# -fsanitize=unsigned-integer-overflow
else
COMPILE_FLAGS+=-DNDEBUG -O2 -g0
endif
ifeq ($(PORTMIDI_ENABLED),1)
COMPILE_FLAGS+= -DFEAT_PORTMIDI
LDFLAGS+= -lportmidi
endif
ifeq ($(MOUSE_ENABLED),0)
COMPILE_FLAGS+=-DFEAT_NOMOUSE
endif
CXXFLAGS+=$(COMPILE_FLAGS)
CFLAGS+=$(COMPILE_FLAGS)
$(info C-Compiler: $(shell $(CC) --version))
$(info C++-Compiler: $(shell $(CXX) --version))