Browse Source

improve GNU Makefiles a bit

* unignore type-limits warning
* add the possibility to do `make V=0 >/dev/null` and still get the
  CFLAGS and LDFLAGS that are used while compilation
Steffen Jaeckel 6 years ago
parent
commit
6f3a7c9e3e
2 changed files with 9 additions and 3 deletions
  1. 3 0
      makefile
  2. 6 3
      makefile_include.mk

+ 3 - 0
makefile

@@ -41,6 +41,9 @@ LTC_EXTRALIBS += $(EXTRALIBS)
 
 
 #AES comes in two flavours... enc+dec and enc
 #AES comes in two flavours... enc+dec and enc
 src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
 src/ciphers/aes/aes_enc.o: src/ciphers/aes/aes.c src/ciphers/aes/aes_tab.c
+ifneq ($V,1)
+	@echo "   * ${CC} $@"
+endif
 	${silent} ${CC} ${LTC_CFLAGS} -DENCRYPT_ONLY -c $< -o $@
 	${silent} ${CC} ${LTC_CFLAGS} -DENCRYPT_ONLY -c $< -o $@
 
 
 .c.o:
 .c.o:

+ 6 - 3
makefile_include.mk

@@ -76,7 +76,7 @@ endef
 # by giving them as a parameter to make:
 # by giving them as a parameter to make:
 #  make CFLAGS="-I./src/headers/ -DLTC_SOURCE ..." ...
 #  make CFLAGS="-I./src/headers/ -DLTC_SOURCE ..." ...
 #
 #
-LTC_CFLAGS += -I./src/headers/ -Wall -Wsign-compare -Wshadow -DLTC_SOURCE
+LTC_CFLAGS += -I./src/headers/ -DLTC_SOURCE -Wall -Wsign-compare -Wshadow
 
 
 ifdef OLD_GCC
 ifdef OLD_GCC
 LTC_CFLAGS += -W
 LTC_CFLAGS += -W
@@ -92,8 +92,6 @@ LTC_CFLAGS += -Wdeclaration-after-statement
 LTC_CFLAGS += -Wwrite-strings
 LTC_CFLAGS += -Wwrite-strings
 endif
 endif
 
 
-LTC_CFLAGS += -Wno-type-limits
-
 ifdef LTC_DEBUG
 ifdef LTC_DEBUG
 $(info Debug build)
 $(info Debug build)
 # compile for DEBUGGING (required for ccmalloc checking!!!)
 # compile for DEBUGGING (required for ccmalloc checking!!!)
@@ -147,6 +145,11 @@ endif
 
 
 LTC_LDFLAGS := $(LTC_LDFLAGS) $(LDFLAGS)
 LTC_LDFLAGS := $(LTC_LDFLAGS) $(LDFLAGS)
 
 
+ifeq ($(V)$(filter clean,$(MAKECMDGOALS)),0)
+$(warning CFLAGS=$(LTC_CFLAGS))
+$(warning LDFLAGS=$(LTC_LDFLAGS))
+endif
+
 #List of demo objects
 #List of demo objects
 DSOURCES = $(wildcard demos/*.c)
 DSOURCES = $(wildcard demos/*.c)
 DOBJECTS = $(DSOURCES:.c=.o)
 DOBJECTS = $(DSOURCES:.c=.o)