-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathMakerules
102 lines (89 loc) · 2.14 KB
/
Makerules
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
96
97
98
99
100
101
102
#
# Makerules
#
# Pays attention to the following variables:
# DEBUG = y - debugging compiler flags
# UNAME = xxxxx - cross-compile for the given platform
# (In particular, you can say UNAME = Win32 if mingw
# is installed to cross-compile for Windows, or
# UNAME = Linux to get 32-bit binaries on Linux x64)
# If UNAME undefined on input, gets defined here.
# DESTDIR = xxxx - Place to put output binaries.
# MAKERULESDIR - Where to find Makerules and Makedefs
#
#
# Defines the following variables:
# UNAME - destination system type (if not set by user)
# OBJDIR - directory for object files
# CC - C compiler
# CXX - C++ compiler
# CFLAGS - C compiler flags
# CXXFLAGS - C++ compiler flags
# LDFLAGS - Linker flags
# LIBS - Libraries
# GLLIBS - OpenGL libraries
# EXE - Extension of executables (.exe under Win32)
# LINK - The entire linking process
# STATICLIB - Create .a archive
# SHAREDLIB - Create .so archive
#
#
# Client Makefiles need to define a "default:" rule
# - SMR
#
#
# Define UNAME
#
ifdef windir
UNAME := Win32
else
UNAME := $(shell uname)
UNAME := $(patsubst CYGWIN%,Win32,$(UNAME))
UNAME := $(patsubst MINGW%,Win32,$(UNAME))
ifeq ($(UNAME),Linux)
ARCH := $(shell uname -m)
ifeq ($(ARCH),x86_64)
UNAME := Linux64
endif
ifeq ($(ARCH),aarch64)
UNAME := Linux64
endif
endif
ifeq ($(UNAME),Darwin)
IS64 := $(shell sysctl -n hw.cpu64bit_capable)
ifeq ($(IS64),1)
UNAME := Darwin64
endif
endif
endif
#
# Other variable definitions
#
OBJDIR ?= OBJ.$(UNAME)
DESTDIR ?= .
ifndef MAKERULESDIR
MAKERULESDIR := $(subst /,,$(dir $(lastword $(MAKEFILE_LIST))))
endif
#
# Rules
#
all: $(OBJDIR) $(DESTDIR) default
$(OBJDIR) $(DESTDIR):
-mkdir $@
debug:
$(MAKE) DEBUG=y
win32:
$(MAKE) UNAME=Win32
linux32:
$(MAKE) UNAME=Linux
linux64:
$(MAKE) UNAME=Linux64
darwin32:
$(MAKE) UNAME=Darwin
darwin64:
$(MAKE) UNAME=Darwin64
.PHONY: all default clean debug win32 linux32 linux64 darwin32 darwin64
#
# Makedefs
#
include $(MAKERULESDIR)/Makedefs.$(UNAME)