Framework.mk: Rename OS to OS_FSFW #115

Closed
opened 2020-06-19 14:40:26 +02:00 by muellerr · 0 comments
Owner

The OS variable oftentimes is a system variable which can be used in the main Makefile to
determine the OS (works for Windows and Linux for example). This is useful for a generic host OS as long as GNU make is used instead of CMake.

Example from host makefile :

# Copied from stackoverflow, can be used to differentiate between Windows
# and Linux
CUSTOM_DEFINES :=
ifeq ($(OS),Windows_NT)
    CUSTOM_DEFINES += -DWIN32
    ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
        CUSTOM_DEFINES += -DAMD64
    else
        ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
            CUSTOM_DEFINES += -DAMD64
        endif
        ifeq ($(PROCESSOR_ARCHITECTURE),x86)
            CUSTOM_DEFINES += -DIA32
        endif
    endif
else
    UNAME_S := $(shell uname -s)
    ifeq ($(UNAME_S),Linux)
        CUSTOM_DEFINES += -DLINUX
    endif
    ifeq ($(UNAME_S),Darwin)
        CUSTOM_DEFINES += -DOSX
    endif
    UNAME_P := $(shell uname -p)
    ifeq ($(UNAME_P),x86_64)
        CUSTOM_DEFINES += -DAMD64
    endif
    ifneq ($(filter %86,$(UNAME_P)),)
        CUSTOM_DEFINES += -DIA32
    endif
    ifneq ($(filter arm%,$(UNAME_P)),)
        CUSTOM_DEFINES += -DARM
    endif
endif

Therefore, I suggest that the variable passed to the submakefile should be changed to OS_FSFW.

The OS variable oftentimes is a system variable which can be used in the main Makefile to determine the OS (works for Windows and Linux for example). This is useful for a generic host OS as long as GNU make is used instead of CMake. Example from host makefile : ```cpp # Copied from stackoverflow, can be used to differentiate between Windows # and Linux CUSTOM_DEFINES := ifeq ($(OS),Windows_NT) CUSTOM_DEFINES += -DWIN32 ifeq ($(PROCESSOR_ARCHITEW6432),AMD64) CUSTOM_DEFINES += -DAMD64 else ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) CUSTOM_DEFINES += -DAMD64 endif ifeq ($(PROCESSOR_ARCHITECTURE),x86) CUSTOM_DEFINES += -DIA32 endif endif else UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Linux) CUSTOM_DEFINES += -DLINUX endif ifeq ($(UNAME_S),Darwin) CUSTOM_DEFINES += -DOSX endif UNAME_P := $(shell uname -p) ifeq ($(UNAME_P),x86_64) CUSTOM_DEFINES += -DAMD64 endif ifneq ($(filter %86,$(UNAME_P)),) CUSTOM_DEFINES += -DIA32 endif ifneq ($(filter arm%,$(UNAME_P)),) CUSTOM_DEFINES += -DARM endif endif ``` Therefore, I suggest that the variable passed to the submakefile should be changed to OS_FSFW.
muellerr added the
feature
API Change
labels 2020-06-19 14:40:26 +02:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: fsfw/fsfw#115
No description provided.