]> git.zerfleddert.de Git - proxmark3-svn/blame - client/Makefile
maybe fixed loading/unloading bug.
[proxmark3-svn] / client / Makefile
CommitLineData
a553f267 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#-----------------------------------------------------------------------------
bd846386 6
fb9acd45 7CC = gcc
8CXX = g++
9LD = g++
10TAR = tar
11TARFLAGS = -C .. --ignore-failed-read -rvf
12RM = rm -f
13MV = mv
806dc075 14
709b784c 15#COMMON_FLAGS = -m32
0ca9bc0e 16VPATH = ../common ../zlib
46cd4046 17OBJDIR = obj
7fe9b0b7 18
94e27a09 19LDLIBS = -L/opt/local/lib -L/usr/local/lib -lreadline -lpthread -lm
e6153040 20LUALIB = ../liblua/liblua.a
709b784c 21LDFLAGS = $(COMMON_FLAGS)
8aee1b84 22CFLAGS = -std=c99 -D_ISOC99_SOURCE -I. -I../include -I../common -I../zlib -I/opt/local/include -I../liblua -Wall $(COMMON_FLAGS) -g -O3
3472ebe5 23CXXFLAGS = -std=c++11 -fPIC -Wall -O3
8c04722d 24
3472ebe5 25LUAPLATFORM = generic
fb9acd45 26platform = $(shell uname)
8691f5b7 27ifneq (,$(findstring MINGW,$(platform)))
fb9acd45 28 LUAPLATFORM = mingw
8691f5b7 29else
fb9acd45 30 ifeq ($(platform),Darwin)
31 LUAPLATFORM = macosx
32 else
33 LUALIB += -ldl
34 LDLIBS += -ltermcap -lncurses
35 LUAPLATFORM = linux
36 endif
62b1302c 37endif
38
3472ebe5 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), )
fb9acd45 64 QTGUIOBJS = $(OBJDIR)/proxgui.o $(OBJDIR)/proxguiqt.o $(OBJDIR)/proxguiqt.moc.o
8c04722d 65 CFLAGS += -DHAVE_GUI
245e844e 66else
fb9acd45 67 QTGUIOBJS = $(OBJDIR)/guidummy.o
245e844e 68endif
62b1302c 69
fb9acd45 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
759c16b3 74
fb9acd45 75CORESRCS = uart.c \
76 util.c
759c16b3 77
33443e7c 78CMDSRCS = crapto1/crapto1.c\
79 crapto1/crypto1.c\
4cb4b588 80 mfkey.c\
db2b81ba 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\
4197a3f6 87 whereami.c\
f397b5cc 88 mifarehost.c\
1f065e1d 89 parity.c\
9f7bbd24 90 crc.c \
91c38cf7 91 crc16.c \
d730878d 92 crc64.c \
91c38cf7 93 iso14443crc.c \
9455b51c 94 iso15693tools.c \
7fe9b0b7 95 data.c \
96 graph.c \
97 ui.c \
98 cmddata.c \
eb191de6 99 lfdemod.c \
7fe9b0b7 100 cmdhf.c \
101 cmdhf14a.c \
102 cmdhf14b.c \
103 cmdhf15.c \
5acd09bd 104 cmdhfepa.c \
7fe9b0b7 105 cmdhflegic.c \
cee5a30d 106 cmdhficlass.c \
9ca155ba 107 cmdhfmf.c \
fe81b478 108 cmdhfmfu.c \
db2b81ba 109 cmdhftopaz.c \
7fe9b0b7 110 cmdhw.c \
111 cmdlf.c \
dbf6e824 112 cmdlfawid.c \
8b6abef5 113 cmdlfcotag.c\
28fdb04f 114 cmdlfem4x.c \
4db6f3bb 115 cmdlffdx.c \
946a84c3 116 cmdlfgproxii.c \
8b6abef5 117 cmdlfhid.c \
db09cb3a 118 cmdlfhitag.c \
8b6abef5 119 cmdlfio.c \
0fb65a26 120 cmdlfindala.c \
a9968da3 121 cmdlfjablotron.c \
5bce72d5 122 cmdlfnexwatch.c \
a9968da3 123 cmdlfnoralsy.c \
5bce72d5 124 cmdlfparadox.c \
c3caf040 125 cmdlfpcf7931.c \
126 cmdlfpresco.c \
127 cmdlfpyramid.c \
128 cmdlfsecurakey.c \
8b6abef5 129 cmdlft55xx.c \
130 cmdlfti.c \
131 cmdlfviking.c\
132 cmdlfvisa2000.c\
133 cmdparser.c \
134 cmdmain.c \
a0655c45 135 scripting.c\
806dc075 136 cmdscript.c\
8b6abef5 137 pm3_binlib.c\
77cd612f 138 pm3_bitlib.c\
1f6417a9 139 aes.c\
1defcf60 140 protocols.c\
1c4c0b06 141 sha1.c\
fe81b478 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\
28fdb04f 149
4b3f6d79 150ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
fb9acd45 151ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
8e074056 152#-DDEBUG -Dverbose=1
0fa01ec7 153
fb9acd45 154QTGUISRCS = proxgui.cpp proxguiqt.cpp proxguiqt.moc.cpp guidummy.cpp
a0655c45 155
759c16b3 156COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o)
46cd4046 157CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o)
f3919878 158ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o)
7fe9b0b7 159
fb9acd45 160BINS = proxmark3 flasher fpga_compress
161WINBINS = $(patsubst %, %.exe, $(BINS))
162CLEAN = $(BINS) $(WINBINS) $(COREOBJS) $(CMDOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(OBJDIR)/*.o *.moc.cpp
940a2012 163
fb9acd45 164all: lua_build $(BINS)
6658905f 165
709b784c 166all-static: LDLIBS:=-static $(LDLIBS)
fb9acd45 167all-static: proxmark3 flasher fpga_compress
f3919878 168
dc20a1f6 169proxmark3: LDLIBS+=$(LUALIB) $(QTLDLIBS)
fb9acd45 170proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) lualibs/usb_cmd.lua
171 $(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) $(LDLIBS) -o $@
db917a16 172
759c16b3 173flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS)
fb9acd45 174 $(LD) $(LDFLAGS) $^ $(LDLIBS) -o $@
46cd4046 175
f3919878 176fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS)
fb9acd45 177 $(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@
06735128 178
6658905f 179proxguiqt.moc.cpp: proxguiqt.h
180 $(MOC) -o$@ $^
181
fb9acd45 182lualibs/usb_cmd.lua: ../include/usb_cmd.h
183 awk -f usb_cmd_h2lua.awk $^ > $@
184
6658905f 185clean:
940a2012 186 $(RM) $(CLEAN)
3a4c72fe 187 cd ../liblua && make clean
6658905f 188
bd846386 189tarbin: $(BINS)
fb9acd45 190 $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
bd846386 191
806dc075 192lua_build:
30a46ed8 193 @echo Compiling liblua, using platform $(LUAPLATFORM)
194 cd ../liblua && make $(LUAPLATFORM)
806dc075 195
6658905f 196.PHONY: all clean
fb9acd45 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
3472ebe5 205 $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(QTINCLUDES) -c -o $@ $<
fb9acd45 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