mirror of
https://github.com/pret/pokediamond.git
synced 2026-03-21 17:54:29 -05:00
89 lines
2.4 KiB
Makefile
89 lines
2.4 KiB
Makefile
# Try to include devkitarm if installed
|
|
TOOLCHAIN := $(DEVKITARM)
|
|
|
|
ifneq (,$(wildcard $(TOOLCHAIN)/base_tools))
|
|
include $(TOOLCHAIN)/base_tools
|
|
endif
|
|
|
|
# If you are using WSL, it is recommended you build with NOWINE=1.
|
|
WSLENV ?= no
|
|
ifeq ($(WSLENV),no)
|
|
NOWINE = 0
|
|
else
|
|
# As of build 17063, WSLENV is defined in both WSL1 and WSL2
|
|
# so we need to use the kernel release to detect between
|
|
# the two.
|
|
UNAME_R := $(shell uname -r)
|
|
ifeq ($(findstring WSL2,$(UNAME_R)),)
|
|
NOWINE = 1
|
|
else
|
|
NOWINE = 0
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(OS),Windows_NT)
|
|
EXE := .exe
|
|
WINE :=
|
|
else
|
|
EXE :=
|
|
WINE := wine
|
|
endif
|
|
|
|
ifeq ($(NOWINE),1)
|
|
WINE :=
|
|
endif
|
|
|
|
# Compare result of arm9, arm7, and ROM to sha1 hash(s)
|
|
COMPARE ?= 1
|
|
|
|
##################### Compiler Options #######################
|
|
|
|
MWCCVERSION = 2.0/sp1
|
|
|
|
CROSS := arm-none-eabi-
|
|
|
|
MWCCARM = ../../../tools/mwccarm/$(MWCCVERSION)/mwccarm.exe
|
|
# Argh... due to EABI version shenanigans, we can't use GNU LD to link together
|
|
# MWCC built objects and GNU built ones. mwldarm, however, doesn't care, so we
|
|
# have to use mwldarm for now.
|
|
# TODO: Is there a hack workaround to let us go back to GNU LD? Ideally, the
|
|
# only dependency should be MWCCARM.
|
|
MWLDARM = ../../../tools/mwccarm/$(MWCCVERSION)/mwldarm.exe
|
|
MWASMARM = ../../../tools/mwccarm/$(MWCCVERSION)/mwasmarm.exe
|
|
SCANINC = ../../../tools/scaninc/scaninc$(EXE)
|
|
|
|
AS = $(WINE) $(MWASMARM)
|
|
CC = $(WINE) $(MWCCARM)
|
|
CPP := cpp -P
|
|
LD = $(WINE) $(MWLDARM)
|
|
AR := $(CROSS)ar
|
|
OBJDUMP := $(CROSS)objdump
|
|
OBJCOPY := $(CROSS)objcopy
|
|
|
|
# ./tools/mwccarm/2.0/base/mwasmarm.exe -proc arm5te asm/arm9_thumb.s -o arm9.o
|
|
MWASFLAGS = -proc arm5te -g -ir ../../..
|
|
MWCFLAGS = O4,p -sym on -gccext,on -proc arm946e -msgstyle gcc -gccinc -fp soft -lang c99 -Cpp_exceptions off -inline on,noauto -i ../include -ir ../include-mw -ir lib/MSL_C/include -ir lib/libnns/include -ir lib/NitroSDK/include -interworking -DFS_IMPLEMENT -enum int -D$(GAME_VERSION) -D$(GAME_LANGUAGE) -W all -W pedantic -W noimpl_signedunsigned -W noimplicitconv -W nounusedarg -W nomissingreturn -W error -ipa file
|
|
MWLDFLAGS = -library -sym on -nodead -w off -proc v5te -interworking -pic
|
|
ARFLAGS = rcS
|
|
|
|
export MWCIncludes := include
|
|
|
|
################ Targets #################
|
|
|
|
.PHONY: all clean
|
|
|
|
all:
|
|
@:
|
|
|
|
clean:
|
|
$(RM) $(%.a=%/*.o)
|
|
|
|
%.a:
|
|
$(AR) $(ARFLAGS) -o $@ $^
|
|
|
|
%.o: %.c
|
|
$(CC) $(MWCFLAGS) -o $@ $<
|
|
|
|
%.o: %.s
|
|
$(AS) $(MWASFLAGS) -o $@ $<
|