]>
Commit | Line | Data |
---|---|---|
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 | include ../common/Makefile.common | |
7 | ||
8 | CC = gcc | |
9 | CXX = g++ | |
10 | COMMON_FLAGS = -std=c99 -O3 -mpopcnt -march=native -g | |
11 | #VPATH = ../common ../zlib | |
12 | OBJDIR = obj | |
13 | ||
14 | LDLIBS = -L/opt/local/lib -L/usr/local/lib -lreadline -lpthread -lm | |
15 | LUALIB = ../liblua/liblua.a | |
16 | #LDFLAGS = $(COMMON_FLAGS) | |
17 | CFLAGS = $(COMMON_FLAGS) -I. -I../include -I../common -I../zlib -I/opt/local/include -I../liblua -Wall | |
18 | LUAPLATFORM = generic | |
19 | ||
20 | ifneq (,$(findstring MINGW,$(platform))) | |
21 | LDLIBS += -L/mingw/lib -lgdi32 | |
22 | CFLAGS += -I/mingw/include | |
23 | CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui | |
24 | MOC = $(QTDIR)/bin/moc | |
25 | LUAPLATFORM = mingw | |
26 | ifneq ($(wildcard $(QTDIR)/include/QtWidgets),) | |
27 | CXXFLAGS += -I$(QTDIR)/include/QtWidgets | |
28 | QTLDLIBS = -L$(QTDIR)/lib -lQt5Core -lQt5Gui -lQt5Widgets | |
29 | else | |
30 | QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4 | |
31 | endif | |
32 | ||
33 | # QT version, 4 or 5 | |
34 | qtplatform = $(shell $(MOC) -v) | |
35 | ifneq (, $(findstring moc 5,$(qtplatform))) | |
36 | CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui -I$(QTDIR)/include/QtWidgets -I/mingw/include | |
37 | QTLDLIBS = -L$(QTDIR)/lib -lQt5Core -lQt5Gui -lQt5Widgets | |
38 | else | |
39 | CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui | |
40 | QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4 | |
41 | endif | |
42 | ||
43 | else ifeq ($(platform),Darwin) | |
44 | ||
45 | # OS X, QT5 detection needs this. | |
46 | export PKG_CONFIG_PATH=/usr/local/Cellar/qt5/5.6.1-1/lib/pkgconfig/ | |
47 | ||
48 | CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -O3 | |
49 | QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null) | |
50 | MOC = $(shell pkg-config --variable=moc_location QtCore) | |
51 | ||
52 | # QT version, 4 or 5 | |
53 | qtplatform = $(shell $(MOC) -v) | |
54 | ifneq (, $(findstring moc 5,$(qtplatform))) | |
55 | # use this if you have QT5 installed. | |
56 | CFLAGS += -I/usr/include/malloc/ -I/usr/local/opt/readline/include -I/usr/local/opt/qt5/include | |
57 | LDLIBS = -L/opt/local/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/qt5/lib -lreadline -lpthread -lm | |
58 | else | |
59 | # Assuming you have QT4 installed. | |
60 | CFLAGS += -I/usr/include/malloc/ -I/usr/local/opt/readline/include | |
61 | LDLIBS = -L/opt/local/lib -L/usr/local/opt/readline/lib -lreadline -lpthread -lm | |
62 | endif | |
63 | ||
64 | LUAPLATFORM = macosx | |
65 | else | |
66 | CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -O3 | |
67 | QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null) | |
68 | LUALIB += -ldl | |
69 | LDLIBS += -ltermcap -lncurses | |
70 | MOC = $(shell pkg-config --variable=moc_location QtCore) | |
71 | # Below is a variant you can use if you have problems compiling with QT5 on ubuntu. see http://www.proxmark.org/forum/viewtopic.php?id=1661 for more info. | |
72 | #MOC = /usr/lib/x86_64-linux-gnu/qt4/bin/moc | |
73 | LUAPLATFORM = linux | |
74 | endif | |
75 | ||
76 | ifneq ($(QTLDLIBS),) | |
77 | QTGUI = $(OBJDIR)/proxgui.o $(OBJDIR)/proxguiqt.o $(OBJDIR)/proxguiqt.moc.o | |
78 | CFLAGS += -DHAVE_GUI | |
79 | LINK.o = $(LINK.cpp) | |
80 | else | |
81 | QTGUI = guidummy.o | |
82 | endif | |
83 | ||
84 | CORESRCS = uart.c \ | |
85 | util.c \ | |
86 | sleep.c | |
87 | ||
88 | ||
89 | CMDSRCS = mifarehost.c \ | |
90 | nonce2key/crapto1.c \ | |
91 | nonce2key/crypto1.c \ | |
92 | nonce2key/nonce2key.c \ | |
93 | nonce2key/crypto1_bs.c \ | |
94 | loclass/cipher.c \ | |
95 | loclass/cipherutils.c \ | |
96 | loclass/des.c \ | |
97 | loclass/ikeys.c \ | |
98 | loclass/elite_crack.c \ | |
99 | loclass/fileutils.c \ | |
100 | parity.c \ | |
101 | crc.c \ | |
102 | crc16.c \ | |
103 | crc64.c \ | |
104 | iso14443crc.c \ | |
105 | legic_prng.c \ | |
106 | iso15693tools.c \ | |
107 | data.c \ | |
108 | graph.c \ | |
109 | ui.c \ | |
110 | cmddata.c \ | |
111 | lfdemod.c \ | |
112 | cmdanalyse.c \ | |
113 | cmdhf.c \ | |
114 | cmdhf14a.c \ | |
115 | cmdhf14b.c \ | |
116 | cmdhf15.c \ | |
117 | cmdhfepa.c \ | |
118 | cmdhflegic.c \ | |
119 | cmdhficlass.c \ | |
120 | cmdhfmf.c \ | |
121 | cmdhfmfu.c \ | |
122 | cmdhfmfhard.c \ | |
123 | cmdhfmfdes.c \ | |
124 | cmdhftopaz.c \ | |
125 | cmdhw.c \ | |
126 | cmdlf.c \ | |
127 | cmdlfio.c \ | |
128 | cmdlfhid.c \ | |
129 | cmdlfawid.c \ | |
130 | cmdlfem4x.c \ | |
131 | cmdlfhitag.c \ | |
132 | cmdlfti.c \ | |
133 | cmdparser.c \ | |
134 | cmdmain.c \ | |
135 | cmdlft55xx.c \ | |
136 | cmdlfpcf7931.c \ | |
137 | cmdlfviking.c \ | |
138 | cmdlfpresco.c \ | |
139 | cmdlfpyramid.c \ | |
140 | cmdlfguard.c \ | |
141 | cmdlfnedap.c \ | |
142 | cmdlfjablotron.c \ | |
143 | cmdlfvisa2000.c \ | |
144 | pm3_binlib.c \ | |
145 | scripting.c \ | |
146 | cmdscript.c \ | |
147 | pm3_bitlib.c \ | |
148 | aes.c \ | |
149 | protocols.c \ | |
150 | sha1.c \ | |
151 | sha256.c \ | |
152 | cmdcrc.c \ | |
153 | reveng/preset.c \ | |
154 | reveng/reveng.c \ | |
155 | reveng/cli.c \ | |
156 | reveng/bmpbit.c \ | |
157 | reveng/model.c \ | |
158 | reveng/poly.c \ | |
159 | reveng/getopt.c \ | |
160 | tea.c \ | |
161 | prng.c \ | |
162 | bucketsort.c | |
163 | # radixsort.c \ | |
164 | ||
165 | ||
166 | ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c | |
167 | ZLIB_FLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED | |
168 | #-DDEBUG -Dverbose=1 | |
169 | ||
170 | COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o) | |
171 | CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o) | |
172 | ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o) | |
173 | ||
174 | RM = rm -f | |
175 | BINS = proxmark3 flasher fpga_compress | |
176 | CLEAN = cli cli.exe flasher flasher.exe proxmark3 proxmark3.exe fpga_compress fpga_compress.exe snooper snooper.exe $(CMDOBJS) $(OBJDIR)/*.o *.o *.moc.cpp | |
177 | ||
178 | all: lua_build $(BINS) | |
179 | ||
180 | all-static: LDLIBS:=-static $(LDLIBS) | |
181 | all-static: $(BINS) | |
182 | ||
183 | proxmark3: LDLIBS+=$(LUALIB) $(QTLDLIBS) | |
184 | proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUI) | |
185 | $(CXX) $(CXXFLAGS) $^ $(LDLIBS) -o $@ | |
186 | ||
187 | snooper: $(OBJDIR)/snooper.o $(COREOBJS) $(CMDOBJS) $(OBJDIR)/guidummy.o | |
188 | $(CXX) $(CXXFLAGS) $^ $(LDLIBS) -o $@ | |
189 | ||
190 | cli: $(OBJDIR)/cli.o $(COREOBJS) $(CMDOBJS) $(OBJDIR)/guidummy.o | |
191 | $(CXX) $(CXXFLAGS) $^ $(LDLIBS) -o $@ | |
192 | ||
193 | flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS) | |
194 | $(CXX) $(CXXFLAGS) $^ $(LDLIBS) -o $@ | |
195 | ||
196 | fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS) | |
197 | $(CXX) $(CXXFLAGS) $(ZLIB_FLAGS) $^ $(LDLIBS) -o $@ | |
198 | ||
199 | $(OBJDIR)/%.o: %.c | |
200 | $(CC) $(CFLAGS) $(ZLIB_FLAGS) -c -o $@ $< | |
201 | ||
202 | $(OBJDIR)/%.o: %.cpp | |
203 | $(CXX) $(CXXFLAGS) -c -o $@ $< | |
204 | ||
205 | proxguiqt.moc.cpp: proxguiqt.h | |
206 | $(MOC) -o$@ $^ | |
207 | ||
208 | clean: | |
209 | $(RM) $(CLEAN) | |
210 | cd ../liblua && make clean | |
211 | ||
212 | tarbin: $(BINS) | |
213 | $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) | |
214 | ||
215 | lua_build: | |
216 | @echo Compiling liblua, using platform $(LUAPLATFORM) | |
217 | cd ../liblua && make $(LUAPLATFORM) | |
218 | ||
219 | .PHONY: all clean |