]> cvs.zerfleddert.de Git - proxmark3-svn/blame - client/Makefile
lf read adjustments
[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)
fb9acd45 22CFLAGS = -std=c99 -D_ISOC99_SOURCE -I. -I../include -I../common -I../zlib -I/opt/local/include -I../liblua -Wall $(COMMON_FLAGS) -g -O4
30a46ed8 23LUAPLATFORM = generic
8c04722d 24
fb9acd45 25platform = $(shell uname)
8691f5b7 26ifneq (,$(findstring MINGW,$(platform)))
8c04722d 27 CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui
8c04722d 28 ifneq ($(wildcard $(QTDIR)/include/QtWidgets),)
29 CXXFLAGS += -I$(QTDIR)/include/QtWidgets
30 QTLDLIBS = -L$(QTDIR)/lib -lQt5Core -lQt5Gui -lQt5Widgets
31 else
32 QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4
33 endif
fb9acd45 34 MOC = $(QTDIR)/bin/moc
35 LUAPLATFORM = mingw
8691f5b7 36else
fb9acd45 37 CXXFLAGS = $(shell pkg-config --cflags Qt5Core Qt5Widgets 2>/dev/null) -Wall -O4
38 QTLDLIBS = $(shell pkg-config --libs Qt5Core Qt5Widgets 2>/dev/null)
39 MOC = $(shell pkg-config --variable=host_bins Qt5Core)/moc
40 ifeq ($(QTLDLIBS), )
41 CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -O4
42 QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null)
43 MOC = $(shell pkg-config --variable=moc_location QtCore)
44 endif
45 ifeq ($(platform),Darwin)
46 LUAPLATFORM = macosx
47 else
48 LUALIB += -ldl
49 LDLIBS += -ltermcap -lncurses
50 LUAPLATFORM = linux
51 endif
62b1302c 52endif
53
245e844e 54ifneq ($(QTLDLIBS),)
fb9acd45 55 QTGUIOBJS = $(OBJDIR)/proxgui.o $(OBJDIR)/proxguiqt.o $(OBJDIR)/proxguiqt.moc.o
8c04722d 56 CFLAGS += -DHAVE_GUI
245e844e 57else
fb9acd45 58 QTGUIOBJS = $(OBJDIR)/guidummy.o
245e844e 59endif
62b1302c 60
fb9acd45 61# Flags to generate temporary dependency files
62DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td
63# make temporary to final dependeny files after successful compilation
64POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d
759c16b3 65
fb9acd45 66CORESRCS = uart.c \
67 util.c
759c16b3 68
33443e7c 69CMDSRCS = crapto1/crapto1.c\
70 crapto1/crypto1.c\
4cb4b588 71 mfkey.c\
db2b81ba 72 loclass/cipher.c \
73 loclass/cipherutils.c \
74 loclass/des.c \
75 loclass/ikeys.c \
76 loclass/elite_crack.c\
77 loclass/fileutils.c\
4197a3f6 78 whereami.c\
f397b5cc 79 mifarehost.c\
1f065e1d 80 parity.c\
9f7bbd24 81 crc.c \
91c38cf7 82 crc16.c \
d730878d 83 crc64.c \
91c38cf7 84 iso14443crc.c \
9455b51c 85 iso15693tools.c \
7fe9b0b7 86 data.c \
87 graph.c \
88 ui.c \
89 cmddata.c \
eb191de6 90 lfdemod.c \
7fe9b0b7 91 cmdhf.c \
92 cmdhf14a.c \
93 cmdhf14b.c \
94 cmdhf15.c \
5acd09bd 95 cmdhfepa.c \
7fe9b0b7 96 cmdhflegic.c \
cee5a30d 97 cmdhficlass.c \
9ca155ba 98 cmdhfmf.c \
fe81b478 99 cmdhfmfu.c \
db2b81ba 100 cmdhftopaz.c \
7fe9b0b7 101 cmdhw.c \
102 cmdlf.c \
dbf6e824 103 cmdlfawid.c \
8b6abef5 104 cmdlfcotag.c\
28fdb04f 105 cmdlfem4x.c \
4db6f3bb 106 cmdlffdx.c \
946a84c3 107 cmdlfgproxii.c \
8b6abef5 108 cmdlfhid.c \
db09cb3a 109 cmdlfhitag.c \
8b6abef5 110 cmdlfio.c \
0fb65a26 111 cmdlfindala.c \
a9968da3 112 cmdlfjablotron.c \
5bce72d5 113 cmdlfnexwatch.c \
a9968da3 114 cmdlfnoralsy.c \
5bce72d5 115 cmdlfparadox.c \
c3caf040 116 cmdlfpcf7931.c \
117 cmdlfpresco.c \
118 cmdlfpyramid.c \
119 cmdlfsecurakey.c \
8b6abef5 120 cmdlft55xx.c \
121 cmdlfti.c \
122 cmdlfviking.c\
123 cmdlfvisa2000.c\
124 cmdparser.c \
125 cmdmain.c \
a0655c45 126 scripting.c\
806dc075 127 cmdscript.c\
8b6abef5 128 pm3_binlib.c\
77cd612f 129 pm3_bitlib.c\
1f6417a9 130 aes.c\
1defcf60 131 protocols.c\
1c4c0b06 132 sha1.c\
fe81b478 133 cmdcrc.c\
134 reveng/reveng.c\
135 reveng/cli.c\
136 reveng/bmpbit.c\
137 reveng/model.c\
138 reveng/poly.c\
139 reveng/getopt.c\
28fdb04f 140
4b3f6d79 141ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
fb9acd45 142ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
8e074056 143#-DDEBUG -Dverbose=1
0fa01ec7 144
fb9acd45 145QTGUISRCS = proxgui.cpp proxguiqt.cpp proxguiqt.moc.cpp guidummy.cpp
a0655c45 146
759c16b3 147COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o)
46cd4046 148CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o)
f3919878 149ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o)
7fe9b0b7 150
fb9acd45 151BINS = proxmark3 flasher fpga_compress
152WINBINS = $(patsubst %, %.exe, $(BINS))
153CLEAN = $(BINS) $(WINBINS) $(COREOBJS) $(CMDOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(OBJDIR)/*.o *.moc.cpp
940a2012 154
fb9acd45 155all: lua_build $(BINS)
6658905f 156
709b784c 157all-static: LDLIBS:=-static $(LDLIBS)
fb9acd45 158all-static: proxmark3 flasher fpga_compress
f3919878 159
dc20a1f6 160proxmark3: LDLIBS+=$(LUALIB) $(QTLDLIBS)
fb9acd45 161proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) lualibs/usb_cmd.lua
162 $(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) $(LDLIBS) -o $@
db917a16 163
759c16b3 164flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS)
fb9acd45 165 $(LD) $(LDFLAGS) $^ $(LDLIBS) -o $@
46cd4046 166
f3919878 167fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS)
fb9acd45 168 $(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@
06735128 169
6658905f 170proxguiqt.moc.cpp: proxguiqt.h
171 $(MOC) -o$@ $^
172
fb9acd45 173lualibs/usb_cmd.lua: ../include/usb_cmd.h
174 awk -f usb_cmd_h2lua.awk $^ > $@
175
6658905f 176clean:
940a2012 177 $(RM) $(CLEAN)
3a4c72fe 178 cd ../liblua && make clean
6658905f 179
bd846386 180tarbin: $(BINS)
fb9acd45 181 $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
bd846386 182
806dc075 183lua_build:
30a46ed8 184 @echo Compiling liblua, using platform $(LUAPLATFORM)
185 cd ../liblua && make $(LUAPLATFORM)
806dc075 186
6658905f 187.PHONY: all clean
fb9acd45 188
189%.o: %.c
190$(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
191 $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
192 $(POSTCOMPILE)
193
194%.o: %.cpp
195$(OBJDIR)/%.o : %.cpp $(OBJDIR)/%.d
196 $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
197 $(POSTCOMPILE)
198
199
200#$(CMDOBJS) $(COREOBJS): $(notdir $(%.c)) %.d
201# $(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
202# $(POSTCOMPILE)
203
204#$(ZLIBOBJS): $(notdir $(%.c)) %.d
205# $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
206# $(POSTCOMPILE)
207
208#$(QTGUIOBJS): $(notdir $(%.cpp)) %.d
209# $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
210# $(POSTCOMPILE)
211
212DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(CORESRCS) $(CMDSRCS) $(ZLIBSRCS)) \
213 $(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \
214 $(OBJDIR)/proxmark3.d $(OBJDIR)/flash.d $(OBJDIR)/flasher.d $(OBJDIR)/fpga_compress.d
215
216$(DEPENDENCY_FILES): ;
217.PRECIOUS: $(DEPENDENCY_FILES)
218
219-include $(DEPENDENCY_FILES)
220
Impressum, Datenschutz