1 #-----------------------------------------------------------------------------
2 # This code is licensed to you under the terms of the GNU GPL, version 2 or,
3 # at your option, any later version. See the LICENSE.txt file for the text of
5 #-----------------------------------------------------------------------------
11 TARFLAGS
= -C ..
--ignore-failed-read
-rvf
16 VPATH
= ..
/common ..
/zlib
19 LDLIBS
= -L
/opt
/local
/lib
-L
/usr
/local
/lib
-lreadline
-lpthread
-lm
20 LUALIB
= ..
/liblua
/liblua.a
21 LDFLAGS
= $(COMMON_FLAGS
)
22 CFLAGS
= -std
=c99
-D_ISOC99_SOURCE
-I.
-I..
/include -I..
/common
-I..
/zlib
-I
/opt
/local
/include -I..
/liblua
-Wall
$(COMMON_FLAGS
) -g
-O3
23 CXXFLAGS
= -I..
/include -Wall
-O3
26 platform
= $(shell uname
)
27 ifneq (,$(findstring MINGW
,$(platform
)))
30 ifeq ($(platform
),Darwin
)
34 LDLIBS
+= -ltermcap
-lncurses
39 # Check for correctly configured Qt5
40 QTINCLUDES
= $(shell pkg-config
--cflags Qt5Core Qt5Widgets
2>/dev
/null
)
41 QTLDLIBS
= $(shell pkg-config
--libs Qt5Core Qt5Widgets
2>/dev
/null
)
42 MOC
= $(shell pkg-config
--variable
=host_bins Qt5Core
)/moc
43 UIC
= $(shell pkg-config
--variable
=host_bins Qt5Core
)/uic
44 ifeq ($(QTINCLUDES
), )
45 # if Qt5 not found check for correctly configured Qt4
46 QTINCLUDES
= $(shell pkg-config
--cflags QtCore QtGui
2>/dev
/null
)
47 QTLDLIBS
= $(shell pkg-config
--libs QtCore QtGui
2>/dev
/null
)
48 MOC
= $(shell pkg-config
--variable
=moc_location QtCore
)
49 UIC
= $(shell pkg-config
--variable
=uic_location QtCore
)
51 CXXFLAGS
+= -std
=c
++11 -fPIC
53 ifeq ($(QTINCLUDES
), )
54 # if both pkg-config commands failed, search in common places
56 QTINCLUDES
= -I
$(QTDIR
)/include -I
$(QTDIR
)/include/QtCore
-I
$(QTDIR
)/include/QtGui
57 QTLDLIBS
= -L
$(QTDIR
)/lib
-lQtCore4
-lQtGui4
58 ifneq ($(wildcard $(QTDIR
)/include/QtWidgets
),)
59 QTINCLUDES
+= -I
$(QTDIR
)/include/QtWidgets
60 QTLDLIBS
= -L
$(QTDIR
)/lib
-lQt5Widgets
-lQt5Gui
-lQt5Core
61 CXXFLAGS
+= -std
=c
++11 -fPIC
63 MOC
= $(QTDIR
)/bin
/moc
64 UIC
= $(QTDIR
)/bin
/uic
70 QTGUIOBJS
= $(OBJDIR
)/proxgui.o
$(OBJDIR
)/proxguiqt.o
$(OBJDIR
)/proxguiqt.moc.o
73 QTGUIOBJS
= $(OBJDIR
)/guidummy.o
76 # Flags to generate temporary dependency files
77 DEPFLAGS
= -MT
$@
-MMD
-MP
-MF
$(OBJDIR
)/$*.Td
78 # make temporary to final dependeny files after successful compilation
79 POSTCOMPILE
= $(MV
) -f
$(OBJDIR
)/$*.Td
$(OBJDIR
)/$*.d
84 CMDSRCS
= crapto1
/crapto1.c\
88 loclass
/cipherutils.c \
91 loclass
/elite_crack.c\
116 hardnested
/hardnested_bruteforce.c \
158 cpu_arch
= $(shell uname
-m
)
159 ifneq ($(findstring 86, $(cpu_arch
)), )
160 MULTIARCHSRCS
= hardnested
/hardnested_bf_core.c hardnested
/hardnested_bitarray_core.c
162 ifneq ($(findstring 64, $(cpu_arch
)), )
163 MULTIARCHSRCS
= hardnested
/hardnested_bf_core.c hardnested
/hardnested_bitarray_core.c
165 ifeq ($(MULTIARCHSRCS
), )
166 CMDSRCS
+= hardnested
/hardnested_bf_core.c hardnested
/hardnested_bitarray_core.c
169 ZLIBSRCS
= deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
170 ZLIBFLAGS
= -DZ_SOLO
-DZ_PREFIX
-DNO_GZIP
-DZLIB_PM3_TUNED
173 QTGUISRCS
= proxgui.
cpp proxguiqt.
cpp proxguiqt.moc.
cpp guidummy.
cpp
175 COREOBJS
= $(CORESRCS
:%.c
=$(OBJDIR
)/%.o
)
176 CMDOBJS
= $(CMDSRCS
:%.c
=$(OBJDIR
)/%.o
)
177 ZLIBOBJS
= $(ZLIBSRCS
:%.c
=$(OBJDIR
)/%.o
)
178 MULTIARCHOBJS
= $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_NOSIMD.o
) \
179 $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_MMX.o
) \
180 $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_SSE2.o
) \
181 $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_AVX.o
) \
182 $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_AVX2.o
)
184 GCC_GTEQ_490
:= $(shell expr
`gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/'` \
>= 40900)
185 HARD_SWITCH_NOSIMD
= -mno-mmx
-mno-sse2
-mno-avx
-mno-avx2
186 HARD_SWITCH_MMX
= -mmmx
-mno-sse2
-mno-avx
-mno-avx2
187 HARD_SWITCH_SSE2
= -mmmx
-msse2
-mno-avx
-mno-avx2
188 HARD_SWITCH_AVX
= -mmmx
-msse2
-mavx
-mno-avx2
189 HARD_SWITCH_AVX2
= -mmmx
-msse2
-mavx
-mavx2
190 HARD_SWITCH_AVX512
= -mmmx
-msse2
-mavx
-mavx2
-mavx512f
191 ifeq "$(GCC_GTEQ_490)" "1"
192 HARD_SWITCH_NOSIMD
+= -mno-avx512f
193 HARD_SWITCH_MMX
+= -mno-avx512f
194 HARD_SWITCH_SSE2
+= -mno-avx512f
195 HARD_SWITCH_AVX
+= -mno-avx512f
196 HARD_SWITCH_AVX2
+= -mno-avx512f
197 MULTIARCHOBJS
+= $(MULTIARCHSRCS
:%.c
=$(OBJDIR
)/%_AVX512.o
)
200 BINS
= proxmark3 flasher fpga_compress
201 WINBINS
= $(patsubst %, %.exe
, $(BINS
))
202 CLEAN
= $(BINS
) $(WINBINS
) $(COREOBJS
) $(CMDOBJS
) $(ZLIBOBJS
) $(QTGUIOBJS
) $(MULTIARCHOBJS
) $(OBJDIR
)/*.o
*.moc.
cpp ui
/ui_overlays.h
204 # need to assign dependancies to build these first...
205 all: lua_build
$(BINS
)
207 all-static
: LDLIBS
:=-static
$(LDLIBS
)
208 all-static
: proxmark3 flasher fpga_compress
210 proxmark3
: LDLIBS
+=$(LUALIB
) $(QTLDLIBS
)
211 proxmark3
: $(OBJDIR
)/proxmark3.o
$(COREOBJS
) $(CMDOBJS
) $(QTGUIOBJS
) $(MULTIARCHOBJS
) lualibs
/usb_cmd.lua
212 $(LD
) $(LDFLAGS
) $(OBJDIR
)/proxmark3.o
$(COREOBJS
) $(CMDOBJS
) $(QTGUIOBJS
) $(MULTIARCHOBJS
) $(LDLIBS
) -o
$@
214 flasher
: $(OBJDIR
)/flash.o
$(OBJDIR
)/flasher.o
$(COREOBJS
)
215 $(LD
) $(LDFLAGS
) $^
$(LDLIBS
) -o
$@
217 fpga_compress
: $(OBJDIR
)/fpga_compress.o
$(ZLIBOBJS
)
218 $(LD
) $(LDFLAGS
) $(ZLIBFLAGS
) $^
$(LDLIBS
) -o
$@
220 proxgui.
cpp: ui
/ui_overlays.h
222 proxguiqt.moc.
cpp: proxguiqt.h
225 ui
/ui_overlays.h
: ui
/overlays.ui
228 lualibs
/usb_cmd.lua
: ..
/include/usb_cmd.h
229 awk
-f usb_cmd_h2lua.awk
$^
> $@
233 cd ..
/liblua
&& make
clean
236 $(TAR
) $(TARFLAGS
) ..
/proxmark3-
$(platform
)-bin.
tar $(BINS
:%=client
/%) $(WINBINS
:%=client
/%)
239 @echo Compiling liblua
, using platform
$(LUAPLATFORM
)
240 cd ..
/liblua
&& make
$(LUAPLATFORM
)
244 $(OBJDIR
)/%_NOSIMD.o
: %.c
$(OBJDIR
)/%.d
245 $(CC
) $(DEPFLAGS
) $(CFLAGS
) $(HARD_SWITCH_NOSIMD
) -c
-o
$@
$<
247 $(OBJDIR
)/%_MMX.o
: %.c
$(OBJDIR
)/%.d
248 $(CC
) $(DEPFLAGS
) $(CFLAGS
) $(HARD_SWITCH_MMX
) -c
-o
$@
$<
250 $(OBJDIR
)/%_SSE2.o
: %.c
$(OBJDIR
)/%.d
251 $(CC
) $(DEPFLAGS
) $(CFLAGS
) $(HARD_SWITCH_SSE2
) -c
-o
$@
$<
253 $(OBJDIR
)/%_AVX.o
: %.c
$(OBJDIR
)/%.d
254 $(CC
) $(DEPFLAGS
) $(CFLAGS
) $(HARD_SWITCH_AVX
) -c
-o
$@
$<
256 $(OBJDIR
)/%_AVX2.o
: %.c
$(OBJDIR
)/%.d
257 $(CC
) $(DEPFLAGS
) $(CFLAGS
) $(HARD_SWITCH_AVX2
) -c
-o
$@
$<
259 $(OBJDIR
)/%_AVX512.o
: %.c
$(OBJDIR
)/%.d
260 $(CC
) $(DEPFLAGS
) $(CFLAGS
) $(HARD_SWITCH_AVX512
) -c
-o
$@
$<
263 $(OBJDIR
)/%.o
: %.c
$(OBJDIR
)/%.d
264 $(CC
) $(DEPFLAGS
) $(CFLAGS
) $(ZLIBFLAGS
) -c
-o
$@
$<
268 $(OBJDIR
)/%.o
: %.
cpp $(OBJDIR
)/%.d
269 $(CXX
) $(DEPFLAGS
) $(CXXFLAGS
) $(QTINCLUDES
) -c
-o
$@
$<
273 #$(CMDOBJS) $(COREOBJS): $(notdir $(%.c)) %.d
274 # $(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
277 #$(ZLIBOBJS): $(notdir $(%.c)) %.d
278 # $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
281 #$(QTGUIOBJS): $(notdir $(%.cpp)) %.d
282 # $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
285 DEPENDENCY_FILES
= $(patsubst %.c
, $(OBJDIR
)/%.d
, $(CORESRCS
) $(CMDSRCS
) $(ZLIBSRCS
) $(MULTIARCHSRCS
)) \
286 $(patsubst %.
cpp, $(OBJDIR
)/%.d
, $(QTGUISRCS
)) \
287 $(OBJDIR
)/proxmark3.d
$(OBJDIR
)/flash.d
$(OBJDIR
)/flasher.d
$(OBJDIR
)/fpga_compress.d
289 $(DEPENDENCY_FILES
): ;
290 .PRECIOUS
: $(DEPENDENCY_FILES
)
292 -include $(DEPENDENCY_FILES
)