2020-03-17 04:31:30 +00:00
|
|
|
CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2
|
2024-06-19 00:53:19 +00:00
|
|
|
PROGRAMS := elf2rom makeromfs mkdmadata mkldscript reloc_prereq vtxdis
|
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
|
|
|
|
|
|
|
all: $(PROGRAMS)
|
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))
|
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
|
|
|
|
|
2022-02-06 19:40:26 +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
|
|
|
|
reloc_prereq_SOURCES := reloc_prereq.c spec.c util.c
|
|
|
|
vtxdis_SOURCES := vtxdis.c
|
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
define COMPILE =
|
|
|
|
$(1): $($1_SOURCES)
|
|
|
|
$(CC) $(CFLAGS) $$^ -o $$@
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p))))
|