]> git.zerfleddert.de Git - proxmark3-svn/blob - client/Makefile
Merge pull request #268 from marshmellow42/master
[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 -O4
23 LUAPLATFORM = generic
24
25 platform = $(shell uname)
26 ifneq (,$(findstring MINGW,$(platform)))
27 CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui
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
34 MOC = $(QTDIR)/bin/moc
35 LUAPLATFORM = mingw
36 else
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
52 endif
53
54 ifneq ($(QTLDLIBS),)
55 QTGUIOBJS = $(OBJDIR)/proxgui.o $(OBJDIR)/proxguiqt.o $(OBJDIR)/proxguiqt.moc.o
56 CFLAGS += -DHAVE_GUI
57 else
58 QTGUIOBJS = $(OBJDIR)/guidummy.o
59 endif
60
61 # Flags to generate temporary dependency files
62 DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td
63 # make temporary to final dependeny files after successful compilation
64 POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d
65
66 CORESRCS = uart.c \
67 util.c
68
69 CMDSRCS = crapto1/crapto1.c\
70 crapto1/crypto1.c\
71 mfkey.c\
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\
78 whereami.c\
79 mifarehost.c\
80 parity.c\
81 crc.c \
82 crc16.c \
83 crc64.c \
84 iso14443crc.c \
85 iso15693tools.c \
86 data.c \
87 graph.c \
88 ui.c \
89 cmddata.c \
90 lfdemod.c \
91 cmdhf.c \
92 cmdhf14a.c \
93 cmdhf14b.c \
94 cmdhf15.c \
95 cmdhfepa.c \
96 cmdhflegic.c \
97 cmdhficlass.c \
98 cmdhfmf.c \
99 cmdhfmfu.c \
100 cmdhftopaz.c \
101 cmdhw.c \
102 cmdlf.c \
103 cmdlfawid.c \
104 cmdlfcotag.c\
105 cmdlfem4x.c \
106 cmdlffdx.c \
107 cmdlfgproxii.c \
108 cmdlfhid.c \
109 cmdlfhitag.c \
110 cmdlfio.c \
111 cmdlfindala.c \
112 cmdlfjablotron.c \
113 cmdlfnexwatch.c \
114 cmdlfnoralsy.c \
115 cmdlfparadox.c \
116 cmdlfpcf7931.c \
117 cmdlfpresco.c \
118 cmdlfpyramid.c \
119 cmdlfsecurakey.c \
120 cmdlft55xx.c \
121 cmdlfti.c \
122 cmdlfviking.c\
123 cmdlfvisa2000.c\
124 cmdparser.c \
125 cmdmain.c \
126 scripting.c\
127 cmdscript.c\
128 pm3_binlib.c\
129 pm3_bitlib.c\
130 aes.c\
131 protocols.c\
132 sha1.c\
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\
140
141 ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
142 ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
143 #-DDEBUG -Dverbose=1
144
145 QTGUISRCS = proxgui.cpp proxguiqt.cpp proxguiqt.moc.cpp guidummy.cpp
146
147 COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o)
148 CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o)
149 ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o)
150
151 BINS = proxmark3 flasher fpga_compress
152 WINBINS = $(patsubst %, %.exe, $(BINS))
153 CLEAN = $(BINS) $(WINBINS) $(COREOBJS) $(CMDOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(OBJDIR)/*.o *.moc.cpp
154
155 all: lua_build $(BINS)
156
157 all-static: LDLIBS:=-static $(LDLIBS)
158 all-static: proxmark3 flasher fpga_compress
159
160 proxmark3: LDLIBS+=$(LUALIB) $(QTLDLIBS)
161 proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) lualibs/usb_cmd.lua
162 $(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) $(LDLIBS) -o $@
163
164 flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS)
165 $(LD) $(LDFLAGS) $^ $(LDLIBS) -o $@
166
167 fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS)
168 $(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@
169
170 proxguiqt.moc.cpp: proxguiqt.h
171 $(MOC) -o$@ $^
172
173 lualibs/usb_cmd.lua: ../include/usb_cmd.h
174 awk -f usb_cmd_h2lua.awk $^ > $@
175
176 clean:
177 $(RM) $(CLEAN)
178 cd ../liblua && make clean
179
180 tarbin: $(BINS)
181 $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
182
183 lua_build:
184 @echo Compiling liblua, using platform $(LUAPLATFORM)
185 cd ../liblua && make $(LUAPLATFORM)
186
187 .PHONY: all clean
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
212 DEPENDENCY_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