forked from enigma-dev/enigma-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Config.mk
executable file
·95 lines (84 loc) · 2.28 KB
/
Config.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
GCCVER := $(shell gcc -dumpversion | cut -c 1)
# Define current OS, while treating MidnightBSD as FreeBSD
ifeq ($(shell uname -s), MidnightBSD)
OS := FreeBSD
else
OS := $(shell uname -s)
endif
# Determine whether Unix-based
ifeq ($(OS), Darwin)
UNIX_BASED := true
else ifeq ($(OS), Linux)
UNIX_BASED := true
else ifeq ($(OS), FreeBSD)
UNIX_BASED := true
else ifeq ($(OS), DragonFly)
UNIX_BASED := true
else ifeq ($(OS), OpenBSD)
UNIX_BASED := true
else
UNIX_BASED := false
endif
ifeq ($(UNIX_BASED), true)
ARCH := $(shell uname -m)
SUFFIX := -$(OS)-$(ARCH)
else
ARCH := $(shell gcc -dumpmachine | sed 's/-w.*//')
SUFFIX := -Windows-$(ARCH)
endif
# Determine current platform
ifeq ($(OS), Darwin)
PLATFORM := Cocoa
MKDIR := mkdir
LIB_PFX := lib
LIB_EXT := $(SUFFIX).dylib
BIN_EXT := $(SUFFIX)
else ifeq ($(UNIX_BASED), true)
PLATFORM := xlib
MKDIR := mkdir
LIB_PFX := lib
LIB_EXT := $(SUFFIX).so
BIN_EXT := $(SUFFIX)
else
PLATFORM := Win32
MKDIR := mkdir.exe
LIB_PFX := lib
LIB_EXT := $(SUFFIX).dll
BIN_EXT := $(SUFFIX).exe
endif
# Global g++ flags
CXXFLAGS := -std=c++17 -Wall -Wextra -Wpedantic -g -I.
LDFLAGS := -g
# MacPorts include and lib folders
ifeq ($(OS), Darwin)
CXXFLAGS += -I/opt/local/include -I/usr/local/include -I/opt/homebrew/include
CFLAGS += -I/opt/local/include -I/usr/local/include -I/opt/homebrew/include
LDFLAGS += -L/opt/local/lib -L/usr/local/lib -L/opt/homebrew/lib
LDFLIBS += -L/opt/local/lib -L/usr/local/lib -L/opt/homebrew/lib
endif
# FreeBSD include and lib folders
ifeq ($(OS), FreeBSD)
CXXFLAGS += -I/usr/local/include
CFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib
LDFLIBS += -L/usr/local/lib
endif
# DragonFlyBSD include and lib folders
ifeq ($(OS), DragonFly)
CXXFLAGS += -I/usr/local/include
CFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib
LDFLIBS += -L/usr/local/lib
endif
# OpenBSD include and lib folders
ifeq ($(OS), OpenBSD)
CXXFLAGS += -I/usr/local/include
CFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib
LDFLIBS += -L/usr/local/lib
endif
# These will be relative to the file that includes this Makefile
SRC_DIR := .
OBJ_DIR := .eobjs
# This implements a recursive wildcard allowing us to iterate in subdirs
rwildcard=$(wildcard $1/$2) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2))