]> cvs.zerfleddert.de Git - proxmark3-svn/blob - client/Makefile
reenable build in old proxspace environment (#286)
[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 = -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 else
51 CXXFLAGS += -std=c++11 -fPIC
52 endif
53 ifeq ($(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
66 endif
67
68
69 ifneq ($(QTLDLIBS), )
70 QTGUIOBJS = $(OBJDIR)/proxgui.o $(OBJDIR)/proxguiqt.o $(OBJDIR)/proxguiqt.moc.o
71 CFLAGS += -DHAVE_GUI
72 else
73 QTGUIOBJS = $(OBJDIR)/guidummy.o
74 endif
75
76 # Flags to generate temporary dependency files
77 DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td
78 # make temporary to final dependeny files after successful compilation
79 POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d
80
81 CORESRCS = uart.c \
82 util.c
83
84 CMDSRCS = 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 cmdhftopaz.c \
116 cmdhw.c \
117 cmdlf.c \
118 cmdlfawid.c \
119 cmdlfcotag.c\
120 cmdlfem4x.c \
121 cmdlffdx.c \
122 cmdlfgproxii.c \
123 cmdlfhid.c \
124 cmdlfhitag.c \
125 cmdlfio.c \
126 cmdlfindala.c \
127 cmdlfjablotron.c \
128 cmdlfnexwatch.c \
129 cmdlfnoralsy.c \
130 cmdlfparadox.c \
131 cmdlfpcf7931.c \
132 cmdlfpresco.c \
133 cmdlfpyramid.c \
134 cmdlfsecurakey.c \
135 cmdlft55xx.c \
136 cmdlfti.c \
137 cmdlfviking.c\
138 cmdlfvisa2000.c\
139 cmdparser.c \
140 cmdmain.c \
141 scripting.c\
142 cmdscript.c\
143 pm3_binlib.c\
144 pm3_bitlib.c\
145 aes.c\
146 protocols.c\
147 sha1.c\
148 cmdcrc.c\
149 reveng/reveng.c\
150 reveng/cli.c\
151 reveng/bmpbit.c\
152 reveng/model.c\
153 reveng/poly.c\
154 reveng/getopt.c\
155
156 ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
157 ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
158 #-DDEBUG -Dverbose=1
159
160 QTGUISRCS = proxgui.cpp proxguiqt.cpp proxguiqt.moc.cpp guidummy.cpp
161
162 COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o)
163 CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o)
164 ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o)
165
166 BINS = proxmark3 flasher fpga_compress
167 WINBINS = $(patsubst %, %.exe, $(BINS))
168 CLEAN = $(BINS) $(WINBINS) $(COREOBJS) $(CMDOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h
169
170 # need to assign dependancies to build these first...
171 all: ui/ui_overlays.h lua_build $(BINS)
172
173 all-static: LDLIBS:=-static $(LDLIBS)
174 all-static: proxmark3 flasher fpga_compress
175
176 proxmark3: LDLIBS+=$(LUALIB) $(QTLDLIBS)
177 proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) lualibs/usb_cmd.lua
178 $(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) $(LDLIBS) -o $@
179
180 flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS)
181 $(LD) $(LDFLAGS) $^ $(LDLIBS) -o $@
182
183 fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS)
184 $(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@
185
186 proxguiqt.moc.cpp: proxguiqt.h
187 $(MOC) -o$@ $^
188
189 ui/ui_overlays.h: ui/overlays.ui
190 $(UIC) $^ > $@
191
192 lualibs/usb_cmd.lua: ../include/usb_cmd.h
193 awk -f usb_cmd_h2lua.awk $^ > $@
194
195 clean:
196 $(RM) $(CLEAN)
197 cd ../liblua && make clean
198
199 tarbin: $(BINS)
200 $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
201
202 lua_build:
203 @echo Compiling liblua, using platform $(LUAPLATFORM)
204 cd ../liblua && make $(LUAPLATFORM)
205
206 .PHONY: all clean
207
208 %.o: %.c
209 $(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
210 $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
211 $(POSTCOMPILE)
212
213 %.o: %.cpp
214 $(OBJDIR)/%.o : %.cpp $(OBJDIR)/%.d
215 $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(QTINCLUDES) -c -o $@ $<
216 $(POSTCOMPILE)
217
218
219 #$(CMDOBJS) $(COREOBJS): $(notdir $(%.c)) %.d
220 # $(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
221 # $(POSTCOMPILE)
222
223 #$(ZLIBOBJS): $(notdir $(%.c)) %.d
224 # $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
225 # $(POSTCOMPILE)
226
227 #$(QTGUIOBJS): $(notdir $(%.cpp)) %.d
228 # $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
229 # $(POSTCOMPILE)
230
231 DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(CORESRCS) $(CMDSRCS) $(ZLIBSRCS)) \
232 $(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \
233 $(OBJDIR)/proxmark3.d $(OBJDIR)/flash.d $(OBJDIR)/flasher.d $(OBJDIR)/fpga_compress.d
234
235 $(DEPENDENCY_FILES): ;
236 .PRECIOUS: $(DEPENDENCY_FILES)
237
238 -include $(DEPENDENCY_FILES)
239
Impressum, Datenschutz