-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.mk
80 lines (62 loc) · 1.64 KB
/
Makefile.mk
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
#!/usr/bin/make -f
# Makefile for fadeswitch.lv2 #
# ----------------------- #
# Created by falkTX
#
AR ?= ar
CC ?= gcc
CXX ?= g++
# --------------------------------------------------------------
# Fallback to Linux if no other OS defined
ifneq ($(MACOS),true)
ifneq ($(WIN32),true)
LINUX=true
endif
endif
# --------------------------------------------------------------
# Set build and link flags
BASE_FLAGS = -Wall -Wextra -pipe -Wno-unused-parameter
BASE_OPTS = -O3 -ffast-math
ifeq ($(MACOS),true)
# MacOS linker flags
LINK_OPTS = -Wl,-dead_strip -Wl,-dead_strip_dylibs
else
# Common linker flags
LINK_OPTS = -Wl,-O1 -Wl,--as-needed -Wl,--strip-all
endif
ifneq ($(WIN32),true)
# not needed for Windows
BASE_FLAGS += -fPIC -DPIC
endif
ifeq ($(DEBUG),true)
BASE_FLAGS += -DDEBUG -O0 -g
LINK_OPTS =
else
BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden
CXXFLAGS += -fvisibility-inlines-hidden
endif
BUILD_C_FLAGS = $(BASE_FLAGS) -std=c99 -std=gnu99 $(CFLAGS)
BUILD_CXX_FLAGS = $(BASE_FLAGS) -std=c++11 $(CXXFLAGS) $(CPPFLAGS)
ifeq ($(MACOS),true)
# 'no-undefined' is always enabled on MacOS
LINK_FLAGS = $(LINK_OPTS) $(LDFLAGS)
else
# add 'no-undefined'
LINK_FLAGS = $(LINK_OPTS) -Wl,--no-undefined $(LDFLAGS)
endif
# --------------------------------------------------------------
# Set shared lib extension
LIB_EXT = .so
ifeq ($(MACOS),true)
LIB_EXT = .dylib
endif
ifeq ($(WIN32),true)
LIB_EXT = .dll
endif
# --------------------------------------------------------------
# Set shared library CLI arg
SHARED = -shared
ifeq ($(MACOS),true)
SHARED = -dynamiclib
endif
# --------------------------------------------------------------