CFLAGS, CCFLAGS, CXXFLAGS - o que exatamente essas variáveis controlam?

stou usando o GNU make para compilar meu código C ++ e gostaria de entender como tornar minhas compilações personalizávei

Eu li em lugares diferentes queCFLAGS, CCFLAGS eCXXFLAGS são usados para esse fim. Então, como devo usá-los? Se eu tiver argumentos de linha de comando adicionais para o compilador, devo anexá-los aCFLAGS ou anexá-los? Existe uma prática comum?

Por que as três variáveis diferentes? Suponho que o compilador C deve obterCFLAGS eCCFLAGS, enquanto o compilador C ++ deve obterCFLAGS eCXXFLAGS - eu entendi direito

O usuário humano deve definir essas variáveis? Faça ferramentas automáticas automake, autoconf, etc) defini-los? O sistema linux que devo usar não define nenhuma dessas variáveis - isso é típic

Atualmente, meu Makefile se parece com isso, e eu sinto que é um pouco sujo:

ifdef code_coverage
    GCOV_FLAG := -fprofile-arcs -ftest-coverage
else
    GCOV_FLAG :=
endif

WFLAGS := -Wall

INC_FLAGS := -Istuff -Imore_stuff -Ietc

CCFLAGSINT := -O3 $(WFLAGS) $(INC_FLAGS) $(CCFLAGS)

... (somewhere in the makefile, the command-line for compilation looks like this)
    $(CC) $(CCFLAGSINT) -c 
ifdef code_coverage
    GCOV_FLAG := -fprofile-arcs -ftest-coverage
else
    GCOV_FLAG :=
endif

WFLAGS := -Wall

INC_FLAGS := -Istuff -Imore_stuff -Ietc

CCFLAGSINT := -O3 $(WFLAGS) $(INC_FLAGS) $(CCFLAGS)

... (somewhere in the makefile, the command-line for compilation looks like this)
    $(CC) $(CCFLAGSINT) -c $< -o $@

... (somewhere in the makefile, the command-line for linking looks like this)
    $(CC) $(GCOV_FLAG) $(CCFLAGSINT) $(OBJLIST) $(LDFLAGS) -o $@
lt; -o $@ ... (somewhere in the makefile, the command-line for linking looks like this) $(CC) $(GCOV_FLAG) $(CCFLAGSINT) $(OBJLIST) $(LDFLAGS) -o $@

Tenho certeza de que não há bugs aqui; o Makefile funciona muito bem. Mas há algo que vá contra as convenções (comoCCFLAGSINT - devo substituirCCFLAGS em vez de? OuCXXFLAGS? FUD!)

Peço desculpa por tantas questões; obviamente você não responderá a todas, mas espero que as respostas me ajudem a entender a idéia geral por trás dessas configuraçõe

questionAnswers(2)

yourAnswerToTheQuestion