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 65a4aa7bd..5a8af32a9 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 af7d19fe9..77df29152 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 ab11e1b61..52806e39c 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 5b410da08..91a60a9e4 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 339585b92..d9c219587 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 721da1025..47198b171 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 9a49be506..c1f703f9f 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 77f96db5a..451d4b39f 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 63dedda1f..8c48afea2 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 858db1a77..4e901a29c 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 abe1cab51..930a92b36 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 1516f159c..52e663d8d 100644 --- a/tools/scaninc/Makefile +++ b/tools/scaninc/Makefile @@ -1,4 +1,4 @@ -CXX = g++ +CXX ?= g++ CXXFLAGS = -Wall -Werror -std=c++11 -O2