force mac/linux users to compile a local copy of bin2h

This commit is contained in:
meta
2019-02-15 15:51:45 -06:00
parent 01dabc8219
commit 84153dfaa4
4 changed files with 57 additions and 4 deletions

3
.gitignore vendored
View File

@@ -12,4 +12,5 @@ fatfs/*.a
codehandler/*.h
.vscode/*
.idea/*
!kernel/gecko/*.bin
!kernel/gecko/*.bin
kernel/bin2h/bin2h

View File

@@ -20,13 +20,20 @@ SUBPROJECTS := multidol kernel/asm resetstub \
all: loader
forced: clean all
# Force MacOS/Linux users to compile their own copy of bin2h
bin2h: bin2h
@echo " "
@echo "Building bin2h"
@echo " "
$(MAKE) -C kernel/bin2h
multidol:
@echo " "
@echo "Building Multi-DOL loader"
@echo " "
$(MAKE) -C multidol
kernel/asm:
kernel/asm: bin2h
@echo " "
@echo "Building asm files"
@echo " "
@@ -50,13 +57,13 @@ fatfs/libfat-ppc.a:
@echo " "
$(MAKE) -C fatfs -f Makefile.ppc
codehandler:
codehandler: bin2h
@echo " "
@echo "Building Nintendont code handler"
@echo " "
$(MAKE) -C codehandler
kernel: kernel/asm fatfs/libfat-arm.a codehandler
kernel: kernel/asm fatfs/libfat-arm.a codehandler bin2h
@echo " "
@echo "Building Nintendont kernel"
@echo " "

45
kernel/bin2h/Makefile Normal file
View File

@@ -0,0 +1,45 @@
TARGET := bin2h
PLATFORM := none
CFLAGS :=
# The Windows binary tracked in this repo seems alright, so just skip building
# for Windows users. Otherwise, force MacOS/Linux users to compile their own
# version to keep around locally. The UNIX binary should *not* be tracked in
# this repository.
ifeq ($(OS),Windows_NT)
#TARGET = bin2h.exe
#CFLAGS = -s -Os -static
PLATFORM = windows
else
UNAME := $(shell uname -s)
ifeq ($(UNAME),Darwin)
CFLAGS = -s -Os
PLATFORM = mac
endif
ifeq ($(UNAME),Linux)
CFLAGS = -m32 -s -Os -static
PLATFORM = linux
endif
endif
ifeq ($(PLATFORM),none)
$(error Couldnt detect platform - failed to compile bin2h)
endif
# -----------------------------------------------------------------------------
# Targets
.PHONY: all clean
all: $(TARGET)
$(TARGET): main.c
ifeq ($(OS),windows)
@echo "Using prebuilt bin2h.exe ..."
else
@echo "Building bin2h ..."
gcc $< $(CFLAGS) -o $@
endif
clean:
@echo "cleaning bin2h ..."
@rm -f $(TARGET)

Binary file not shown.