-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefileOSVersion
44 lines (41 loc) · 1.11 KB
/
MakefileOSVersion
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
LIBRH = RH5
LIBRH_X64 = RH5_X64
LIBSuSE = SuSE
ARCH_SUFFIX = _X64
LIBUB = Ubuntu
LIBUB_X64 = Ubuntu_X64
###############################################################################
# Determine operating system and architecture (32/64 bit) #
###############################################################################
OS:=$(shell lsb_release -si)
ARCH := $(shell uname -m | sed 's/i.86/i386/')
SuSE_VERSION := $(wildcard /etc/SuSE-release)
Ububtu_VERSION := $(wildcard /etc/lsb-release)
# Check if SuSE
ifneq ($(strip $(SuSE_VERSION)),)
SUSE_NUMBER_VERSION := $(shell cat /etc/SuSE-release | awk '/VERSION = / {print $$3}')
ifeq ($(ARCH),x86_64)
OS_VERSION = $(LIBSuSE)$(SUSE_NUMBER_VERSION)$(ARCH_SUFFIX)
else
OS_VERSION = $(LIBSuSE)$(SUSE_NUMBER_VERSION)
endif
else # Check if Ubuntu
ifeq ($(OS),Ubuntu)
ifeq ($(ARCH),x86_64)
# X64 version
OS_VERSION = $(LIBUB_X64)
else
# X32 version
OS_VERSION = $(LIBUB)
endif
else
# RedHat 5 Version
ifeq ($(ARCH),x86_64)
# X64 version
OS_VERSION = $(LIBRH_X64)
else
# X32 version
OS_VERSION = $(LIBRH)
endif
endif
endif