Created
July 3, 2020 02:29
-
-
Save dipu-bd/9e0e13e8faef277af9c61e25aaff6ea1 to your computer and use it in GitHub Desktop.
OS Detection in Makefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifeq ($(OS),Windows_NT) | |
CCFLAGS += -D WIN32 | |
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64) | |
CCFLAGS += -D AMD64 | |
else | |
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) | |
CCFLAGS += -D AMD64 | |
endif | |
ifeq ($(PROCESSOR_ARCHITECTURE),x86) | |
CCFLAGS += -D IA32 | |
endif | |
endif | |
else | |
UNAME_S := $(shell uname -s) | |
ifeq ($(UNAME_S),Linux) | |
CCFLAGS += -D LINUX | |
endif | |
ifeq ($(UNAME_S),Darwin) | |
CCFLAGS += -D OSX | |
endif | |
UNAME_P := $(shell uname -p) | |
ifeq ($(UNAME_P),x86_64) | |
CCFLAGS += -D AMD64 | |
endif | |
ifneq ($(filter %86,$(UNAME_P)),) | |
CCFLAGS += -D IA32 | |
endif | |
ifneq ($(filter arm%,$(UNAME_P)),) | |
CCFLAGS += -D ARM | |
endif | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment