2019-12-09 11:57:37 +00:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# pull in common atmosphere configuration
|
|
|
|
#---------------------------------------------------------------------------------
|
2020-10-27 20:55:19 +00:00
|
|
|
THIS_MAKEFILE := $(abspath $(lastword $(MAKEFILE_LIST)))
|
|
|
|
CURRENT_DIRECTORY := $(abspath $(dir $(THIS_MAKEFILE)))
|
|
|
|
include $(CURRENT_DIRECTORY)/../config/common.mk
|
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
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# options for code generation
|
|
|
|
#---------------------------------------------------------------------------------
|
2020-10-27 20:55:19 +00:00
|
|
|
PRECOMPILED_HEADERS := $(CURRENT_DIRECTORY)/include/stratosphere.hpp
|
2021-01-17 15:55:32 +00:00
|
|
|
#PRECOMPILED_HEADERS :=
|
2020-05-11 23:02:10 +01:00
|
|
|
|
2020-03-29 22:43:16 +01:00
|
|
|
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_STRATOSPHERE -D_GNU_SOURCE
|
2019-12-09 11:57:37 +00:00
|
|
|
SETTINGS := $(ATMOSPHERE_SETTINGS) -O2
|
|
|
|
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
|
|
|
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -flto
|
|
|
|
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS)
|
|
|
|
|
|
|
|
LDFLAGS := -specs=$(DEVKITPRO)/libnx/switch.specs $(SETTINGS) -Wl,-Map,$(notdir $*.map)
|
|
|
|
|
2020-02-23 14:51:32 +00:00
|
|
|
SOURCES += $(call ALL_SOURCE_DIRS,../libvapours/source)
|
2020-08-15 17:20:11 +01:00
|
|
|
SOURCES += $(call UNFILTERED_SOURCE_DIRS,source/os)
|
2020-02-23 14:51:32 +00:00
|
|
|
|
2019-12-09 11:57:37 +00:00
|
|
|
LIBS := -lnx
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# list of directories containing libraries, this must be the top level containing
|
|
|
|
# include and lib
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
LIBDIRS := $(PORTLIBS) $(LIBNX) $(ATMOSPHERE_LIBRARIES_DIR)/libvapours
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# no real need to edit anything past this point unless you need to add additional
|
|
|
|
# rules for different file extensions
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
|
2020-05-11 23:02:10 +01:00
|
|
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) $(CURDIR)/include \
|
2019-12-09 11:57:37 +00:00
|
|
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
|
|
|
2020-08-11 19:22:56 +01:00
|
|
|
CFILES := $(call FIND_SOURCE_FILES,$(SOURCES),c)
|
|
|
|
CPPFILES := $(call FIND_SOURCE_FILES,$(SOURCES),cpp)
|
|
|
|
SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# use CXX for linking C++ projects, CC for standard C
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
ifeq ($(strip $(CPPFILES)),)
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
export LD := $(CC)
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
else
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
export LD := $(CXX)
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
endif
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
|
|
|
|
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
|
2020-10-27 20:55:19 +00:00
|
|
|
export GCH_FILES := $(PRECOMPILED_HEADERS:.hpp=.hpp.gch)
|
2019-12-09 11:57:37 +00:00
|
|
|
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
|
2019-12-17 22:16:08 +00:00
|
|
|
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
|
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
|
|
|
-I.
|
|
|
|
|
|
|
|
.PHONY: clean all
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
all: lib/$(TARGET).a
|
|
|
|
|
|
|
|
lib:
|
|
|
|
@[ -d $@ ] || mkdir -p $@
|
|
|
|
|
|
|
|
release:
|
|
|
|
@[ -d $@ ] || mkdir -p $@
|
|
|
|
|
|
|
|
lib/$(TARGET).a : lib release $(SOURCES) $(INCLUDES)
|
|
|
|
@$(MAKE) BUILD=release OUTPUT=$(CURDIR)/$@ \
|
|
|
|
BUILD_CFLAGS="-DNDEBUG=1 -O2" \
|
|
|
|
DEPSDIR=$(CURDIR)/release \
|
|
|
|
--no-print-directory -C release \
|
|
|
|
-f $(CURDIR)/Makefile
|
|
|
|
|
|
|
|
dist-bin: all
|
|
|
|
@tar --exclude=*~ -cjf $(TARGET).tar.bz2 include lib
|
|
|
|
|
|
|
|
dist-src:
|
|
|
|
@tar --exclude=*~ -cjf $(TARGET)-src.tar.bz2 include source Makefile
|
|
|
|
|
|
|
|
dist: dist-src dist-bin
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
clean:
|
|
|
|
@echo clean ...
|
2020-10-27 20:55:19 +00:00
|
|
|
@rm -fr release lib *.bz2 $(GCH_FILES)
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
else
|
|
|
|
|
2020-10-30 18:56:12 +00:00
|
|
|
DEPENDS := $(OFILES:.o=.d) $(foreach hdr,$(GCH_FILES:.hpp.gch=.d),$(notdir $(hdr)))
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# main targets
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
$(OUTPUT) : $(OFILES)
|
|
|
|
|
2020-05-11 23:02:10 +01:00
|
|
|
$(OFILES) : $(GCH_FILES)
|
|
|
|
|
2019-12-17 22:16:08 +00:00
|
|
|
$(OFILES_SRC) : $(HFILES_BIN)
|
2019-12-09 11:57:37 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
%_bin.h %.bin.o : %.bin
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
@echo $(notdir $<)
|
|
|
|
@$(bin2o)
|
|
|
|
|
|
|
|
|
|
|
|
-include $(DEPENDS)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------
|
|
|
|
endif
|
|
|
|
#---------------------------------------------------------------------------------------
|
|
|
|
|