]> cvs.zerfleddert.de Git - proxmark3-svn/blame_incremental - client/Makefile
Updated CHANGELOG to new release 3.0.0
[proxmark3-svn] / client / Makefile
... / ...
CommitLineData
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
4# the license.
5#-----------------------------------------------------------------------------
6
7CC = gcc
8CXX = g++
9LD = g++
10TAR = tar
11TARFLAGS = -C .. --ignore-failed-read -rvf
12RM = rm -f
13MV = mv
14
15#COMMON_FLAGS = -m32
16VPATH = ../common ../zlib
17OBJDIR = obj
18
19LDLIBS = -L/opt/local/lib -L/usr/local/lib -lreadline -lpthread -lm
20LUALIB = ../liblua/liblua.a
21LDFLAGS = $(COMMON_FLAGS)
22CFLAGS = -std=c99 -D_ISOC99_SOURCE -I. -I../include -I../common -I../zlib -I/opt/local/include -I../liblua -Wall $(COMMON_FLAGS) -g -O3
23CXXFLAGS = -I../include -Wall -O3
24
25LUAPLATFORM = generic
26platform = $(shell uname)
27ifneq (,$(findstring MINGW,$(platform)))
28 LUAPLATFORM = mingw
29else
30 ifeq ($(platform),Darwin)
31 LUAPLATFORM = macosx
32 else
33 LUALIB += -ldl
34 LDLIBS += -ltermcap -lncurses
35 LUAPLATFORM = linux
36 endif
37endif
38
39# Check for correctly configured Qt5
40QTINCLUDES = $(shell pkg-config --cflags Qt5Core Qt5Widgets 2>/dev/null)
41QTLDLIBS = $(shell pkg-config --libs Qt5Core Qt5Widgets 2>/dev/null)
42MOC = $(shell pkg-config --variable=host_bins Qt5Core)/moc
43UIC = $(shell pkg-config --variable=host_bins Qt5Core)/uic
44ifeq ($(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)
50else
51 CXXFLAGS += -std=c++11 -fPIC
52endif
53ifeq ($(QTINCLUDES), )
54# if both pkg-config commands failed, search in common places
55 ifneq ($(QTDIR), )
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
62 endif
63 MOC = $(QTDIR)/bin/moc
64 UIC = $(QTDIR)/bin/uic
65 endif
66endif
67
68
69ifneq ($(QTLDLIBS), )
70 QTGUIOBJS = $(OBJDIR)/proxgui.o $(OBJDIR)/proxguiqt.o $(OBJDIR)/proxguiqt.moc.o
71 CFLAGS += -DHAVE_GUI
72else
73 QTGUIOBJS = $(OBJDIR)/guidummy.o
74endif
75
76# Flags to generate temporary dependency files
77DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td
78# make temporary to final dependeny files after successful compilation
79POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d
80
81CORESRCS = uart.c \
82 util.c
83
84CMDSRCS = crapto1/crapto1.c\
85 crapto1/crypto1.c\
86 mfkey.c\
87 loclass/cipher.c \
88 loclass/cipherutils.c \
89 loclass/des.c \
90 loclass/ikeys.c \
91 loclass/elite_crack.c\
92 loclass/fileutils.c\
93 whereami.c\
94 mifarehost.c\
95 parity.c\
96 crc.c \
97 crc16.c \
98 crc64.c \
99 iso14443crc.c \
100 iso15693tools.c \
101 data.c \
102 graph.c \
103 ui.c \
104 cmddata.c \
105 lfdemod.c \
106 cmdhf.c \
107 cmdhf14a.c \
108 cmdhf14b.c \
109 cmdhf15.c \
110 cmdhfepa.c \
111 cmdhflegic.c \
112 cmdhficlass.c \
113 cmdhfmf.c \
114 cmdhfmfu.c \
115 cmdhfmfhard.c \
116 hardnested/hardnested_bruteforce.c \
117 cmdhftopaz.c \
118 cmdhw.c \
119 cmdlf.c \
120 cmdlfawid.c \
121 cmdlfcotag.c\
122 cmdlfem4x.c \
123 cmdlffdx.c \
124 cmdlfgproxii.c \
125 cmdlfhid.c \
126 cmdlfhitag.c \
127 cmdlfio.c \
128 cmdlfindala.c \
129 cmdlfjablotron.c \
130 cmdlfnexwatch.c \
131 cmdlfnoralsy.c \
132 cmdlfparadox.c \
133 cmdlfpcf7931.c \
134 cmdlfpresco.c \
135 cmdlfpyramid.c \
136 cmdlfsecurakey.c \
137 cmdlft55xx.c \
138 cmdlfti.c \
139 cmdlfviking.c\
140 cmdlfvisa2000.c\
141 cmdparser.c \
142 cmdmain.c \
143 scripting.c\
144 cmdscript.c\
145 pm3_binlib.c\
146 pm3_bitlib.c\
147 aes.c\
148 protocols.c\
149 sha1.c\
150 cmdcrc.c\
151 reveng/reveng.c\
152 reveng/cli.c\
153 reveng/bmpbit.c\
154 reveng/model.c\
155 reveng/poly.c\
156 reveng/getopt.c\
157
158cpu_arch = $(shell uname -m)
159ifneq ($(findstring 86, $(cpu_arch)), )
160 MULTIARCHSRCS = hardnested/hardnested_bf_core.c hardnested/hardnested_bitarray_core.c
161endif
162ifneq ($(findstring 64, $(cpu_arch)), )
163 MULTIARCHSRCS = hardnested/hardnested_bf_core.c hardnested/hardnested_bitarray_core.c
164endif
165ifeq ($(MULTIARCHSRCS), )
166 CMDSRCS += hardnested/hardnested_bf_core.c hardnested/hardnested_bitarray_core.c
167endif
168
169ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
170ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
171#-DDEBUG -Dverbose=1
172
173QTGUISRCS = proxgui.cpp proxguiqt.cpp proxguiqt.moc.cpp guidummy.cpp
174
175COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o)
176CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o)
177ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o)
178MULTIARCHOBJS = $(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) \
183 $(MULTIARCHSRCS:%.c=$(OBJDIR)/%_AVX512.o)
184
185BINS = proxmark3 flasher fpga_compress
186WINBINS = $(patsubst %, %.exe, $(BINS))
187CLEAN = $(BINS) $(WINBINS) $(COREOBJS) $(CMDOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h
188
189# need to assign dependancies to build these first...
190all: ui/ui_overlays.h lua_build $(BINS)
191
192all-static: LDLIBS:=-static $(LDLIBS)
193all-static: proxmark3 flasher fpga_compress
194
195proxmark3: LDLIBS+=$(LUALIB) $(QTLDLIBS)
196proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) lualibs/usb_cmd.lua
197 $(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(LDLIBS) -o $@
198
199flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS)
200 $(LD) $(LDFLAGS) $^ $(LDLIBS) -o $@
201
202fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS)
203 $(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@
204
205proxguiqt.moc.cpp: proxguiqt.h
206 $(MOC) -o$@ $^
207
208ui/ui_overlays.h: ui/overlays.ui
209 $(UIC) $^ > $@
210
211lualibs/usb_cmd.lua: ../include/usb_cmd.h
212 awk -f usb_cmd_h2lua.awk $^ > $@
213
214clean:
215 $(RM) $(CLEAN)
216 cd ../liblua && make clean
217
218tarbin: $(BINS)
219 $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
220
221lua_build:
222 @echo Compiling liblua, using platform $(LUAPLATFORM)
223 cd ../liblua && make $(LUAPLATFORM)
224
225.PHONY: all clean
226
227$(OBJDIR)/%_NOSIMD.o : %.c $(OBJDIR)/%.d
228 $(CC) $(DEPFLAGS) $(CFLAGS) -mno-mmx -mno-sse2 -mno-avx -mno-avx2 -mno-avx512f -c -o $@ $<
229
230$(OBJDIR)/%_MMX.o : %.c $(OBJDIR)/%.d
231 $(CC) $(DEPFLAGS) $(CFLAGS) -mmmx -mno-sse2 -mno-avx -mno-avx2 -mno-avx512f -c -o $@ $<
232
233$(OBJDIR)/%_SSE2.o : %.c $(OBJDIR)/%.d
234 $(CC) $(DEPFLAGS) $(CFLAGS) -mmmx -msse2 -mno-avx -mno-avx2 -mno-avx512f -c -o $@ $<
235
236$(OBJDIR)/%_AVX.o : %.c $(OBJDIR)/%.d
237 $(CC) $(DEPFLAGS) $(CFLAGS) -mmmx -msse2 -mavx -mno-avx2 -mno-avx512f -c -o $@ $<
238
239$(OBJDIR)/%_AVX2.o : %.c $(OBJDIR)/%.d
240 $(CC) $(DEPFLAGS) $(CFLAGS) -mmmx -msse2 -mavx -mavx2 -mno-avx512f -c -o $@ $<
241
242$(OBJDIR)/%_AVX512.o : %.c $(OBJDIR)/%.d
243 $(CC) $(DEPFLAGS) $(CFLAGS) -mmmx -msse2 -mavx -mavx2 -mavx512f -c -o $@ $<
244
245%.o: %.c
246$(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
247 $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
248 $(POSTCOMPILE)
249
250%.o: %.cpp
251$(OBJDIR)/%.o : %.cpp $(OBJDIR)/%.d
252 $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(QTINCLUDES) -c -o $@ $<
253 $(POSTCOMPILE)
254
255
256#$(CMDOBJS) $(COREOBJS): $(notdir $(%.c)) %.d
257# $(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
258# $(POSTCOMPILE)
259
260#$(ZLIBOBJS): $(notdir $(%.c)) %.d
261# $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
262# $(POSTCOMPILE)
263
264#$(QTGUIOBJS): $(notdir $(%.cpp)) %.d
265# $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
266# $(POSTCOMPILE)
267
268DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(CORESRCS) $(CMDSRCS) $(ZLIBSRCS) $(MULTIARCHSRCS)) \
269 $(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \
270 $(OBJDIR)/proxmark3.d $(OBJDIR)/flash.d $(OBJDIR)/flasher.d $(OBJDIR)/fpga_compress.d
271
272$(DEPENDENCY_FILES): ;
273.PRECIOUS: $(DEPENDENCY_FILES)
274
275-include $(DEPENDENCY_FILES)
276
Impressum, Datenschutz