From e28cf5406b25707338458a3f49125b38750c8627 Mon Sep 17 00:00:00 2001 From: aaaaaa123456789 Date: Tue, 6 Aug 2019 20:30:57 -0300 Subject: [PATCH] Fix Makefiles to account for the $CC and $CXX environment variables --- Makefile | 15 ++++++++++++++- tools/aif2pcm/Makefile | 2 +- tools/bin2c/Makefile | 2 +- tools/gbafix/Makefile | 2 +- tools/gbagfx/Makefile | 2 +- tools/jsonproc/Makefile | 2 +- tools/mapjson/Makefile | 2 +- tools/mid2agb/Makefile | 2 +- tools/preproc/Makefile | 2 +- tools/ramscrgen/Makefile | 2 +- tools/rsfont/Makefile | 2 +- tools/scaninc/Makefile | 2 +- 12 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 65a4aa7bd1..5a8af32a97 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,17 @@ TOOLCHAIN := $(DEVKITARM) + +ifeq ($(CC),) +HOSTCC := gcc +else +HOSTCC := $(CC) +endif + +ifeq ($(CXX),) +HOSTCXX := g++ +else +HOSTCXX := $(CXX) +endif + ifneq (,$(wildcard $(TOOLCHAIN)/base_tools)) include $(TOOLCHAIN)/base_tools else @@ -136,7 +149,7 @@ all: rom tools: $(TOOLDIRS) $(TOOLDIRS): - @$(MAKE) -C $@ + @$(MAKE) -C $@ CC=$(HOSTCC) CXX=$(HOSTCXX) rom: $(ROM) diff --git a/tools/aif2pcm/Makefile b/tools/aif2pcm/Makefile index af7d19fe90..77df291527 100644 --- a/tools/aif2pcm/Makefile +++ b/tools/aif2pcm/Makefile @@ -1,4 +1,4 @@ -CC = gcc +CC ?= gcc CFLAGS = -Wall -Wextra -Wno-switch -Werror -std=c11 -O2 diff --git a/tools/bin2c/Makefile b/tools/bin2c/Makefile index ab11e1b61a..52806e39c6 100644 --- a/tools/bin2c/Makefile +++ b/tools/bin2c/Makefile @@ -1,4 +1,4 @@ -CC = gcc +CC ?= gcc CFLAGS = -Wall -Wextra -Werror -std=c11 -O2 diff --git a/tools/gbafix/Makefile b/tools/gbafix/Makefile index 5b410da08f..91a60a9e4c 100644 --- a/tools/gbafix/Makefile +++ b/tools/gbafix/Makefile @@ -1,4 +1,4 @@ -CC = gcc +CC ?= gcc .PHONY: all clean SRCS = gbafix.c diff --git a/tools/gbagfx/Makefile b/tools/gbagfx/Makefile index 339585b92a..d9c219587b 100644 --- a/tools/gbagfx/Makefile +++ b/tools/gbagfx/Makefile @@ -1,4 +1,4 @@ -CC = gcc +CC ?= gcc CFLAGS = -Wall -Wextra -Werror -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK diff --git a/tools/jsonproc/Makefile b/tools/jsonproc/Makefile index 721da10252..47198b171e 100755 --- a/tools/jsonproc/Makefile +++ b/tools/jsonproc/Makefile @@ -1,4 +1,4 @@ -CXX := g++ +CXX ?= g++ CXXFLAGS := -Wall -std=c++11 -O2 diff --git a/tools/mapjson/Makefile b/tools/mapjson/Makefile index 9a49be506e..c1f703f9fe 100644 --- a/tools/mapjson/Makefile +++ b/tools/mapjson/Makefile @@ -1,4 +1,4 @@ -CXX := g++ +CXX ?= g++ CXXFLAGS := -Wall -std=c++11 -O2 diff --git a/tools/mid2agb/Makefile b/tools/mid2agb/Makefile index 77f96db5af..451d4b39fb 100644 --- a/tools/mid2agb/Makefile +++ b/tools/mid2agb/Makefile @@ -1,4 +1,4 @@ -CXX := g++ +CXX ?= g++ CXXFLAGS := -std=c++11 -O2 -Wall -Wno-switch -Werror diff --git a/tools/preproc/Makefile b/tools/preproc/Makefile index 63dedda1f0..8c48afea2a 100644 --- a/tools/preproc/Makefile +++ b/tools/preproc/Makefile @@ -1,4 +1,4 @@ -CXX := g++ +CXX ?= g++ CXXFLAGS := -std=c++11 -O2 -Wall -Wno-switch -Werror diff --git a/tools/ramscrgen/Makefile b/tools/ramscrgen/Makefile index 858db1a778..4e901a29c1 100644 --- a/tools/ramscrgen/Makefile +++ b/tools/ramscrgen/Makefile @@ -1,4 +1,4 @@ -CXX := g++ +CXX ?= g++ CXXFLAGS := -std=c++11 -O2 -Wall -Wno-switch -Werror diff --git a/tools/rsfont/Makefile b/tools/rsfont/Makefile index abe1cab518..930a92b36e 100644 --- a/tools/rsfont/Makefile +++ b/tools/rsfont/Makefile @@ -1,4 +1,4 @@ -CC = gcc +CC ?= gcc CFLAGS = -Wall -Wextra -Werror -std=c11 -O2 -DPNG_SKIP_SETJMP_CHECK diff --git a/tools/scaninc/Makefile b/tools/scaninc/Makefile index 1516f159cb..52e663d8da 100644 --- a/tools/scaninc/Makefile +++ b/tools/scaninc/Makefile @@ -1,4 +1,4 @@ -CXX = g++ +CXX ?= g++ CXXFLAGS = -Wall -Werror -std=c++11 -O2