91 lines
3.1 KiB
Makefile
91 lines
3.1 KiB
Makefile
#---------------------------------------------------------------------------------
|
|
# MBMNET Shop - Homebrew-Shop für den 3DS (.3dsx / .cia)
|
|
# Wird von der MBMNET-App auf Wunsch installiert. Version = Version der MBMNET-App.
|
|
#---------------------------------------------------------------------------------
|
|
.SUFFIXES:
|
|
|
|
ifeq ($(strip $(DEVKITARM)),)
|
|
$(error "DEVKITARM ist nicht gesetzt. Bitte devkitPro installieren.")
|
|
endif
|
|
|
|
TOPDIR ?= $(CURDIR)
|
|
include $(DEVKITARM)/3ds_rules
|
|
|
|
TARGET := mbmnet-shop
|
|
BUILD := build
|
|
SOURCES := source
|
|
INCLUDES := source
|
|
|
|
# Gleiche Version wie die MBMNET-App (die vergleicht damit, ob der Shop aktuell ist)
|
|
VERSION := $(shell sed -n 's/^VERSION *:= *//p' $(TOPDIR)/../Makefile)
|
|
|
|
APP_TITLE := MBMNET Shop
|
|
APP_DESCRIPTION := Homebrew für deinen 3DS
|
|
APP_AUTHOR := MBMNET
|
|
ICON := icon.png
|
|
|
|
# CIA: feste Titel-ID 000400000FB4E100
|
|
APP_PRODUCT_CODE := CTR-H-MBMS
|
|
APP_UNIQUE_ID := 0xFB4E1
|
|
VERSION_PARTS := $(subst ., ,$(VERSION))
|
|
# Titelversion wie bei der MBMNET-App: 2.9.0 -> 29.0.0
|
|
TITLE_MAJOR := $(shell echo $$(( $(word 1,$(VERSION_PARTS)) * 10 + $(word 2,$(VERSION_PARTS)) )))
|
|
VERSION_NUM := $(shell echo $$(( ($(TITLE_MAJOR) << 10) | $(word 3,$(VERSION_PARTS)) )))
|
|
|
|
ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft
|
|
CFLAGS := -g -Wall -O2 -mword-relocations -ffunction-sections $(ARCH) $(INCLUDE) -D__3DS__ -DAPP_VERSION=\"$(VERSION)\"
|
|
ASFLAGS := -g $(ARCH)
|
|
LDFLAGS = -specs=3dsx.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
|
|
LIBS := -lcitro2d -lcitro3d -lctru -lm
|
|
LIBDIRS := $(CTRULIB) $(PORTLIBS)
|
|
|
|
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|
|
|
export OUTPUT := $(CURDIR)/$(TARGET)
|
|
export TOPDIR := $(CURDIR)
|
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))
|
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
|
|
|
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
|
export LD := $(CC)
|
|
export OFILES := $(CFILES:.c=.o)
|
|
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)
|
|
export APP_ICON := $(TOPDIR)/$(ICON)
|
|
export _3DSXDEPS := $(OUTPUT).smdh
|
|
export _3DSXFLAGS += --smdh=$(OUTPUT).smdh
|
|
|
|
.PHONY: all clean cia $(BUILD)
|
|
|
|
all: $(BUILD)
|
|
|
|
cia: $(BUILD)
|
|
@bannertool makebanner -i assets/banner.png -a assets/banner.wav -o $(BUILD)/banner.bnr
|
|
@bannertool makesmdh -s "$(APP_TITLE)" -l "$(APP_DESCRIPTION)" -p "$(APP_AUTHOR)" -i $(ICON) -o $(BUILD)/icon.icn
|
|
@makerom -f cia -o $(TARGET).cia -elf $(TARGET).elf -rsf cia.rsf -target t -exefslogo \
|
|
-icon $(BUILD)/icon.icn -banner $(BUILD)/banner.bnr \
|
|
-DAPP_TITLE="$(APP_TITLE)" -DAPP_PRODUCT_CODE="$(APP_PRODUCT_CODE)" -DAPP_UNIQUE_ID="$(APP_UNIQUE_ID)" \
|
|
-ver $(VERSION_NUM)
|
|
@echo built ... $(TARGET).cia
|
|
|
|
$(BUILD):
|
|
@mkdir -p $@
|
|
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
|
|
|
clean:
|
|
@echo clean ...
|
|
@rm -fr $(BUILD) $(TARGET).3dsx $(TARGET).smdh $(TARGET).elf $(TARGET).cia
|
|
|
|
else
|
|
|
|
DEPENDS := $(OFILES:.o=.d)
|
|
|
|
$(OUTPUT).3dsx : $(OUTPUT).elf $(_3DSXDEPS)
|
|
$(OUTPUT).elf : $(OFILES)
|
|
|
|
-include $(DEPENDS)
|
|
|
|
endif
|