-
Notifications
You must be signed in to change notification settings - Fork 0
/
linux_gcc_rules.mak
67 lines (61 loc) · 1.6 KB
/
linux_gcc_rules.mak
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
# Copyright (c) 1996-2018, OPC Foundation. All rights reserved.
#
# The source code in this file is covered under a dual-license scenario:
# - RCL: for OPC Foundation members in good-standing
# - GPL V2: everybody else
#
# RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/
#
# GNU General Public License as published by the Free Software Foundation;
# version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2
#
# This source code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Global rules for all GCC builds
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
AR = $(CROSS_COMPILE)ar
STRIP = $(CROSS_COMPILE)strip
MKDIR = mkdir -p
ifndef MACHINE_TYPE
ifndef CROSS_COMPILE
TMP_MACHINE_TYPE = $(shell uname -i)
ifeq ($(TMP_MACHINE_TYPE),x86_64)
MACHINE_TYPE = x86_64
else
ifeq ($(TMP_MACHINE_TYPE),i386)
MACHINE_TYPE = i386
else
ifeq ($(TMP_MACHINE_TYPE),i686)
MACHINE_TYPE = i386
else
MACHINE_TYPE = unknown
endif
endif
endif
else
MACHINE_TYPE = unknown
endif
endif
ifndef MACHINE_OPT
ifndef CROSS_COMPILE
ifeq ($(MACHINE_TYPE),x86_64)
MACHINE_OPT = -m64
else
ifeq ($(MACHINE_TYPE),i386)
MACHINE_OPT = -m32
endif
endif
endif
endif
BIN_PATH = linux/$(MACHINE_TYPE)
ifndef BUILD_TARGET
BUILD_TARGET = release
endif
ifeq ($(findstring debug,$(BUILD_TARGET)),debug)
EXTRA_CFLAGS = -D_DEBUG -g $(MACHINE_OPT)
else
EXTRA_CFLAGS = -O3 $(MACHINE_OPT)
endif