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
-O4
25 platform
= $(shell uname
)
26 ifneq (,$(findstring MINGW
,$(platform
)))
27 CXXFLAGS
= -I
$(QTDIR
)/include -I
$(QTDIR
)/include/QtCore
-I
$(QTDIR
)/include/QtGui
28 ifneq ($(wildcard $(QTDIR
)/include/QtWidgets
),)
29 CXXFLAGS
+= -I
$(QTDIR
)/include/QtWidgets
30 QTLDLIBS
= -L
$(QTDIR
)/lib
-lQt5Core
-lQt5Gui
-lQt5Widgets
32 QTLDLIBS
= -L
$(QTDIR
)/lib
-lQtCore4
-lQtGui4
34 MOC
= $(QTDIR
)/bin
/moc
37 CXXFLAGS
= $(shell pkg-config
--cflags Qt5Core Qt5Widgets
2>/dev
/null
) -Wall
-O4
38 QTLDLIBS
= $(shell pkg-config
--libs Qt5Core Qt5Widgets
2>/dev
/null
)
39 MOC
= $(shell pkg-config
--variable
=host_bins Qt5Core
)/moc
41 CXXFLAGS
= $(shell pkg-config
--cflags QtCore QtGui
2>/dev
/null
) -Wall
-O4
42 QTLDLIBS
= $(shell pkg-config
--libs QtCore QtGui
2>/dev
/null
)
43 MOC
= $(shell pkg-config
--variable
=moc_location QtCore
)
45 ifeq ($(platform
),Darwin
)
49 LDLIBS
+= -ltermcap
-lncurses
55 QTGUIOBJS
= $(OBJDIR
)/proxgui.o
$(OBJDIR
)/proxguiqt.o
$(OBJDIR
)/proxguiqt.moc.o
58 QTGUIOBJS
= $(OBJDIR
)/guidummy.o
61 # Flags to generate temporary dependency files
62 DEPFLAGS
= -MT
$@
-MMD
-MP
-MF
$(OBJDIR
)/$*.Td
63 # make temporary to final dependeny files after successful compilation
64 POSTCOMPILE
= $(MV
) -f
$(OBJDIR
)/$*.Td
$(OBJDIR
)/$*.d
69 CMDSRCS
= crapto1
/crapto1.c\
73 loclass
/cipherutils.c \
76 loclass
/elite_crack.c\
141 ZLIBSRCS
= deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
142 ZLIBFLAGS
= -DZ_SOLO
-DZ_PREFIX
-DNO_GZIP
-DZLIB_PM3_TUNED
145 QTGUISRCS
= proxgui.
cpp proxguiqt.
cpp proxguiqt.moc.
cpp guidummy.
cpp
147 COREOBJS
= $(CORESRCS
:%.c
=$(OBJDIR
)/%.o
)
148 CMDOBJS
= $(CMDSRCS
:%.c
=$(OBJDIR
)/%.o
)
149 ZLIBOBJS
= $(ZLIBSRCS
:%.c
=$(OBJDIR
)/%.o
)
151 BINS
= proxmark3 flasher fpga_compress
152 WINBINS
= $(patsubst %, %.exe
, $(BINS
))
153 CLEAN
= $(BINS
) $(WINBINS
) $(COREOBJS
) $(CMDOBJS
) $(ZLIBOBJS
) $(QTGUIOBJS
) $(OBJDIR
)/*.o
*.moc.
cpp
155 all: lua_build
$(BINS
)
157 all-static
: LDLIBS
:=-static
$(LDLIBS
)
158 all-static
: proxmark3 flasher fpga_compress
160 proxmark3
: LDLIBS
+=$(LUALIB
) $(QTLDLIBS
)
161 proxmark3
: $(OBJDIR
)/proxmark3.o
$(COREOBJS
) $(CMDOBJS
) $(QTGUIOBJS
) lualibs
/usb_cmd.lua
162 $(LD
) $(LDFLAGS
) $(OBJDIR
)/proxmark3.o
$(COREOBJS
) $(CMDOBJS
) $(QTGUIOBJS
) $(LDLIBS
) -o
$@
164 flasher
: $(OBJDIR
)/flash.o
$(OBJDIR
)/flasher.o
$(COREOBJS
)
165 $(LD
) $(LDFLAGS
) $^
$(LDLIBS
) -o
$@
167 fpga_compress
: $(OBJDIR
)/fpga_compress.o
$(ZLIBOBJS
)
168 $(LD
) $(LDFLAGS
) $(ZLIBFLAGS
) $^
$(LDLIBS
) -o
$@
170 proxguiqt.moc.
cpp: proxguiqt.h
173 lualibs
/usb_cmd.lua
: ..
/include/usb_cmd.h
174 awk
-f usb_cmd_h2lua.awk
$^
> $@
178 cd ..
/liblua
&& make
clean
181 $(TAR
) $(TARFLAGS
) ..
/proxmark3-
$(platform
)-bin.
tar $(BINS
:%=client
/%) $(WINBINS
:%=client
/%)
184 @echo Compiling liblua
, using platform
$(LUAPLATFORM
)
185 cd ..
/liblua
&& make
$(LUAPLATFORM
)
190 $(OBJDIR
)/%.o
: %.c
$(OBJDIR
)/%.d
191 $(CC
) $(DEPFLAGS
) $(CFLAGS
) $(ZLIBFLAGS
) -c
-o
$@
$<
195 $(OBJDIR
)/%.o
: %.
cpp $(OBJDIR
)/%.d
196 $(CXX
) $(DEPFLAGS
) $(CXXFLAGS
) -c
-o
$@
$<
200 #$(CMDOBJS) $(COREOBJS): $(notdir $(%.c)) %.d
201 # $(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
204 #$(ZLIBOBJS): $(notdir $(%.c)) %.d
205 # $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
208 #$(QTGUIOBJS): $(notdir $(%.cpp)) %.d
209 # $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
212 DEPENDENCY_FILES
= $(patsubst %.c
, $(OBJDIR
)/%.d
, $(CORESRCS
) $(CMDSRCS
) $(ZLIBSRCS
)) \
213 $(patsubst %.
cpp, $(OBJDIR
)/%.d
, $(QTGUISRCS
)) \
214 $(OBJDIR
)/proxmark3.d
$(OBJDIR
)/flash.d
$(OBJDIR
)/flasher.d
$(OBJDIR
)/fpga_compress.d
216 $(DEPENDENCY_FILES
): ;
217 .PRECIOUS
: $(DEPENDENCY_FILES
)
219 -include $(DEPENDENCY_FILES
)