2019-12-09 11:57:37 +00:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
.SUFFIXES:
|
|
|
|
#---------------------------------------------------------------------------------
|
2019-12-31 10:46:01 +00:00
|
|
|
DIR_WILDCARD=$(foreach d,$(wildcard $(1:=/*)),$(if $(wildcard $d/.),$(call DIR_WILDCARD,$d) $d,))
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
export ATMOSPHERE_CONFIG_MAKE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
|
|
|
|
export ATMOSPHERE_LIBRARIES_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/..
|
|
|
|
|
|
|
|
ifeq ($(strip $(ATMOSPHERE_BOARD)),)
|
|
|
|
export ATMOSPHERE_BOARD := nx-hac-001
|
|
|
|
|
2019-12-17 08:37:55 +00:00
|
|
|
ifeq ($(strip $(ATMOSPHERE_CPU)),)
|
|
|
|
export ATMOSPHERE_CPU := arm-cortex-a57
|
|
|
|
endif
|
|
|
|
|
2020-05-05 06:33:16 +00:00
|
|
|
endif
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
export ATMOSPHERE_DEFINES := -DATMOSPHERE
|
|
|
|
export ATMOSPHERE_SETTINGS := -fPIE -g
|
2020-06-26 00:32:22 +00:00
|
|
|
export ATMOSPHERE_CFLAGS := -Wall -ffunction-sections -fdata-sections -fno-strict-aliasing -fwrapv \
|
|
|
|
-fno-asynchronous-unwind-tables -fno-unwind-tables -fno-stack-protector \
|
2020-06-30 06:19:33 +00:00
|
|
|
-Wno-format-truncation -Wno-format-zero-length
|
2020-06-26 00:32:22 +00:00
|
|
|
|
2020-05-11 22:02:10 +00:00
|
|
|
export ATMOSPHERE_CXXFLAGS := -fno-rtti -fno-exceptions -std=gnu++20
|
2019-12-09 11:57:37 +00:00
|
|
|
export ATMOSPHERE_ASFLAGS :=
|
|
|
|
|
|
|
|
|
|
|
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
2020-05-05 06:33:16 +00:00
|
|
|
|
|
|
|
ifeq ($(ATMOSPHERE_CPU),arm-cortex-a57)
|
2019-12-09 11:57:37 +00:00
|
|
|
export ATMOSPHERE_ARCH_DIR := arch/arm64
|
2020-02-15 03:58:57 +00:00
|
|
|
export ATMOSPHERE_BOARD_DIR := board/nintendo/nx
|
2019-12-09 11:57:37 +00:00
|
|
|
export ATMOSPHERE_OS_DIR := os/horizon
|
|
|
|
|
|
|
|
export ATMOSPHERE_ARCH_NAME := arm64
|
2020-02-15 03:58:57 +00:00
|
|
|
export ATMOSPHERE_BOARD_NAME := nintendo_nx
|
2019-12-09 11:57:37 +00:00
|
|
|
export ATMOSPHERE_OS_NAME := horizon
|
2020-05-05 06:33:16 +00:00
|
|
|
else ifeq ($(ATMOSPHERE_CPU),arm7tdmi)
|
|
|
|
export ATMOSPHERE_ARCH_DIR := arch/arm
|
|
|
|
export ATMOSPHERE_BOARD_DIR := board/nintendo/nx_bpmp
|
|
|
|
export ATMOSPHERE_OS_DIR := os/horizon
|
|
|
|
|
|
|
|
export ATMOSPHERE_ARCH_NAME := arm
|
|
|
|
export ATMOSPHERE_BOARD_NAME := nintendo_nx
|
|
|
|
export ATMOSPHERE_OS_NAME := horizon
|
|
|
|
endif
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
endif
|
|
|
|
|
2019-12-17 08:37:55 +00:00
|
|
|
ifeq ($(ATMOSPHERE_CPU),arm-cortex-a57)
|
|
|
|
export ATMOSPHERE_CPU_DIR := arch/arm64/cpu/cortex_a57
|
|
|
|
export ATMOSPHERE_CPU_NAME := arm_cortex_a57
|
|
|
|
endif
|
|
|
|
|
2020-05-05 06:33:16 +00:00
|
|
|
ifeq ($(ATMOSPHERE_CPU),arm7tdmi)
|
|
|
|
export ATMOSPHERE_CPU_DIR := arch/arm/cpu/arm7tdmi
|
|
|
|
export ATMOSPHERE_CPU_NAME := arm7tdmi
|
|
|
|
endif
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
export ATMOSPHERE_ARCH_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/$(ATMOSPHERE_ARCH_DIR)
|
|
|
|
export ATMOSPHERE_BOARD_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/$(ATMOSPHERE_BOARD_DIR)
|
|
|
|
export ATMOSPHERE_OS_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/$(ATMOSPHERE_OS_DIR)
|
2019-12-17 08:37:55 +00:00
|
|
|
export ATMOSPHERE_CPU_MAKE_DIR := $(ATMOSPHERE_CONFIG_MAKE_DIR)/$(ATMOSPHERE_CPU_DIR)
|
2019-12-09 11:57:37 +00:00
|
|
|
|
2020-05-05 06:33:16 +00:00
|
|
|
export ATMOSPHERE_LIBRARY_DIR := lib_$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)
|
|
|
|
export ATMOSPHERE_BUILD_DIR := build_$(ATMOSPHERE_BOARD_NAME)_$(ATMOSPHERE_ARCH_NAME)
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
include $(ATMOSPHERE_ARCH_MAKE_DIR)/arch.mk
|
|
|
|
include $(ATMOSPHERE_BOARD_MAKE_DIR)/board.mk
|
|
|
|
include $(ATMOSPHERE_OS_MAKE_DIR)/os.mk
|
2019-12-17 08:37:55 +00:00
|
|
|
include $(ATMOSPHERE_CPU_MAKE_DIR)/cpu.mk
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# get atmosphere git revision information
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
export ATMOSPHERE_GIT_BRANCH := $(shell git symbolic-ref --short HEAD)
|
|
|
|
|
|
|
|
ifeq ($(strip $(shell git status --porcelain 2>/dev/null)),)
|
|
|
|
export ATMOSPHERE_GIT_REVISION := $(ATMOSPHERE_GIT_BRANCH)-$(shell git rev-parse --short HEAD)
|
|
|
|
else
|
|
|
|
export ATMOSPHERE_GIT_REVISION := $(ATMOSPHERE_GIT_BRANCH)-$(shell git rev-parse --short HEAD)-dirty
|
|
|
|
endif
|
|
|
|
|
2020-05-15 09:32:17 +00:00
|
|
|
export ATMOSPHERE_GIT_HASH := $(shell git rev-parse --short=16 HEAD)
|
|
|
|
|
|
|
|
ATMOSPHERE_DEFINES += -DATMOSPHERE_GIT_BRANCH=\"$(ATMOSPHERE_GIT_BRANCH)\" -DATMOSPHERE_GIT_REVISION=\"$(ATMOSPHERE_GIT_REVISION)\" -DATMOSPHERE_GIT_HASH="0x$(ATMOSPHERE_GIT_HASH)"
|
2019-12-09 11:57:37 +00:00
|
|
|
|
2019-12-12 21:38:11 +00:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# Ensure top directory is set.
|
|
|
|
#---------------------------------------------------------------------------------
|
2019-12-13 20:41:19 +00:00
|
|
|
TOPDIR ?= $(CURDIR)
|
2019-12-12 21:38:11 +00:00
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# TARGET is the name of the output
|
|
|
|
# SOURCES is a list of directories containing source code
|
|
|
|
# DATA is a list of directories containing data files
|
|
|
|
# INCLUDES is a list of directories containing header files
|
|
|
|
#---------------------------------------------------------------------------------
|
2019-12-13 20:41:19 +00:00
|
|
|
TARGET := $(notdir $(CURDIR))
|
|
|
|
BUILD := build
|
|
|
|
DATA := data
|
|
|
|
INCLUDES := include
|
2019-12-09 11:57:37 +00:00
|
|
|
|
2020-02-23 14:51:32 +00:00
|
|
|
GENERAL_SOURCE_DIRS=$1 $(foreach d,$(filter-out $1/arch $1/board $1,$(wildcard $1/*)),$(if $(wildcard $d/.),$(call DIR_WILDCARD,$d) $d,))
|
|
|
|
SPECIFIC_SOURCE_DIRS=$(if $(wildcard $1/$2/.*),$1/$2 $(call DIR_WILDCARD,$1/$2),)
|
|
|
|
ALL_SOURCE_DIRS=$(call GENERAL_SOURCE_DIRS,$1) $(call SPECIFIC_SOURCE_DIRS,$1,$(ATMOSPHERE_ARCH_DIR)) $(call SPECIFIC_SOURCE_DIRS,$1,$(ATMOSPHERE_BOARD_DIR)) $(call SPECIFIC_SOURCE_DIRS,$1,$(ATMOSPHERE_OS_DIR))
|
|
|
|
|
|
|
|
SOURCES ?= $(call ALL_SOURCE_DIRS,source)
|
2020-02-19 09:22:51 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# Rules for compiling pre-compiled headers
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
%.gch: %.hpp
|
|
|
|
@echo $<
|
|
|
|
$(CXX) -w -x c++-header -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
|
|
|
|
@cp $@ $(<).gch
|