1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-26 14:46:16 +00:00
oot/tools/Makefile
Tharo 04a9d51e90
Rework handling of dmadata (#1036)
* Generate dmadata

* Remove tab indentations in mkdmadata.c and mkldscript.c

* Fix

* Review suggestions

* Hopefully fix

* Fix index

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>

Co-authored-by: Dragorn421 <Dragorn421@users.noreply.github.com>
2021-12-01 00:29:09 +01:00

43 lines
931 B
Makefile

CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2
PROGRAMS := elf2rom makeromfs mkdmadata mkldscript vtxdis yaz0
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
all: $(PROGRAMS)
cd ZAPD && $(MAKE)
clean:
$(RM) $(PROGRAMS) $(addsuffix .exe,$(PROGRAMS))
$(MAKE) -C ZAPD clean
distclean: clean
.PHONY: all clean distclean
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
vtxdis_SOURCES := vtxdis.c
yaz0_SOURCES := yaz0tool.c yaz0.c util.c
define COMPILE =
$(1): $($1_SOURCES)
$(CC) $(CFLAGS) $$^ -o $$@
endef
$(foreach p,$(PROGRAMS),$(eval $(call COMPILE,$(p))))