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