-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.mk
More file actions
84 lines (66 loc) · 2.1 KB
/
config.mk
File metadata and controls
84 lines (66 loc) · 2.1 KB
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
# ===========================================================================
# Generic configuration options for building the xchange library (both static
# and shared).
#
# You can include this snipplet in your Makefile also.
# ============================================================================
# Folders for compiled objects, libraries, and binaries, respectively
OBJ ?= obj
BIN ?= bin
# Compiler: use gcc by default
CC ?= gcc
# Base compiler options (if not defined externally...)
CFLAGS ?= -g -Os -Wall
# Compile for specific C standard
ifdef CSTANDARD
CFLAGS += -std=$(CSTANDARD)
endif
# Extra warnings (not supported on all compilers)
ifeq ($(WEXTRA), 1)
CFLAGS += -Wextra
endif
# Add source code fortification checks
ifdef FORTIFY
CFLAGS += -D_FORTIFY_SOURCE=$(FORTIFY)
endif
# Extra linker flags to use
#LDFLAGS =
# cppcheck options for 'check' target
CHECKOPTS ?= --enable=performance,warning,portability,style --language=c \
--error-exitcode=1 --inline-suppr --std=c99 $(CHECKEXTRA)
# Exhaustive checking for newer cppcheck
#CHECKOPTS += --check-level=exhaustive
# Specific Doxygen to use if not the default one
#DOXYGEN ?= /opt/bin/doxygen
# ============================================================================
# END of user config section.
#
# Below are some generated constants based on the one that were set above
# ============================================================================
# Build static or shared libs
ifeq ($(STATICLINK),1)
LIBXCHANGE = $(LIB)/libxchange.a
else
LIBXCHANGE = $(LIB)/libxchange.so
endif
# By default determine the build platform (OS type)
PLATFORM ?= $(shell uname -s)
# Platform-specific configurations
ifeq ($(PLATFORM),Darwin)
# macOS specific
SOEXT := dylib
SHARED_FLAGS := -dynamiclib -fPIC
SONAME_FLAG := -Wl,-install_name,@rpath/
LIB_PATH_VAR := DYLD_LIBRARY_PATH
else
# Linux/Unix specific
SOEXT := so
SHARED_FLAGS := -shared -fPIC
SONAME_FLAG := -Wl,-soname,
LIB_PATH_VAR := LD_LIBRARY_PATH
endif
# Search for files in the designated locations
vpath %.h $(INC)
vpath %.c $(SRC)
vpath %.o $(OBJ)
vpath %.d dep