Add macOS building support (you need to install coreutils and gnu-sed with homebrew)

This commit is contained in:
Aurora Wright 2017-06-26 16:29:04 +02:00
parent 91378ef3c1
commit 6e54dcc24c
2 changed files with 14 additions and 4 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ exceptions/arm11/build
*.d *.d
*.elf *.elf
*.cxi *.cxi
.DS_Store

View File

@ -10,8 +10,17 @@ endif
include $(DEVKITARM)/base_tools include $(DEVKITARM)/base_tools
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
sed := gsed
du := gdu
else
sed := sed
du := du
endif
name := Luma3DS name := Luma3DS
revision := $(shell git describe --tags --match v[0-9]* --abbrev=8 | sed 's/-[0-9]*-g/-/i') revision := $(shell git describe --tags --match v[0-9]* --abbrev=8 | $(sed) 's/-[0-9]*-g/-/i')
version_major := $(shell git describe --tags --match v[0-9]* | cut -c2- | cut -f1 -d- | cut -f1 -d.) version_major := $(shell git describe --tags --match v[0-9]* | cut -c2- | cut -f1 -d- | cut -f1 -d.)
version_minor := $(shell git describe --tags --match v[0-9]* | cut -c2- | cut -f1 -d- | cut -f2 -d.) version_minor := $(shell git describe --tags --match v[0-9]* | cut -c2- | cut -f1 -d- | cut -f2 -d.)
version_build := $(shell git describe --tags --match v[0-9]* | cut -c2- | cut -f1 -d- | cut -f3 -d.) version_build := $(shell git describe --tags --match v[0-9]* | cut -c2- | cut -f1 -d- | cut -f3 -d.)
@ -145,12 +154,12 @@ $(dir_build)/config.o: CFLAGS += -DCONFIG_TITLE="\"$(name) $(revision) configura
$(dir_build)/patches.o: CFLAGS += -DVERSION_MAJOR="$(version_major)" -DVERSION_MINOR="$(version_minor)"\ $(dir_build)/patches.o: CFLAGS += -DVERSION_MAJOR="$(version_major)" -DVERSION_MINOR="$(version_minor)"\
-DVERSION_BUILD="$(version_build)" -DISRELEASE="$(is_release)" -DCOMMIT_HASH="0x$(commit)" -DVERSION_BUILD="$(version_build)" -DISRELEASE="$(is_release)" -DCOMMIT_HASH="0x$(commit)"
$(dir_build)/firm.o: $(dir_build)/modules.bin $(dir_build)/firm.o: $(dir_build)/modules.bin
$(dir_build)/firm.o: CFLAGS += -DLUMA_SECTION0_SIZE="$(shell du -b $(dir_build)/modules.bin | cut -f1)" $(dir_build)/firm.o: CFLAGS += -DLUMA_SECTION0_SIZE="$(shell $(du) -b $(dir_build)/modules.bin | cut -f1)"
$(dir_build)/bundled.h: $(bundled) $(dir_build)/bundled.h: $(bundled)
@$(foreach f, $(bundled),\ @$(foreach f, $(bundled),\
echo "extern const u8" `(echo $(basename $(notdir $(f))) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> $@;\ echo "extern const u8" `(echo $(basename $(notdir $(f))) | $(sed) -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> $@;\
echo "extern const u32" `(echo $(basename $(notdir $(f)))| sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> $@;\ echo "extern const u32" `(echo $(basename $(notdir $(f)))| $(sed) -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> $@;\
) )
$(dir_build)/%.o: $(dir_source)/%.c $(dir_build)/bundled.h $(dir_build)/%.o: $(dir_source)/%.c $(dir_build)/bundled.h