diff --git a/arm11/Makefile b/arm11/Makefile index 716257a..154d924 100644 --- a/arm11/Makefile +++ b/arm11/Makefile @@ -24,7 +24,6 @@ DEFINES := -DARM11 -D_3DS -DVERS_STRING=\"$(VERS_STRING)\" \ -DVERS_MAJOR=$(VERS_MAJOR) -DVERS_MINOR=$(VERS_MINOR) ASSETS := ../assets -LDNAME := arm11.ld ifneq ($(strip $(NO_DEBUG)),) DEFINES += -DNDEBUG @@ -33,21 +32,19 @@ #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- -ARCH := -march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft -marm -mthumb-interwork +ARCH := -march=armv6k+vfpv2 -mtune=mpcore -mfloat-abi=hard -mtp=soft -marm -mthumb-interwork -CFLAGS := $(ARCH) -std=gnu11 -O2 -g -flto -mword-relocations -ffunction-sections \ +CFLAGS := $(ARCH) -std=gnu17 -O2 -g -flto -mword-relocations -ffunction-sections \ -Wall -Wextra -Wno-unused-function - CFLAGS += $(INCLUDE) $(DEFINES) -CXXFLAGS := $(ARCH) -std=c++14 -O2 -g -flto -fno-rtti -fno-exceptions \ +CXXFLAGS := $(ARCH) -std=c++17 -O2 -g -flto -fno-rtti -fno-exceptions \ -mword-relocations -ffunction-sections -Wall -Wextra \ -Wno-unused-function - CXXFLAGS += $(INCLUDE) $(DEFINES) ASFLAGS := $(ARCH) -g -flto $(INCLUDE) $(DEFINES) -LDFLAGS = $(ARCH) -g -flto -Wl,--use-blx,--gc-sections,-Map,$(notdir $*.map) -nostartfiles -T ../$(LDNAME) +LDFLAGS = $(ARCH) -g -flto -specs=../arm11.specs -Wl,-Map,$(notdir $*.map) -nostartfiles LIBS := @@ -103,31 +100,34 @@ export HFILES := $(ASSETFILES:.png=_spla.h) $(addsuffix .h,$(subst .,_,$(BINFILES))) export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) -.PHONY: $(BUILD) clean all + +.PHONY: $(BUILD) all clean #--------------------------------------------------------------------------------- -all: $(BUILD) +all: $(BUILD) $(DEPSDIR) + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $(BUILD): - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + @mkdir -p $@ + +ifneq ($(DEPSDIR),$(BUILD)) +$(DEPSDIR): + @mkdir -p $@ +endif #--------------------------------------------------------------------------------- clean: @echo clean ... @rm -fr $(BUILD) $(OUTPUT)11.bin $(OUTPUT)11.elf - #--------------------------------------------------------------------------------- else -DEPENDS := $(OFILES:.o=.d) - #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- @@ -147,7 +147,6 @@ @echo $(notdir $<) @$(bin2o) - #--------------------------------------------------------------------------------- # rules for conversion of .png to .spla #--------------------------------------------------------------------------------- @@ -166,7 +165,6 @@ @echo $(notdir $^) @$(call splashConv,$^) - #--------------------------------------------------------------------------------- %.elf: #--------------------------------------------------------------------------------- @@ -174,9 +172,8 @@ @$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@ @$(NM) -CSn $@ > $(notdir $*.lst) - --include $(DEPENDS) +-include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------------- endif -#--------------------------------------------------------------------------------------- +#--------------------------------------------------------------------------------------- \ No newline at end of file diff --git a/arm11/arm11.specs b/arm11/arm11.specs new file mode 100644 index 0000000..d62ced0 --- /dev/null +++ b/arm11/arm11.specs @@ -0,0 +1,4 @@ +%rename link old_link + +*link: +%(old_link) -T ../arm11.ld -d --use-blx --gc-sections diff --git a/arm9/Makefile b/arm9/Makefile index 19e8757..6e7c620 100644 --- a/arm9/Makefile +++ b/arm9/Makefile @@ -23,7 +23,6 @@ INCLUDES := ../include ../thirdparty DEFINES := -DARM9 -D_3DS -DVERS_STRING=\"$(VERS_STRING)\" \ -DVERS_MAJOR=$(VERS_MAJOR) -DVERS_MINOR=$(VERS_MINOR) -LDNAME := arm9.ld ifneq ($(strip $(NO_DEBUG)),) DEFINES += -DNDEBUG @@ -34,19 +33,16 @@ #--------------------------------------------------------------------------------- ARCH := -march=armv5te -mtune=arm946e-s -mfloat-abi=soft -mtp=soft -marm -mthumb-interwork -CFLAGS := $(ARCH) -std=c11 -O2 -g -flto -mword-relocations -ffunction-sections \ - -Wall -Wextra -Wno-unused-function - +CFLAGS := $(ARCH) -std=c17 -O2 -g -flto -mword-relocations \ + -ffunction-sections -Wall -Wextra CFLAGS += $(INCLUDE) $(DEFINES) -CXXFLAGS := $(ARCH) -std=c++14 -O2 -g -flto -fno-rtti -fno-exceptions \ - -mword-relocations -ffunction-sections -Wall -Wextra \ - -Wno-unused-function - +CXXFLAGS := $(ARCH) -std=c++17 -O2 -g -flto -fno-rtti -fno-exceptions \ + -mword-relocations -ffunction-sections -Wall -Wextra CXXFLAGS += $(INCLUDE) $(DEFINES) ASFLAGS := $(ARCH) -g -flto $(INCLUDE) $(DEFINES) -LDFLAGS = $(ARCH) -g -flto -Wl,--use-blx,--gc-sections,-Map,$(notdir $*.map) -nostartfiles -T ../$(LDNAME) +LDFLAGS = $(ARCH) -g -flto -specs=../arm9.specs -Wl,-Map,$(notdir $*.map) -nostartfiles LIBS := @@ -100,31 +96,34 @@ export HFILES := $(addsuffix .h,$(subst .,_,$(BINFILES))) export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ - $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ - -I$(CURDIR)/$(BUILD) + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ + -I$(CURDIR)/$(BUILD) export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) -.PHONY: $(BUILD) clean all + +.PHONY: $(BUILD) all clean #--------------------------------------------------------------------------------- -all: $(BUILD) +all: $(BUILD) $(DEPSDIR) + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile $(BUILD): - @[ -d $@ ] || mkdir -p $@ - @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile + @mkdir -p $@ + +ifneq ($(DEPSDIR),$(BUILD)) +$(DEPSDIR): + @mkdir -p $@ +endif #--------------------------------------------------------------------------------- clean: @echo clean ... @rm -fr $(BUILD) $(OUTPUT)9.bin $(OUTPUT)9.elf - #--------------------------------------------------------------------------------- else -DEPENDS := $(OFILES:.o=.d) - #--------------------------------------------------------------------------------- # main targets #--------------------------------------------------------------------------------- @@ -151,8 +150,7 @@ @$(LD) $(LDFLAGS) $(OFILES) $(LIBPATHS) $(LIBS) -o $@ @$(NM) -CSn $@ > $(notdir $*.lst) - --include $(DEPENDS) +-include $(DEPSDIR)/*.d #--------------------------------------------------------------------------------------- endif diff --git a/arm9/arm9.specs b/arm9/arm9.specs new file mode 100644 index 0000000..f007b50 --- /dev/null +++ b/arm9/arm9.specs @@ -0,0 +1,4 @@ +%rename link old_link + +*link: +%(old_link) -T ../arm9.ld -d --use-blx --gc-sections