2019-12-09 11:57:37 +00:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# pull in common atmosphere configuration
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../common.mk
|
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# pull in switch rules
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
ifeq ($(strip $(DEVKITPRO)),)
|
|
|
|
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
|
|
|
|
endif
|
|
|
|
|
|
|
|
include $(DEVKITPRO)/libnx/switch_rules
|
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
endif
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# options for code generation
|
|
|
|
#---------------------------------------------------------------------------------
|
2022-03-06 20:08:20 +00:00
|
|
|
ifeq ($(ATMOSPHERE_BUILD_FOR_DEBUGGING),1)
|
|
|
|
ATMOSPHERE_OPTIMIZATION_FLAG := -Os
|
|
|
|
else
|
|
|
|
ATMOSPHERE_OPTIMIZATION_FLAG := -O2
|
|
|
|
endif
|
|
|
|
|
2020-03-29 22:43:16 +01:00
|
|
|
export DEFINES = $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_STRATOSPHERE -D_GNU_SOURCE
|
2022-03-06 20:08:20 +00:00
|
|
|
export SETTINGS = $(ATMOSPHERE_SETTINGS) $(ATMOSPHERE_OPTIMIZATION_FLAG) -Wextra -Werror -Wno-missing-field-initializers
|
2020-03-08 09:39:16 +00:00
|
|
|
export CFLAGS = $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
|
|
|
export CXXFLAGS = $(CFLAGS) $(ATMOSPHERE_CXXFLAGS)
|
|
|
|
export ASFLAGS = $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES)
|
2019-12-09 11:57:37 +00:00
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
2021-10-08 01:44:54 +01:00
|
|
|
export CXXREQUIRED := -Wl,--require-defined,__libnx_initheap \
|
|
|
|
-Wl,--require-defined,__libnx_exception_handler \
|
|
|
|
-Wl,--require-defined,__libnx_alloc \
|
|
|
|
-Wl,--require-defined,__libnx_aligned_alloc \
|
|
|
|
-Wl,--require-defined,__libnx_free \
|
|
|
|
-Wl,--require-defined,__appInit \
|
|
|
|
-Wl,--require-defined,__appExit \
|
|
|
|
-Wl,--require-defined,argvSetup
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
export CXXWRAPS := -Wl,--wrap,__cxa_pure_virtual \
|
|
|
|
-Wl,--wrap,__cxa_throw \
|
|
|
|
-Wl,--wrap,__cxa_rethrow \
|
|
|
|
-Wl,--wrap,__cxa_allocate_exception \
|
|
|
|
-Wl,--wrap,__cxa_free_exception \
|
|
|
|
-Wl,--wrap,__cxa_begin_catch \
|
|
|
|
-Wl,--wrap,__cxa_end_catch \
|
|
|
|
-Wl,--wrap,__cxa_call_unexpected \
|
|
|
|
-Wl,--wrap,__cxa_call_terminate \
|
|
|
|
-Wl,--wrap,__gxx_personality_v0 \
|
|
|
|
-Wl,--wrap,_Unwind_Resume \
|
|
|
|
-Wl,--wrap,_ZSt19__throw_logic_errorPKc \
|
|
|
|
-Wl,--wrap,_ZSt20__throw_length_errorPKc \
|
2021-05-02 18:33:15 +01:00
|
|
|
-Wl,--wrap,_ZNSt11logic_errorC2EPKc \
|
|
|
|
-Wl,--wrap,exit
|
2022-03-06 20:08:20 +00:00
|
|
|
else ifeq ($(ATMOSPHERE_BOARD),generic_windows)
|
|
|
|
export CXXREQUIRED :=
|
|
|
|
export CXXWRAPS := -Wl,--wrap,__p__acmdln
|
|
|
|
else
|
|
|
|
export CXXREQUIRED :=
|
|
|
|
export CXXWRAPS :=
|
|
|
|
endif
|
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
2021-10-08 01:44:54 +01:00
|
|
|
export LDFLAGS = -specs=$(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere/stratosphere.specs -specs=$(DEVKITPRO)/libnx/switch.specs $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $*.map)
|
2022-03-06 20:08:20 +00:00
|
|
|
else ifeq ($(ATMOSPHERE_BOARD),generic_macos)
|
|
|
|
export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-map,$(notdir $@.map)
|
|
|
|
else
|
|
|
|
export LDFLAGS = $(CXXFLAGS) $(CXXWRAPS) $(CXXREQUIRED) -Wl,-Map,$(notdir $*.map)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(ATMOSPHERE_COMPILER_NAME),clang)
|
|
|
|
export LDFLAGS += -fuse-ld=lld
|
|
|
|
endif
|
2019-12-09 11:57:37 +00:00
|
|
|
|
2022-03-06 20:08:20 +00:00
|
|
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
|
|
|
export LIBS := -lstratosphere -lnx
|
|
|
|
else ifeq ($(ATMOSPHERE_BOARD),generic_windows)
|
|
|
|
export LIBS := -lstratosphere -lwinmm -lws2_32
|
|
|
|
else ifeq ($(ATMOSPHERE_BOARD),generic_linux)
|
|
|
|
export LIBS := -lstratosphere -pthread
|
|
|
|
else ifeq ($(ATMOSPHERE_BOARD),generic_macos)
|
|
|
|
export LIBS := -lstratosphere -pthread
|
|
|
|
else
|
|
|
|
export LIBS := -lstratosphere
|
|
|
|
endif
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# list of directories containing libraries, this must be the top level containing
|
|
|
|
# include and lib
|
|
|
|
#---------------------------------------------------------------------------------
|
2022-03-06 20:08:20 +00:00
|
|
|
ifeq ($(ATMOSPHERE_BOARD),nx-hac-001)
|
|
|
|
export LIBDIRS = $(PORTLIBS) $(LIBNX)
|
|
|
|
else
|
|
|
|
export LIBDIRS =
|
|
|
|
endif
|
|
|
|
|
|
|
|
export AMS_LIBDIRS = $(ATMOSPHERE_LIBRARIES_DIR)/libvapours $(ATMOSPHERE_LIBRARIES_DIR)/libstratosphere
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# stratosphere sysmodules may (but usually do not) have an exefs source dir
|
|
|
|
#---------------------------------------------------------------------------------
|
2020-03-08 09:39:16 +00:00
|
|
|
export EXEFS_SRC = exefs_src
|