1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-29 03:34:07 +00:00
oot/tools/Makefile

43 lines
865 B
Makefile
Raw Normal View History

2020-03-17 04:31:30 +00:00
CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2
2020-04-26 22:14:41 +00:00
PROGRAMS := yaz0 makeromfs elf2rom mkldscript vtxdis
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)
cd ZAPD && $(MAKE)
2020-03-17 04:31:30 +00:00
clean:
$(RM) $(PROGRAMS) $(addsuffix .exe,$(PROGRAMS))
$(MAKE) -C ZAPD clean
2020-03-17 04:31:30 +00:00
distclean: clean
.PHONY: all clean distclean
2020-03-17 04:31:30 +00:00
mkldscript_SOURCES := mkldscript.c util.c
elf2rom_SOURCES := elf2rom.c elf32.c n64chksum.c util.c
yaz0_SOURCES := yaz0tool.c yaz0.c util.c
makeromfs_SOURCES := makeromfs.c n64chksum.c util.c
2020-04-26 22:14:41 +00:00
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))))