@@ -52,68 +52,71 @@ endif
5252# by giving them as a parameter to make:
5353# make CFLAGS="-I./src/headers/ -DLTC_SOURCE ..." ...
5454#
55- CFLAGS += -I./src/headers/ -Wall -Wsign-compare -Wshadow -DLTC_SOURCE
55+ LTC_CFLAGS += -I./src/headers/ -Wall -Wsign-compare -Wshadow -DLTC_SOURCE
5656
5757ifdef OLD_GCC
58- CFLAGS += -W
58+ LTC_CFLAGS += -W
5959# older GCCs can't handle the "rotate with immediate" ROLc/RORc/etc macros
6060# define this to help
61- CFLAGS += -DLTC_NO_ROLC
61+ LTC_CFLAGS += -DLTC_NO_ROLC
6262else
63- CFLAGS += -Wextra
63+ LTC_CFLAGS += -Wextra
6464# additional warnings
65- CFLAGS += -Wsystem-headers -Wbad-function-cast -Wcast-align
66- CFLAGS += -Wstrict-prototypes -Wpointer-arith
67- CFLAGS += -Wdeclaration-after-statement
65+ LTC_CFLAGS += -Wsystem-headers -Wbad-function-cast -Wcast-align
66+ LTC_CFLAGS += -Wstrict-prototypes -Wpointer-arith
67+ LTC_CFLAGS += -Wdeclaration-after-statement
6868endif
6969
70- CFLAGS += -Wno-type-limits
70+ LTC_CFLAGS += -Wno-type-limits
7171
7272ifdef LTC_DEBUG
7373# compile for DEBUGGING (required for ccmalloc checking!!!)
74- CFLAGS += -g3 -DLTC_NO_ASM
74+ LTC_CFLAGS += -g3 -DLTC_NO_ASM
7575ifneq (,$(strip $(LTC_DEBUG ) ) )
76- CFLAGS += -DLTC_TEST_DBG=$(LTC_DEBUG )
76+ LTC_CFLAGS += -DLTC_TEST_DBG=$(LTC_DEBUG )
7777else
78- CFLAGS += -DLTC_TEST_DBG
78+ LTC_CFLAGS += -DLTC_TEST_DBG
7979endif
8080else
8181
8282ifdef LTC_SMALL
8383# optimize for SIZE
84- CFLAGS += -Os -DLTC_SMALL_CODE
84+ LTC_CFLAGS += -Os -DLTC_SMALL_CODE
8585else
8686
8787ifndef IGNORE_SPEED
8888# optimize for SPEED
89- CFLAGS += -O3 -funroll-loops
89+ LTC_CFLAGS += -O3 -funroll-loops
9090
9191# add -fomit-frame-pointer. hinders debugging!
92- CFLAGS += -fomit-frame-pointer
92+ LTC_CFLAGS += -fomit-frame-pointer
9393endif
9494
9595endif # COMPILE_SMALL
9696endif # COMPILE_DEBUG
9797
9898
9999ifneq ($(findstring clang,$(CC ) ) ,)
100- CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header
100+ LTC_CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header
101101endif
102102ifeq ($(PLATFORM ) , Darwin)
103- CFLAGS += -Wno-nullability-completeness
103+ LTC_CFLAGS += -Wno-nullability-completeness
104104endif
105105
106106
107107GIT_VERSION := $(shell [ -e .git ] && { printf git- ; git describe --tags --always --dirty ; } || echo $(VERSION ) )
108108ifneq ($(GIT_VERSION ) ,)
109- CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION ) \"
109+ LTC_CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION ) \"
110110endif
111111
112+ LTC_CFLAGS := $(LTC_CFLAGS ) $(CFLAGS )
112113
113- ifneq ($(findstring -DLTC_PTHREAD,$(CFLAGS ) ) ,)
114- LDFLAGS += -pthread
114+ ifneq ($(findstring -DLTC_PTHREAD,$(LTC_CFLAGS ) ) ,)
115+ LTC_LDFLAGS += -pthread
115116endif
116117
118+ LTC_LDFLAGS := $(LTC_LDFLAGS ) $(LDFLAGS )
119+
117120# List of demo objects
118121DSOURCES = $(wildcard demos/* .c)
119122DOBJECTS = $(DSOURCES:.c=.o )
@@ -340,8 +343,8 @@ src/hashes/sha2/sha512_224.o: src/hashes/sha2/sha512.c src/hashes/sha2/sha512_22
340343src/hashes/sha2/sha512_256.o : src/hashes/sha2/sha512.c src/hashes/sha2/sha512_256.c
341344src/hashes/sha2/sha256.o : src/hashes/sha2/sha256.c src/hashes/sha2/sha224.c
342345
343- $(DOBJECTS ) : CFLAGS + = -Itests
344- $(TOBJECTS ) : CFLAGS + = -Itests
346+ $(DOBJECTS ) : LTC_CFLAGS : = -Itests $( LTC_CFLAGS )
347+ $(TOBJECTS ) : LTC_CFLAGS : = -Itests $( LTC_CFLAGS )
345348
346349# This rule makes the libtomcrypt library.
347350library : $(LIBNAME )
0 commit comments