diff --git a/tools/Makefile b/tools/Makefile index 9b545d1a83..d0af5c3715 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,7 +1,21 @@ -CC := gcc CFLAGS := -Wall -Wextra -pedantic -std=c99 -g -O2 PROGRAMS := yaz0 makeromfs elf2rom mkldscript vtxdis -ZAPD := ZAPD/ZAPD.out + +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) diff --git a/tools/vtxdis.c b/tools/vtxdis.c index 1ba6969635..8debd89e0c 100644 --- a/tools/vtxdis.c +++ b/tools/vtxdis.c @@ -254,4 +254,4 @@ int main(int argc, char **argv) } return 0; -} \ No newline at end of file +}