diff --git a/Tuprules.tup b/Tuprules.tup index 588d7d2f4..907befbf1 100644 --- a/Tuprules.tup +++ b/Tuprules.tup @@ -6,17 +6,6 @@ else TARGET = @(TUP_PLATFORM) endif -ifdef CC -CC = @(CC) -else -ifeq ($(TARGET),win32) -CC = x86_64-w64-mingw32-gcc -CC32 = i686-w64-mingw32-gcc -else -CC = gcc -endif -endif - ifeq (@(TUP_DEBUG),y) CFLAGS += -Og else @@ -88,11 +77,24 @@ endif !dot = |> ^ DOT %f^ dot -Efontname="Vernada, serif" -Nfontname="Vernada, serif" -Efontsize=10 -Nfontsize=10 -Tpng %f > %o |> !cp = |> ^ CP %f -> %o^ cp %f %o |> +# Default to using gcc to compile. This is overridden on some OSes in the +# included $(TARGET).tup file, and can be overridden by the user in the +# tup.config file by setting CONFIG_CC (and/or CONFIG_CC32 on Windows). +CC = gcc + TUP_MONITOR = null TUP_SUID_GROUP = root TUP_USE_SYSTEM_PCRE = y include $(TARGET).tup +ifdef CC +CC = @(CC) +endif + +ifdef CC32 +CC32 = @(CC32) +endif + ifdef TUP_USE_SYSTEM_PCRE use_system_pcre = @(TUP_USE_SYSTEM_PCRE) else diff --git a/build.sh b/build.sh index 5ac9aa6f2..62bb362a6 100755 --- a/build.sh +++ b/build.sh @@ -30,7 +30,7 @@ else exit 1 fi LDFLAGS="$LDFLAGS -lm" -: ${CC:=gcc} +default_cc=gcc case "$os" in Linux) plat_files="$plat_files ../src/compat/dummy.c" @@ -47,13 +47,13 @@ case "$os" in plat_files="$plat_files ../src/compat/dummy.c" plat_files="$plat_files ../src/compat/clearenv.c " plat_cflags="$plat_cflags -include ../src/compat/macosx.h" - CC=clang + default_cc=clang ;; FreeBSD) plat_files="$plat_files ../src/compat/dummy.c" plat_files="$plat_files ../src/compat/utimensat_linux.c" plat_files="$plat_files ../src/compat/clearenv.c" - CC=clang + default_cc=clang ;; NetBSD) plat_files="$plat_files ../src/compat/dummy.c" @@ -61,6 +61,7 @@ case "$os" in plat_cflags="$plat_cflags -include ../src/compat/netbsd.h" ;; esac +: ${CC:=$default_cc} rm -rf build echo " mkdir build" diff --git a/win32.tup b/win32.tup index 6bfd45d34..ddce44ad6 100644 --- a/win32.tup +++ b/win32.tup @@ -1,6 +1,5 @@ -ifdef CC32 -CC32 = @(CC32) -endif +CC = x86_64-w64-mingw32-gcc +CC32 = i686-w64-mingw32-gcc # Compatibility function prototypes and include path for wrapper functions CFLAGS += -include $(TUP_CWD)/src/compat/win32/mingw.h