2020-03-17 04:31:30 +00:00
|
|
|
CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2
|
2024-08-14 08:05:36 +00:00
|
|
|
PROGRAMS := elf2rom makeromfs mkdmadata mkldscript preprocess_pragmas reloc_prereq vtxdis
|
2021-10-31 19:00:24 +00:00
|
|
|
|
2024-12-26 17:41:03 +00:00
|
|
|
UNAME_S := $(shell uname -s)
|
|
|
|
ifeq ($(UNAME_S),Linux)
|
|
|
|
DETECTED_OS=linux
|
|
|
|
else ifeq ($(UNAME_S),Darwin)
|
|
|
|
DETECTED_OS=macos
|
|
|
|
else
|
|
|
|
$(error Unsupported OS: $(UNAME_S))
|
|
|
|
endif
|
|
|
|
|
|
|
|
IDO_RECOMP_VERSION := v1.2
|
|
|
|
IDO_RECOMP_5_3_DIR := ido_recomp/$(DETECTED_OS)/5.3
|
|
|
|
IDO_RECOMP_7_1_DIR := ido_recomp/$(DETECTED_OS)/7.1
|
|
|
|
|
2021-10-31 19:00:24 +00:00
|
|
|
ifeq ($(shell command -v clang >/dev/null 2>&1; echo $$?),0)
|
|
|
|
CC := clang
|
|
|
|
else
|
|
|
|
CC := gcc
|
|
|
|
endif
|
|
|
|
|
|
|
|
LLD ?= 0
|
|
|
|
|
|
|
|
ifeq ($(shell command -v ld.lld >/dev/null 2>&1; echo $$?),0)
|
|
|
|
LLD := 1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(LLD),0)
|
|
|
|
CFLAGS += -fuse-ld=lld
|
|
|
|
endif
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2024-12-26 17:41:03 +00:00
|
|
|
all: $(PROGRAMS) $(IDO_RECOMP_5_3_DIR) $(IDO_RECOMP_7_1_DIR)
|
2022-02-06 19:40:26 +00:00
|
|
|
$(MAKE) -C ZAPD
|
|
|
|
$(MAKE) -C fado
|
2024-08-09 02:39:18 +00:00
|
|
|
$(MAKE) -C audio
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
clean:
|
2021-01-20 19:46:25 +00:00
|
|
|
$(RM) $(PROGRAMS) $(addsuffix .exe,$(PROGRAMS))
|
2024-12-26 17:41:03 +00:00
|
|
|
$(RM) -r ido_recomp
|
2021-04-04 21:48:12 +00:00
|
|
|
$(MAKE) -C ZAPD clean
|
2022-02-06 19:40:26 +00:00
|
|
|
$(MAKE) -C fado clean
|
2024-08-09 02:39:18 +00:00
|
|
|
$(MAKE) -C audio clean
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2021-03-14 16:07:46 +00:00
|
|
|
distclean: clean
|
2024-08-09 02:39:18 +00:00
|
|
|
$(MAKE) -C audio distclean
|
2021-03-14 16:07:46 +00:00
|
|
|
|
|
|
|
.PHONY: all clean distclean
|
|
|
|
|
2024-08-14 08:05:36 +00:00
|
|
|
elf2rom_SOURCES := elf2rom.c elf32.c n64chksum.c util.c
|
|
|
|
makeromfs_SOURCES := makeromfs.c n64chksum.c util.c
|
|
|
|
mkdmadata_SOURCES := mkdmadata.c spec.c util.c
|
|
|
|
mkldscript_SOURCES := mkldscript.c spec.c util.c
|
|
|
|
preprocess_pragmas_SOURCES := preprocess_pragmas.c
|
|
|
|
reloc_prereq_SOURCES := reloc_prereq.c spec.c util.c
|
|
|
|
vtxdis_SOURCES := vtxdis.c
|
2022-02-06 19:40:26 +00:00
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
define COMPILE =
|
|
|
|
$(1): $($1_SOURCES)
|
|
|
|
$(CC) $(CFLAGS) $$^ -o $$@
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p))))
|
2024-12-26 17:41:03 +00:00
|
|
|
|
|
|
|
$(IDO_RECOMP_5_3_DIR):
|
|
|
|
mkdir -p $@
|
|
|
|
curl -L https://github.com/decompals/ido-static-recomp/releases/download/$(IDO_RECOMP_VERSION)/ido-5.3-recomp-$(DETECTED_OS).tar.gz | tar xz -C $@
|
|
|
|
|
|
|
|
$(IDO_RECOMP_7_1_DIR):
|
|
|
|
mkdir -p $@
|
|
|
|
curl -L https://github.com/decompals/ido-static-recomp/releases/download/$(IDO_RECOMP_VERSION)/ido-7.1-recomp-$(DETECTED_OS).tar.gz | tar xz -C $@
|