]> git.zerfleddert.de Git - proxmark3-svn/blame_incremental - client/Makefile
new grid X offset calcs to fix some issues
[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
43UIC = $(shell pkg-config --variable=host_bins Qt5Core)/uic
44ifeq ($(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)
50endif
51ifeq ($(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
63endif
64
65
66ifneq ($(QTLDLIBS), )
67 QTGUIOBJS = $(OBJDIR)/proxgui.o $(OBJDIR)/proxguiqt.o $(OBJDIR)/proxguiqt.moc.o
68 CFLAGS += -DHAVE_GUI
69else
70 QTGUIOBJS = $(OBJDIR)/guidummy.o
71endif
72
73# Flags to generate temporary dependency files
74DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td
75# make temporary to final dependeny files after successful compilation
76POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d
77
78CORESRCS = uart.c \
79 util.c
80
81CMDSRCS = 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
153ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
154ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
155#-DDEBUG -Dverbose=1
156
157QTGUISRCS = proxgui.cpp proxguiqt.cpp proxguiqt.moc.cpp guidummy.cpp
158
159COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o)
160CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o)
161ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o)
162
163BINS = proxmark3 flasher fpga_compress
164WINBINS = $(patsubst %, %.exe, $(BINS))
165CLEAN = $(BINS) $(WINBINS) $(COREOBJS) $(CMDOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(OBJDIR)/*.o *.moc.cpp
166#./ui/ui_overlays.h
167
168all: lua_build $(BINS)
169
170all-static: LDLIBS:=-static $(LDLIBS)
171all-static: proxmark3 flasher fpga_compress
172
173proxmark3: LDLIBS+=$(LUALIB) $(QTLDLIBS)
174proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) lualibs/usb_cmd.lua
175 $(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) $(LDLIBS) -o $@
176
177flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS)
178 $(LD) $(LDFLAGS) $^ $(LDLIBS) -o $@
179
180fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS)
181 $(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@
182
183proxguiqt.moc.cpp: proxguiqt.h
184 $(MOC) -o$@ $^
185
186#cannot seem to get this to work accross qt versions...
187#ui/ui_overlays.h: ./ui/overlays.ui
188# $(UIC) $^ > $@
189
190lualibs/usb_cmd.lua: ../include/usb_cmd.h
191 awk -f usb_cmd_h2lua.awk $^ > $@
192
193clean:
194 $(RM) $(CLEAN)
195 cd ../liblua && make clean
196
197tarbin: $(BINS)
198 $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
199
200lua_build:
201 @echo Compiling liblua, using platform $(LUAPLATFORM)
202 cd ../liblua && make $(LUAPLATFORM)
203
204.PHONY: all clean
205
206%.o: %.c
207$(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
208 $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
209 $(POSTCOMPILE)
210
211%.o: %.cpp
212$(OBJDIR)/%.o : %.cpp $(OBJDIR)/%.d
213 $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(QTINCLUDES) -c -o $@ $<
214 $(POSTCOMPILE)
215
216
217#$(CMDOBJS) $(COREOBJS): $(notdir $(%.c)) %.d
218# $(CC) $(DEPFLAGS) $(CFLAGS) -c -o $@ $<
219# $(POSTCOMPILE)
220
221#$(ZLIBOBJS): $(notdir $(%.c)) %.d
222# $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
223# $(POSTCOMPILE)
224
225#$(QTGUIOBJS): $(notdir $(%.cpp)) %.d
226# $(CXX) $(DEPFLAGS) $(CXXFLAGS) -c -o $@ $<
227# $(POSTCOMPILE)
228
229DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(CORESRCS) $(CMDSRCS) $(ZLIBSRCS)) \
230 $(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \
231 $(OBJDIR)/proxmark3.d $(OBJDIR)/flash.d $(OBJDIR)/flasher.d $(OBJDIR)/fpga_compress.d
232
233$(DEPENDENCY_FILES): ;
234.PRECIOUS: $(DEPENDENCY_FILES)
235
236-include $(DEPENDENCY_FILES)
237
Impressum, Datenschutz