diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index b23747b72..0bbf1067c 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -12,8 +12,6 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0") set(CMAKE_INCLUDE_CURRENT_DIR ON) endif() -set(CMAKE_CXX_STANDARD 14) - if(APPLE AND EXISTS /usr/local/opt/qt5) # Homebrew installs Qt5 (up to at least 5.11.0) in # /usr/local/qt5. Ensure that it can be found by CMake diff --git a/client/Makefile b/client/Makefile index cef9939f8..ed133eb36 100644 --- a/client/Makefile +++ b/client/Makefile @@ -57,7 +57,7 @@ LIBS = -I$(LUALIBPATH) -I$(MBEDTLSLIBPATH) -I$(JANSSONLIBPATH) -I$(CBORLIBPATH) INCLUDES_CLIENT = -I./src -I../include -I../common -I../common_fpga $(LIBS) CFLAGS ?= -Wall -Werror -O3 # We cannot just use CFLAGS+=... because it has impact on sub-makes if CFLAGS is defined in env: -PM3CFLAGS = $(CFLAGS) -std=c99 $(INCLUDES_CLIENT) +PM3CFLAGS = $(CFLAGS) $(INCLUDES_CLIENT) # WIP Testing #PM3CFLAGS = $(CFLAGS) -std=c11 -pedantic $(INCLUDES_CLIENT) PREFIX ?= /usr/local @@ -101,7 +101,7 @@ ifneq ($(SKIPQT),1) MOC = $(shell pkg-config --variable=moc_location QtCore) UIC = $(shell pkg-config --variable=uic_location QtCore) else - PM3CXXFLAGS += -std=c++11 -fPIC + PM3CXXFLAGS += -fPIC endif ifeq ($(QTINCLUDES), ) # if both pkg-config commands failed, search in common places @@ -111,7 +111,7 @@ ifneq ($(SKIPQT),1) ifneq ($(wildcard $(QTDIR)/include/QtWidgets),) QTINCLUDES += -I$(QTDIR)/include/QtWidgets QTLDLIBS = -L$(QTDIR)/lib -lQt5Widgets -lQt5Gui -lQt5Core - PM3CXXFLAGS += -std=c++11 -fPIC + PM3CXXFLAGS += -fPIC endif MOC = $(QTDIR)/bin/moc UIC = $(QTDIR)/bin/uic diff --git a/client/deps/amiibo.cmake b/client/deps/amiibo.cmake index dd185fc91..857074f9e 100644 --- a/client/deps/amiibo.cmake +++ b/client/deps/amiibo.cmake @@ -5,8 +5,6 @@ #amiitool.c $(MYSRCS) ../../../../common/../../commonutil.c ../ui.c -lreadline -lm ../../../../common/mbedtls/libmbedtls.a \ #-o amiitool -set_property(SOURCE PROPERTY C_STANDARD 99) - add_library(amiibo STATIC amiitool/amiibo.c amiitool/drbg.c diff --git a/client/deps/amiitool/Makefile b/client/deps/amiitool/Makefile index ff2c0da88..7fe532878 100644 --- a/client/deps/amiitool/Makefile +++ b/client/deps/amiitool/Makefile @@ -1,6 +1,6 @@ MYSRCPATHS = MYINCLUDES = -I. -I.. -I../jansson -I../../../common -I../../../include -MYCFLAGS = -std=c99 -D_ISOC99_SOURCE +MYCFLAGS = MYDEFS = MYSRCS = \ amiibo.c \ diff --git a/client/deps/cliparser/Makefile b/client/deps/cliparser/Makefile index e1c5b2356..7f4409de0 100644 --- a/client/deps/cliparser/Makefile +++ b/client/deps/cliparser/Makefile @@ -1,6 +1,6 @@ MYSRCPATHS = MYINCLUDES = -I../../../common -I../../../include -I../../src -MYCFLAGS = -std=c99 -D_ISOC99_SOURCE +MYCFLAGS = MYDEFS = MYSRCS = \ argtable3.c \ diff --git a/client/deps/hardnested.cmake b/client/deps/hardnested.cmake index b9ca14dab..8945d68a8 100644 --- a/client/deps/hardnested.cmake +++ b/client/deps/hardnested.cmake @@ -1,5 +1,3 @@ -set_property(SOURCE PROPERTY C_STANDARD 99) - add_library(hardnested_nosimd OBJECT hardnested/hardnested_bf_core.c hardnested/hardnested_bitarray_core.c) diff --git a/client/deps/hardnested/Makefile b/client/deps/hardnested/Makefile index 84c4ce842..483a3283b 100644 --- a/client/deps/hardnested/Makefile +++ b/client/deps/hardnested/Makefile @@ -1,6 +1,6 @@ MYSRCPATHS = MYINCLUDES = -I../../../common -I../../../include -I../../src -I../jansson -MYCFLAGS = -std=c99 -D_ISOC99_SOURCE +MYCFLAGS = MYDEFS = MYSRCS = hardnested_bruteforce.c diff --git a/client/deps/hardnested/hardnested_tables.c b/client/deps/hardnested/hardnested_tables.c index 91e3b3cd3..d3c620fe5 100644 --- a/client/deps/hardnested/hardnested_tables.c +++ b/client/deps/hardnested/hardnested_tables.c @@ -20,7 +20,7 @@ //----------------------------------------------------------------------------- // To compile it: -// gcc -std=c99 -I ../../common -o hardnested_tables hardnested_tables.c +// gcc -I../../../common -I../../../include -o hardnested_tables hardnested_tables.c #include #include diff --git a/client/deps/jansson.cmake b/client/deps/jansson.cmake index b2042c6b4..216f7a830 100644 --- a/client/deps/jansson.cmake +++ b/client/deps/jansson.cmake @@ -1,5 +1,3 @@ -set_property(SOURCE PROPERTY C_STANDARD 99) - add_library(jansson STATIC jansson/dump.c jansson/error.c diff --git a/client/deps/jansson/Makefile b/client/deps/jansson/Makefile index 111aed087..152e8bcb9 100644 --- a/client/deps/jansson/Makefile +++ b/client/deps/jansson/Makefile @@ -1,6 +1,6 @@ MYSRCPATHS = MYINCLUDES = -I. -MYCFLAGS = -std=c99 -D_ISOC99_SOURCE -Wno-unused-function +MYCFLAGS = -Wno-unused-function MYDEFS = -DHAVE_STDINT_H MYSRCS = \ dump.c \ diff --git a/client/deps/liblua/Makefile b/client/deps/liblua/Makefile index 692684186..54e45185b 100644 --- a/client/deps/liblua/Makefile +++ b/client/deps/liblua/Makefile @@ -1,7 +1,6 @@ MYSRCPATHS = MYINCLUDES = -I. -# Lua lib is not ready for C99 style... -#MYCFLAGS = -std=c99 -D_ISOC99_SOURCE +# Lua lib requires GNU extensions (implicit declarations of functions): -std=gnu99 or -std=gnu11 MYCFLAGS = MYDEFS = -DLUA_COMPAT_ALL $(SYSCFLAGS) MYSRCS = lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c \ diff --git a/client/deps/mbedtls.cmake b/client/deps/mbedtls.cmake index 13b08bec0..932c1757c 100644 --- a/client/deps/mbedtls.cmake +++ b/client/deps/mbedtls.cmake @@ -1,5 +1,3 @@ -set_property(SOURCE PROPERTY C_STANDARD 99) - add_library(mbedtls STATIC ../../common/mbedtls/aes.c ../../common/mbedtls/asn1parse.c diff --git a/client/deps/reveng.cmake b/client/deps/reveng.cmake index 0bf84d05a..0d24c9d49 100644 --- a/client/deps/reveng.cmake +++ b/client/deps/reveng.cmake @@ -1,5 +1,3 @@ -set_property(SOURCE PROPERTY C_STANDARD 99) - add_library(reveng STATIC reveng/bmpbit.c reveng/cli.c diff --git a/client/deps/reveng/Makefile b/client/deps/reveng/Makefile index 93c363d70..1794b0bdb 100644 --- a/client/deps/reveng/Makefile +++ b/client/deps/reveng/Makefile @@ -5,7 +5,7 @@ MYSRCPATHS = MYINCLUDES = -I../cliparser -MYCFLAGS = -std=c99 -D_ISOC99_SOURCE +MYCFLAGS = MYDEFS = -DPRESETS MYSRCS = \ bmpbit.c \ diff --git a/client/deps/tinycbor/Makefile b/client/deps/tinycbor/Makefile index 713b6e428..99039ac98 100644 --- a/client/deps/tinycbor/Makefile +++ b/client/deps/tinycbor/Makefile @@ -1,7 +1,6 @@ MYSRCPATHS = MYINCLUDES = # Strange errors on Mingw when compiling with C99 -#MYCFLAGS = -std=c99 -D_ISOC99_SOURCE MYCFLAGS = MYDEFS = MYSRCS = \ diff --git a/client/deps/zlib.cmake b/client/deps/zlib.cmake index 882022ab5..dc6044f80 100644 --- a/client/deps/zlib.cmake +++ b/client/deps/zlib.cmake @@ -1,5 +1,3 @@ -set_property(SOURCE PROPERTY C_STANDARD 99) - add_library(z STATIC ../../common/zlib/deflate.c ../../common/zlib/adler32.c diff --git a/common/mbedtls/Makefile b/common/mbedtls/Makefile index 52663d67e..be5f08a0a 100644 --- a/common/mbedtls/Makefile +++ b/common/mbedtls/Makefile @@ -1,6 +1,6 @@ MYSRCPATHS = MYINCLUDES = -I. -I.. -MYCFLAGS = -std=c99 -D_ISOC99_SOURCE +MYCFLAGS = MYDEFS = MYSRCS = \ aes.c \ diff --git a/common/zlib/Makefile b/common/zlib/Makefile index b62071d5d..acc35bf42 100644 --- a/common/zlib/Makefile +++ b/common/zlib/Makefile @@ -1,7 +1,7 @@ MYSRCPATHS = ../../common/zlib MYSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c MYINCLUDES = -I../../common/zlib -MYCFLAGS = -std=c99 -D_ISOC99_SOURCE +MYCFLAGS = MYDEFS = -DZ_SOLO -DNO_GZIP -DZLIB_PM3_TUNED #-DDEBUG -Dverbose=1 diff --git a/tools/mfkey/Makefile b/tools/mfkey/Makefile index a7b006f6e..fd69207a7 100644 --- a/tools/mfkey/Makefile +++ b/tools/mfkey/Makefile @@ -1,7 +1,7 @@ MYSRCPATHS = ../../common ../../common/crapto1 MYSRCS = crypto1.c crapto1.c bucketsort.c MYINCLUDES = -I../../include -I../../common -MYCFLAGS = -std=c99 -D_ISOC99_SOURCE +MYCFLAGS = MYDEFS = BINS = mfkey32 mfkey32v2 mfkey64 @@ -9,6 +9,13 @@ INSTALLTOOLS = $(BINS) include ../../Makefile.host +# checking platform can be done only after Makefile.host +ifneq (,$(findstring MINGW,$(platform))) + # Mingw uses by default Microsoft printf, we want the GNU printf (e.g. for %z) + # and setting _ISOC99_SOURCE sets internally __USE_MINGW_ANSI_STDIO=1 + CFLAGS += -D_ISOC99_SOURCE +endif + mfkey32 : $(OBJDIR)/mfkey32.o $(MYOBJS) mfkey32v2 : $(OBJDIR)/mfkey32v2.o $(MYOBJS) mfkey64 : $(OBJDIR)/mfkey64.o $(MYOBJS) diff --git a/tools/nonce2key/Makefile b/tools/nonce2key/Makefile index 77dc18099..a4b0bde05 100644 --- a/tools/nonce2key/Makefile +++ b/tools/nonce2key/Makefile @@ -1,7 +1,7 @@ MYSRCPATHS = ../../common ../../common/crapto1 MYSRCS = crypto1.c crapto1.c bucketsort.c MYINCLUDES = -I../../include -I../../common -MYCFLAGS = -std=c99 -D_ISOC99_SOURCE +MYCFLAGS = MYDEFS = BINS = nonce2key @@ -9,4 +9,11 @@ INSTALLTOOLS = $(BINS) include ../../Makefile.host +# checking platform can be done only after Makefile.host +ifneq (,$(findstring MINGW,$(platform))) + # Mingw uses by default Microsoft printf, we want the GNU printf (e.g. for %z) + # and setting _ISOC99_SOURCE sets internally __USE_MINGW_ANSI_STDIO=1 + CFLAGS += -D_ISOC99_SOURCE +endif + nonce2key : $(OBJDIR)/nonce2key.o $(MYOBJS)