forked from PoC-Consortium/engraver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathosdetect.mk
41 lines (38 loc) · 801 Bytes
/
osdetect.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
# http://stackoverflow.com/questions/714100/os-detecting-makefile
# http://blogs.msdn.com/b/david.wang/archive/2006/03/26/howto-detect-process-bitness.aspx
ifeq ($(OS),Windows_NT)
OSFLAGS += -D WIN32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
OS=Windows
OSFLAGS += -D AMD64
OS_64BIT=1
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
OSFLAGS += -D IA32
OS_32BIT=1
endif
else
UNAME_S := $(shell uname -s)
ARCH=
ifeq ($(UNAME_S),Linux)
OS=Linux
OSFLAGS += -D LINUX
ARCH=$(shell uname -p)
endif
ifeq ($(UNAME_S),Darwin)
OS=Mac
OSFLAGS += -D OSX
ARCH=$(shell uname -m)
endif
ifeq ($(ARCH),x86_64)
OSFLAGS += -D AMD64
OS_64BIT=1
endif
ifneq ($(filter %86,$(ARCH)),)
OSFLAGS += -D IA32
OS_32BIT=1
endif
ifneq ($(filter arm%,$(ARCH)),)
OSFLAGS += -D ARM
endif
endif