]> git.zerfleddert.de Git - proxmark3-svn/blob - client/Makefile
2f8530934297564b86c4f610ec560c5265084012
[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 all: lua_build $(BINS)
168
169 all-static: LDLIBS:=-static $(LDLIBS)
170 all-static: proxmark3 flasher fpga_compress
171
172 proxmark3: LDLIBS+=$(LUALIB) $(QTLDLIBS)
173 proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) lualibs/usb_cmd.lua
174 $(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) $(LDLIBS) -o $@
175
176 flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS)
177 $(LD) $(LDFLAGS) $^ $(LDLIBS) -o $@
178
179 fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS)
180 $(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@
181
182 proxguiqt.moc.cpp: proxguiqt.h
183 $(MOC) -o$@ $^
184
185 ui/ui_overlays.h: ./ui/overlays.ui
186 $(UIC) $^ > $@
187
188 lualibs/usb_cmd.lua: ../include/usb_cmd.h
189 awk -f usb_cmd_h2lua.awk $^ > $@
190
191 clean:
192 $(RM) $(CLEAN)
193 cd ../liblua && make clean
194
195 tarbin: $(BINS)
196 $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
197
198 lua_build:
199 @echo Compiling liblua, using platform $(LUAPLATFORM)
200 cd ../liblua && make $(LUAPLATFORM)
201
202 .PHONY: all clean
203
204 %.o: %.c
205 $(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
206 $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
207 $(POSTCOMPILE)
208
209 %.o: %.cpp
210 $(OBJDIR)/%.o : %.cpp $(OBJDIR)/%.d
211 $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(QTINCLUDES) -c -o $@ $<
212 $(POSTCOMPILE)
213
214
215 #$(CMDOBJS) $(COREOBJS): $(notdir $(%.c)) %.d
216 # $(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
217 # $(POSTCOMPILE)
218
219 #$(ZLIBOBJS): $(notdir $(%.c)) %.d
220 # $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
221 # $(POSTCOMPILE)
222
223 #$(QTGUIOBJS): $(notdir $(%.cpp)) %.d
224 # $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
225 # $(POSTCOMPILE)
226
227 DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(CORESRCS) $(CMDSRCS) $(ZLIBSRCS)) \
228 $(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \
229 $(OBJDIR)/proxmark3.d $(OBJDIR)/flash.d $(OBJDIR)/flasher.d $(OBJDIR)/fpga_compress.d
230
231 $(DEPENDENCY_FILES): ;
232 .PRECIOUS: $(DEPENDENCY_FILES)
233
234 -include $(DEPENDENCY_FILES)
235
Impressum, Datenschutz