1
0
mirror of https://github.com/cathery/sys-con.git synced 2024-07-08 03:58:43 +00:00
sys-con/source/Sysmodule/Makefile

133 lines
5.7 KiB
Makefile
Raw Normal View History

2020-01-12 02:01:44 +00:00
#---------------------------------------------------------------------------------
2020-02-05 22:06:13 +00:00
# pull in common stratosphere sysmodule configuration
2020-01-12 02:01:44 +00:00
#---------------------------------------------------------------------------------
2020-02-05 22:06:13 +00:00
include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../libstratosphere/config/templates/stratosphere.mk
2020-01-12 02:01:44 +00:00
TARGET := sys-con
2020-02-05 22:06:13 +00:00
SOURCES += ../ControllerSwitch ../ControllerLib ../ControllerLib/Controllers ../inih
INCLUDES += ../ControllerSwitch ../ControllerLib ../inih
2020-01-12 02:01:44 +00:00
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(TARGET)
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
2020-02-05 22:06:13 +00:00
CFILES := $(foreach dir,$(SOURCES),$(filter-out $(notdir $(wildcard $(dir)/*.arch.*.c)) $(notdir $(wildcard $(dir)/*.board.*.c)) $(notdir $(wildcard $(dir)/*.os.*.c)), \
$(notdir $(wildcard $(dir)/*.c))))
CFILES += $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.arch.$(ATMOSPHERE_ARCH_NAME).c)))
CFILES += $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.board.$(ATMOSPHERE_BOARD_NAME).c)))
CFILES += $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.os.$(ATMOSPHERE_OS_NAME).c)))
CPPFILES := $(foreach dir,$(SOURCES),$(filter-out $(notdir $(wildcard $(dir)/*.arch.*.cpp)) $(notdir $(wildcard $(dir)/*.board.*.cpp)) $(notdir $(wildcard $(dir)/*.os.*.cpp)), \
$(notdir $(wildcard $(dir)/*.cpp))))
CPPFILES += $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.arch.$(ATMOSPHERE_ARCH_NAME).cpp)))
CPPFILES += $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.board.$(ATMOSPHERE_BOARD_NAME).cpp)))
CPPFILES += $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.os.$(ATMOSPHERE_OS_NAME).cpp)))
SFILES := $(foreach dir,$(SOURCES),$(filter-out $(notdir $(wildcard $(dir)/*.arch.*.s)) $(notdir $(wildcard $(dir)/*.board.*.s)) $(notdir $(wildcard $(dir)/*.os.*.s)), \
$(notdir $(wildcard $(dir)/*.s))))
SFILES += $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.arch.$(ATMOSPHERE_ARCH_NAME).s)))
SFILES += $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.board.$(ATMOSPHERE_BOARD_NAME).s)))
SFILES += $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.os.$(ATMOSPHERE_OS_NAME).s)))
2020-01-12 02:01:44 +00:00
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
2020-02-05 22:06:13 +00:00
export OFILES := $(addsuffix .o,$(BINFILES)) \
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
2020-01-12 02:01:44 +00:00
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
2020-02-05 22:06:13 +00:00
export BUILD_EXEFS_SRC := $(TOPDIR)/$(EXEFS_SRC)
2020-01-12 02:01:44 +00:00
ifeq ($(strip $(CONFIG_JSON)),)
jsons := $(wildcard *.json)
ifneq (,$(findstring $(TARGET).json,$(jsons)))
export APP_JSON := $(TOPDIR)/$(TARGET).json
else
ifneq (,$(findstring config.json,$(jsons)))
export APP_JSON := $(TOPDIR)/config.json
endif
endif
else
export APP_JSON := $(TOPDIR)/$(CONFIG_JSON)
endif
2020-02-05 22:06:13 +00:00
.PHONY: $(BUILD) clean all
2020-01-12 02:01:44 +00:00
#---------------------------------------------------------------------------------
2020-02-05 22:06:13 +00:00
all: $(BUILD)
2020-01-12 02:01:44 +00:00
2020-02-05 22:06:13 +00:00
$(BUILD):
2020-01-12 02:01:44 +00:00
@[ -d $@ ] || mkdir -p $@
2020-02-05 22:06:13 +00:00
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
2020-01-12 02:01:44 +00:00
2020-02-05 22:06:13 +00:00
#---------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).nsp $(TARGET).npdm $(TARGET).nso $(TARGET).elf
2020-01-12 02:01:44 +00:00
#---------------------------------------------------------------------------------
else
2020-02-05 22:06:13 +00:00
.PHONY: all
2020-01-12 02:01:44 +00:00
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
2020-02-05 22:06:13 +00:00
all : $(OUTPUT).nsp
2020-01-12 02:01:44 +00:00
2020-02-05 22:06:13 +00:00
ifeq ($(strip $(APP_JSON)),)
$(OUTPUT).nsp : $(OUTPUT).nso
2020-01-12 02:01:44 +00:00
else
$(OUTPUT).nsp : $(OUTPUT).nso $(OUTPUT).npdm
2020-02-05 22:06:13 +00:00
endif
2020-01-12 02:01:44 +00:00
$(OUTPUT).nso : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
2020-02-05 22:06:13 +00:00
%.bin.o : %.bin
2020-01-12 02:01:44 +00:00
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------