forked from hundredrabbits/Orca-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.conf
86 lines (72 loc) · 1.86 KB
/
Makefile.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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))