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
= -std
=c
++11 -fPIC
-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 ifeq ($(QTINCLUDES
), )
44 # if Qt5 not found Check for correctly configured Qt4
45 QTINCLUDES
= $(shell pkg-config
--cflags QtCore QtGui
2>/dev
/null
)
46 QTLDLIBS
= $(shell pkg-config
--libs QtCore QtGui
2>/dev
/null
)
47 MOC
= $(shell pkg-config
--variable
=moc_location QtCore
)
49 ifeq ($(QTINCLUDES
), )
50 # if both pkg-config commands failed, search in common places
52 QTINCLUDES
= -I
$(QTDIR
)/include -I
$(QTDIR
)/include/QtCore
-I
$(QTDIR
)/include/QtGui
53 QTLDLIBS
= -L
$(QTDIR
)/lib
-lQtCore4
-lQtGui4
54 ifneq ($(wildcard $(QTDIR
)/include/QtWidgets
),)
55 QTINCLUDES
+= -I
$(QTDIR
)/include/QtWidgets
56 QTLDLIBS
= -L
$(QTDIR
)/lib
-lQt5Widgets
-lQt5Gui
-lQt5Core
58 MOC
= $(QTDIR
)/bin
/moc
64 QTGUIOBJS
= $(OBJDIR
)/proxgui.o
$(OBJDIR
)/proxguiqt.o
$(OBJDIR
)/proxguiqt.moc.o
67 QTGUIOBJS
= $(OBJDIR
)/guidummy.o
70 # Flags to generate temporary dependency files
71 DEPFLAGS
= -MT
$@
-MMD
-MP
-MF
$(OBJDIR
)/$*.Td
72 # make temporary to final dependeny files after successful compilation
73 POSTCOMPILE
= $(MV
) -f
$(OBJDIR
)/$*.Td
$(OBJDIR
)/$*.d
78 CMDSRCS
= crapto1
/crapto1.c\
82 loclass
/cipherutils.c \
85 loclass
/elite_crack.c\
150 ZLIBSRCS
= deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
151 ZLIBFLAGS
= -DZ_SOLO
-DZ_PREFIX
-DNO_GZIP
-DZLIB_PM3_TUNED
154 QTGUISRCS
= proxgui.
cpp proxguiqt.
cpp proxguiqt.moc.
cpp guidummy.
cpp
156 COREOBJS
= $(CORESRCS
:%.c
=$(OBJDIR
)/%.o
)
157 CMDOBJS
= $(CMDSRCS
:%.c
=$(OBJDIR
)/%.o
)
158 ZLIBOBJS
= $(ZLIBSRCS
:%.c
=$(OBJDIR
)/%.o
)
160 BINS
= proxmark3 flasher fpga_compress
161 WINBINS
= $(patsubst %, %.exe
, $(BINS
))
162 CLEAN
= $(BINS
) $(WINBINS
) $(COREOBJS
) $(CMDOBJS
) $(ZLIBOBJS
) $(QTGUIOBJS
) $(OBJDIR
)/*.o
*.moc.
cpp
164 all: lua_build
$(BINS
)
166 all-static
: LDLIBS
:=-static
$(LDLIBS
)
167 all-static
: proxmark3 flasher fpga_compress
169 proxmark3
: LDLIBS
+=$(LUALIB
) $(QTLDLIBS
)
170 proxmark3
: $(OBJDIR
)/proxmark3.o
$(COREOBJS
) $(CMDOBJS
) $(QTGUIOBJS
) lualibs
/usb_cmd.lua
171 $(LD
) $(LDFLAGS
) $(OBJDIR
)/proxmark3.o
$(COREOBJS
) $(CMDOBJS
) $(QTGUIOBJS
) $(LDLIBS
) -o
$@
173 flasher
: $(OBJDIR
)/flash.o
$(OBJDIR
)/flasher.o
$(COREOBJS
)
174 $(LD
) $(LDFLAGS
) $^
$(LDLIBS
) -o
$@
176 fpga_compress
: $(OBJDIR
)/fpga_compress.o
$(ZLIBOBJS
)
177 $(LD
) $(LDFLAGS
) $(ZLIBFLAGS
) $^
$(LDLIBS
) -o
$@
179 proxguiqt.moc.
cpp: proxguiqt.h
182 lualibs
/usb_cmd.lua
: ..
/include/usb_cmd.h
183 awk
-f usb_cmd_h2lua.awk
$^
> $@
187 cd ..
/liblua
&& make
clean
190 $(TAR
) $(TARFLAGS
) ..
/proxmark3-
$(platform
)-bin.
tar $(BINS
:%=client
/%) $(WINBINS
:%=client
/%)
193 @echo Compiling liblua
, using platform
$(LUAPLATFORM
)
194 cd ..
/liblua
&& make
$(LUAPLATFORM
)
199 $(OBJDIR
)/%.o
: %.c
$(OBJDIR
)/%.d
200 $(CC
) $(DEPFLAGS
) $(CFLAGS
) $(ZLIBFLAGS
) -c
-o
$@
$<
204 $(OBJDIR
)/%.o
: %.
cpp $(OBJDIR
)/%.d
205 $(CXX
) $(DEPFLAGS
) $(CXXFLAGS
) $(QTINCLUDES
) -c
-o
$@
$<
209 #$(CMDOBJS) $(COREOBJS): $(notdir $(%.c)) %.d
210 # $(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
213 #$(ZLIBOBJS): $(notdir $(%.c)) %.d
214 # $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
217 #$(QTGUIOBJS): $(notdir $(%.cpp)) %.d
218 # $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
221 DEPENDENCY_FILES
= $(patsubst %.c
, $(OBJDIR
)/%.d
, $(CORESRCS
) $(CMDSRCS
) $(ZLIBSRCS
)) \
222 $(patsubst %.
cpp, $(OBJDIR
)/%.d
, $(QTGUISRCS
)) \
223 $(OBJDIR
)/proxmark3.d
$(OBJDIR
)/flash.d
$(OBJDIR
)/flasher.d
$(OBJDIR
)/fpga_compress.d
225 $(DEPENDENCY_FILES
): ;
226 .PRECIOUS
: $(DEPENDENCY_FILES
)
228 -include $(DEPENDENCY_FILES
)