Default to CC=gcc but allow to define other values

so it is possible to
> CC=clang make        (environment)
or
> make CC=gcc-5        (command-line)
This commit is contained in:
Thomas Bernard 2018-05-15 11:45:58 +02:00
parent d4746ea72e
commit 0890c4490d
No known key found for this signature in database
GPG Key ID: 0FF11B67A5C0863C

View File

@ -64,6 +64,11 @@ TAR = tar
# Note : --transform option was added in GNU tar version 1.15.91 # Note : --transform option was added in GNU tar version 1.15.91
TARTRANSFORM = --strip=1 --transform 's,^,grafx2/,g' TARTRANSFORM = --strip=1 --transform 's,^,grafx2/,g'
# default to gcc compiler
ifeq (default,$(origin CC))
CC = gcc
endif
# There is no uname under windows, but we can guess we are there with the COMSPEC env.var # There is no uname under windows, but we can guess we are there with the COMSPEC env.var
# Windows specific # Windows specific
ifdef COMSPEC ifdef COMSPEC
@ -75,7 +80,6 @@ ifdef COMSPEC
COPT = -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -g -ggdb `sdl-config --cflags` $(TTFCOPT) $(JOYCOPT) $(LUACOPT) COPT = -W -Wall -Wdeclaration-after-statement -O$(OPTIM) -g -ggdb `sdl-config --cflags` $(TTFCOPT) $(JOYCOPT) $(LUACOPT)
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng -lz $(LUALOPT) LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng -lz $(LUALOPT)
LUALOPT = -llua LUALOPT = -llua
CC = gcc
OBJDIR = ../obj/win32 OBJDIR = ../obj/win32
# Resources (icon) # Resources (icon)
WINDRES = windres.exe WINDRES = windres.exe
@ -98,7 +102,6 @@ else
BIN = ../bin/grafx2 BIN = ../bin/grafx2
COPT = -Wall -gstabs $(shell sdl-config --cflags) $(TTFCOPT) COPT = -Wall -gstabs $(shell sdl-config --cflags) $(TTFCOPT)
LOPT = $(shell sdl-config --libs) -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lft2 LOPT = $(shell sdl-config --libs) -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lft2
CC = gcc
OBJDIR = ../obj/amiga OBJDIR = ../obj/amiga
ZIP = lha ZIP = lha
ZIPOPT = a ZIPOPT = a
@ -198,7 +201,6 @@ endif
COPT += -DENABLE_FILENAMES_ICONV COPT += -DENABLE_FILENAMES_ICONV
LOPT += -liconv LOPT += -liconv
# Use gcc for compiling. Use ncc to build a callgraph and analyze the code. # Use gcc for compiling. Use ncc to build a callgraph and analyze the code.
CC = gcc
#CC = nccgen -ncgcc -ncld -ncfabs #CC = nccgen -ncgcc -ncld -ncfabs
OBJDIR = ../obj/macosx OBJDIR = ../obj/macosx
PLATFORMOBJ = SDLMain.o PLATFORMOBJ = SDLMain.o
@ -215,7 +217,6 @@ endif
BIN = ../bin/grafx2 BIN = ../bin/grafx2
COPT = -Wall -g $(shell sdl-config --cflags) $(TTFCOPT) COPT = -Wall -g $(shell sdl-config --cflags) $(TTFCOPT)
LOPT = -lSDL_image $(shell sdl-config --libs) -lpng -ljpeg -lz $(TTFLOPT) -lfreetype2shared LOPT = -lSDL_image $(shell sdl-config --libs) -lpng -ljpeg -lz $(TTFLOPT) -lfreetype2shared
CC = gcc
OBJDIR = ../obj/aros OBJDIR = ../obj/aros
STRIP = strip --strip-unneeded --remove-section .comment STRIP = strip --strip-unneeded --remove-section .comment
ZIP = lha ZIP = lha
@ -231,7 +232,6 @@ endif
BIN = ../bin/grafx2 BIN = ../bin/grafx2
COPT = -Wall -gstabs $(shell sdl-config --cflags) $(TTFCOPT) COPT = -Wall -gstabs $(shell sdl-config --cflags) $(TTFCOPT)
LOPT = -lSDL_image $(shell sdl-config --libs) -lpng -ljpeg -lz $(TTFLOPT) LOPT = -lSDL_image $(shell sdl-config --libs) -lpng -ljpeg -lz $(TTFLOPT)
CC = gcc
OBJDIR = ../obj/morphos OBJDIR = ../obj/morphos
ZIP = lha ZIP = lha
ZIPOPT = a ZIPOPT = a
@ -247,7 +247,6 @@ endif
BIN = ../bin/grafx2 BIN = ../bin/grafx2
COPT = -W -Wall -g $(shell sdl-config --cflags) $(TTFCOPT) -I/boot/home/config/include COPT = -W -Wall -g $(shell sdl-config --cflags) $(TTFCOPT) -I/boot/home/config/include
LOPT = $(shell sdl-config --libs) -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) LOPT = $(shell sdl-config --libs) -lSDL_image -lpng -ljpeg -lz $(TTFLOPT)
CC = gcc
OBJDIR = ../obj/beos OBJDIR = ../obj/beos
ZIP = zip ZIP = zip
@ -271,7 +270,6 @@ endif
COPT = -W -Wall -g $(shell sdl-config --cflags) $(TTFCOPT) -I/boot/common/include $(LUACOPT) COPT = -W -Wall -g $(shell sdl-config --cflags) $(TTFCOPT) -I/boot/common/include $(LUACOPT)
COPT += -DENABLE_FILENAMES_ICONV COPT += -DENABLE_FILENAMES_ICONV
LOPT = $(shell sdl-config --libs) -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lfreetype -lbe $(LUALOPT) -liconv LOPT = $(shell sdl-config --libs) -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lfreetype -lbe $(LUALOPT) -liconv
CC = gcc
#Append the gcc kind to the objdir (gcc2 or gcc4) to avoid conflicts when switching from one to other. #Append the gcc kind to the objdir (gcc2 or gcc4) to avoid conflicts when switching from one to other.
OBJKIND = $(shell gcc -dumpversion) OBJKIND = $(shell gcc -dumpversion)
OBJDIR = ../obj/haiku/$(OBJKIND) OBJDIR = ../obj/haiku/$(OBJKIND)
@ -287,7 +285,6 @@ endif
BIN = ../bin/grafx2 BIN = ../bin/grafx2
COPT = -W -Wall -Wdeclaration-after-statement -g $(shell sdl-config --cflags) $(TTFCOPT) COPT = -W -Wall -Wdeclaration-after-statement -g $(shell sdl-config --cflags) $(TTFCOPT)
LOPT = $(shell sdl-config --libs) -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) LOPT = $(shell sdl-config --libs) -lSDL_image -lpng -ljpeg -lz $(TTFLOPT)
CC = gcc
OBJDIR = ../obj/skyos OBJDIR = ../obj/skyos
ZIP = zip ZIP = zip
@ -306,7 +303,6 @@ endif
OBJDIR = ../obj/unix OBJDIR = ../obj/unix
FCLOPT = -lfontconfig FCLOPT = -lfontconfig
COPT += -DUSE_FC COPT += -DUSE_FC
CC = gcc
else else
ifeq ($(PLATFORM),FreeMiNT) #10 ifeq ($(PLATFORM),FreeMiNT) #10
#Atari FreeMiNT/TOS specific #Atari FreeMiNT/TOS specific
@ -316,7 +312,6 @@ endif
CP = cp CP = cp
ZIP = zip ZIP = zip
PLATFORMFILES = ../share/grafx2/gfx2.png PLATFORMFILES = ../share/grafx2/gfx2.png
CC = gcc
BIN = ../bin/grafx2.ttp BIN = ../bin/grafx2.ttp
LUALOPT = -llua LUALOPT = -llua
OBJDIR = ../obj/m68k-atari-mint OBJDIR = ../obj/m68k-atari-mint
@ -341,7 +336,6 @@ endif
BIN = ../bin/grafx2 BIN = ../bin/grafx2
COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -g `sdl-config --cflags` -I/resources/indexes/include/SDL $(TTFCOPT) $(LUACOPT) $(JOYCOPT) -O$(OPTIM) COPT = -W -Wall -Wdeclaration-after-statement -std=c99 -g `sdl-config --cflags` -I/resources/indexes/include/SDL $(TTFCOPT) $(LUACOPT) $(JOYCOPT) -O$(OPTIM)
LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng -lz $(LUALOPT) -lm LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng -lz $(LUALOPT) -lm
CC = gcc
OBJDIR = ../obj/syllable OBJDIR = ../obj/syllable
FCLOPT = FCLOPT =
else else
@ -464,7 +458,6 @@ endif
LOPT = $(shell sdl-config --libs) -lSDL_image $(TTFLOPT) LOPT = $(shell sdl-config --libs) -lSDL_image $(TTFLOPT)
LOPT += $(shell pkg-config --libs libpng) LOPT += $(shell pkg-config --libs libpng)
LOPT += $(LUALOPT) -lm LOPT += $(LUALOPT) -lm
CC = gcc
OBJDIR = ../obj/unix OBJDIR = ../obj/unix
FCLOPT = -lfontconfig FCLOPT = -lfontconfig
COPT += -DUSE_FC COPT += -DUSE_FC