]> cvs.zerfleddert.de Git - proxmark3-svn/blob - client/Makefile
ee2a25c0d3b780c1bdbc3758cc1c571930acafee
[proxmark3-svn] / client / Makefile
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
7 CC = gcc
8 CXX = g++
9 LD = g++
10 TAR = tar
11 TARFLAGS = -C .. --ignore-failed-read -rvf
12 RM = rm -f
13 MV = mv
14
15 #COMMON_FLAGS = -m32
16 VPATH = ../common ../zlib
17 OBJDIR = obj
18
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
24
25 LUAPLATFORM = generic
26 platform = $(shell uname)
27 ifneq (,$(findstring MINGW,$(platform)))
28 LUAPLATFORM = mingw
29 else
30 ifeq ($(platform),Darwin)
31 LUAPLATFORM = macosx
32 else
33 LUALIB += -ldl
34 LDLIBS += -ltermcap -lncurses
35 LUAPLATFORM = linux
36 endif
37 endif
38
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)
50 endif
51 ifeq ($(QTINCLUDES), )
52 # if both pkg-config commands failed, search in common places
53 ifneq ($(QTDIR), )
54 QTINCLUDES = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui
55 QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4
56 ifneq ($(wildcard $(QTDIR)/include/QtWidgets),)
57 QTINCLUDES += -I$(QTDIR)/include/QtWidgets
58 QTLDLIBS = -L$(QTDIR)/lib -lQt5Widgets -lQt5Gui -lQt5Core
59 endif
60 MOC = $(QTDIR)/bin/moc
61 UIC = $(QTDIR)/bin/uic
62 endif
63 endif
64
65
66 ifneq ($(QTLDLIBS), )
67 QTGUIOBJS = $(OBJDIR)/proxgui.o $(OBJDIR)/proxguiqt.o $(OBJDIR)/proxguiqt.moc.o
68 CFLAGS += -DHAVE_GUI
69 else
70 QTGUIOBJS = $(OBJDIR)/guidummy.o
71 endif
72
73 # Flags to generate temporary dependency files
74 DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td
75 # make temporary to final dependeny files after successful compilation
76 POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d
77
78 CORESRCS = uart.c \
79 util.c
80
81 CMDSRCS = crapto1/crapto1.c\
82 crapto1/crypto1.c\
83 mfkey.c\
84 loclass/cipher.c \
85 loclass/cipherutils.c \
86 loclass/des.c \
87 loclass/ikeys.c \
88 loclass/elite_crack.c\
89 loclass/fileutils.c\
90 whereami.c\
91 mifarehost.c\
92 parity.c\
93 crc.c \
94 crc16.c \
95 crc64.c \
96 iso14443crc.c \
97 iso15693tools.c \
98 data.c \
99 graph.c \
100 ui.c \
101 cmddata.c \
102 lfdemod.c \
103 cmdhf.c \
104 cmdhf14a.c \
105 cmdhf14b.c \
106 cmdhf15.c \
107 cmdhfepa.c \
108 cmdhflegic.c \
109 cmdhficlass.c \
110 cmdhfmf.c \
111 cmdhfmfu.c \
112 cmdhftopaz.c \
113 cmdhw.c \
114 cmdlf.c \
115 cmdlfawid.c \
116 cmdlfcotag.c\
117 cmdlfem4x.c \
118 cmdlffdx.c \
119 cmdlfgproxii.c \
120 cmdlfhid.c \
121 cmdlfhitag.c \
122 cmdlfio.c \
123 cmdlfindala.c \
124 cmdlfjablotron.c \
125 cmdlfnexwatch.c \
126 cmdlfnoralsy.c \
127 cmdlfparadox.c \
128 cmdlfpcf7931.c \
129 cmdlfpresco.c \
130 cmdlfpyramid.c \
131 cmdlfsecurakey.c \
132 cmdlft55xx.c \
133 cmdlfti.c \
134 cmdlfviking.c\
135 cmdlfvisa2000.c\
136 cmdparser.c \
137 cmdmain.c \
138 scripting.c\
139 cmdscript.c\
140 pm3_binlib.c\
141 pm3_bitlib.c\
142 aes.c\
143 protocols.c\
144 sha1.c\
145 cmdcrc.c\
146 reveng/reveng.c\
147 reveng/cli.c\
148 reveng/bmpbit.c\
149 reveng/model.c\
150 reveng/poly.c\
151 reveng/getopt.c\
152
153 ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
154 ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
155 #-DDEBUG -Dverbose=1
156
157 QTGUISRCS = proxgui.cpp proxguiqt.cpp proxguiqt.moc.cpp guidummy.cpp
158
159 COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o)
160 CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o)
161 ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o)
162
163 BINS = proxmark3 flasher fpga_compress
164 WINBINS = $(patsubst %, %.exe, $(BINS))
165 CLEAN = $(BINS) $(WINBINS) $(COREOBJS) $(CMDOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h
166
167 # need to assign dependancies to build these first...
168 all: ui/ui_overlays.h lua_build $(BINS)
169
170 all-static: LDLIBS:=-static $(LDLIBS)
171 all-static: proxmark3 flasher fpga_compress
172
173 proxmark3: LDLIBS+=$(LUALIB) $(QTLDLIBS)
174 proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) lualibs/usb_cmd.lua
175 $(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) $(LDLIBS) -o $@
176
177 flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS)
178 $(LD) $(LDFLAGS) $^ $(LDLIBS) -o $@
179
180 fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS)
181 $(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@
182
183 proxguiqt.moc.cpp: proxguiqt.h
184 $(MOC) -o$@ $^
185
186 ui/ui_overlays.h: ui/overlays.ui
187 $(UIC) $^ > $@
188
189 lualibs/usb_cmd.lua: ../include/usb_cmd.h
190 awk -f usb_cmd_h2lua.awk $^ > $@
191
192 clean:
193 $(RM) $(CLEAN)
194 cd ../liblua && make clean
195
196 tarbin: $(BINS)
197 $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
198
199 lua_build:
200 @echo Compiling liblua, using platform $(LUAPLATFORM)
201 cd ../liblua && make $(LUAPLATFORM)
202
203 .PHONY: all clean
204
205 %.o: %.c
206 $(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
207 $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
208 $(POSTCOMPILE)
209
210 %.o: %.cpp
211 $(OBJDIR)/%.o : %.cpp $(OBJDIR)/%.d
212 $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(QTINCLUDES) -c -o $@ $<
213 $(POSTCOMPILE)
214
215
216 #$(CMDOBJS) $(COREOBJS): $(notdir $(%.c)) %.d
217 # $(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
218 # $(POSTCOMPILE)
219
220 #$(ZLIBOBJS): $(notdir $(%.c)) %.d
221 # $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
222 # $(POSTCOMPILE)
223
224 #$(QTGUIOBJS): $(notdir $(%.cpp)) %.d
225 # $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
226 # $(POSTCOMPILE)
227
228 DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(CORESRCS) $(CMDSRCS) $(ZLIBSRCS)) \
229 $(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \
230 $(OBJDIR)/proxmark3.d $(OBJDIR)/flash.d $(OBJDIR)/flasher.d $(OBJDIR)/fpga_compress.d
231
232 $(DEPENDENCY_FILES): ;
233 .PRECIOUS: $(DEPENDENCY_FILES)
234
235 -include $(DEPENDENCY_FILES)
236
Impressum, Datenschutz