123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- .SUFFIXES:
- ifeq ($(strip $(DEVKITPRO)),)
- $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
- endif
- TOPDIR ?= $(CURDIR)
- include $(DEVKITPRO)/libnx/switch_rules
- APP_TITLE := GameCard Installer
- APP_AUTHOR := TotalJustice
- APP_VERSION := 2.0.5
- TARGET := gamecard_installer
- BUILD := build
- SOURCES := source source/ui source/gfx source/sound source/nx source/util
- DATA := data
- INCLUDES := includes includes/ui includes/gfx includes/sound includes/nx includes/util
- ROMFS := romfs
- ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE
- CFLAGS := -g -Wall -O3 $(DEBUG) -ffunction-sections \
- $(ARCH) $(DEFINES)
- CFLAGS += $(INCLUDE) -D__SWITCH__ `freetype-config --cflags` `sdl2-config --cflags`
- CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
- ASFLAGS := -g $(ARCH)
- LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
- LIBS := -lSDL2_mixer -lSDL2_ttf -lSDL2_image -lSDL2 -lSDL2_gfx `sdl2-config --libs` `freetype-config --libs` \
- -lwebp -lpng -lturbojpeg -lmodplug -lmpg123 -lFLAC -lopusfile -lopus -lvorbisidec -logg -lz \
- -lnx
- LIBDIRS := $(PORTLIBS) $(LIBNX)
- 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)
- CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
- CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
- SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
- BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
- ifeq ($(strip $(CPPFILES)),)
- export LD := $(CXX)
- else
- export LD := $(CXX)
- endif
- export OFILES_BIN := $(addsuffix .o,$(BINFILES))
- export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
- export OFILES := $(OFILES_BIN) $(OFILES_SRC)
- export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
- 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)
- ifeq ($(strip $(ICON)),)
- icons := $(wildcard *.jpg)
- ifneq (,$(findstring $(TARGET).jpg,$(icons)))
- export APP_ICON := $(TOPDIR)/$(TARGET).jpg
- else
- ifneq (,$(findstring icon.jpg,$(icons)))
- export APP_ICON := $(TOPDIR)/icon.jpg
- endif
- endif
- else
- export APP_ICON := $(TOPDIR)/$(ICON)
- endif
- ifeq ($(strip $(NO_ICON)),)
- export NROFLAGS += --icon=$(APP_ICON)
- endif
- ifeq ($(strip $(NO_NACP)),)
- export NROFLAGS += --nacp=$(CURDIR)/$(TARGET).nacp
- endif
- ifneq ($(APP_TITLEID),)
- export NACPFLAGS += --titleid=$(APP_TITLEID)
- endif
- ifneq ($(ROMFS),)
- export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
- endif
- .PHONY: $(BUILD) clean all
- all: $(BUILD)
- $(BUILD):
- @[ -d $@ ] || mkdir -p $@
- @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
- clean:
- @echo clean ...
- ifeq ($(strip $(APP_JSON)),)
- @rm -fr $(BUILD) $(TARGET).nro $(TARGET).nacp $(TARGET).elf
- else
- @rm -fr $(BUILD) $(TARGET).nsp $(TARGET).nso $(TARGET).npdm $(TARGET).elf
- endif
- dist: all
- @echo making dist ...
- rm -rf out/
- rm gamecard_installer.zip
- mkdir -p out
- mkdir -p out/switch
- mkdir -p out/switch/gamecard_installer
- cp $(CURDIR)/$(TARGET).nro out/switch/gamecard_installer
- cd out; zip -r ../gamecard_installer.zip ./*; cd ../;
- nxlink: all
- @echo making and nxlinking ...
- nxlink $(CURDIR)/$(TARGET).nro
- else
- .PHONY: all
- DEPENDS := $(OFILES:.o=.d)
- all : $(OUTPUT).nro
- ifeq ($(strip $(NO_NACP)),)
- $(OUTPUT).nro : $(OUTPUT).elf $(OUTPUT).nacp
- else
- $(OUTPUT).nro : $(OUTPUT).elf
- endif
- $(OUTPUT).elf : $(OFILES)
- $(OFILES_SRC) : $(HFILES_BIN)
- %.bin.o %_bin.h : %.bin
- @echo $(notdir $<)
- @$(bin2o)
- -include $(DEPENDS)
- endif
|