]> git.zerfleddert.de Git - proxmark3-svn/blame - client/Makefile
cannot seem to get uic to work for ...
[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
27882d37 43UIC = $(shell pkg-config --variable=host_bins Qt5Core)/uic
3472ebe5 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)
27882d37 49 UIC = $(shell pkg-config --variable=uic_location QtCore)
3472ebe5 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
27882d37 61 UIC = $(QTDIR)/bin/uic
3472ebe5 62 endif
63endif
64
65
66ifneq ($(QTLDLIBS), )
fb9acd45 67 QTGUIOBJS = $(OBJDIR)/proxgui.o $(OBJDIR)/proxguiqt.o $(OBJDIR)/proxguiqt.moc.o
8c04722d 68 CFLAGS += -DHAVE_GUI
245e844e 69else
fb9acd45 70 QTGUIOBJS = $(OBJDIR)/guidummy.o
245e844e 71endif
62b1302c 72
fb9acd45 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
759c16b3 77
fb9acd45 78CORESRCS = uart.c \
79 util.c
759c16b3 80
33443e7c 81CMDSRCS = crapto1/crapto1.c\
82 crapto1/crypto1.c\
4cb4b588 83 mfkey.c\
db2b81ba 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\
4197a3f6 90 whereami.c\
f397b5cc 91 mifarehost.c\
1f065e1d 92 parity.c\
9f7bbd24 93 crc.c \
91c38cf7 94 crc16.c \
d730878d 95 crc64.c \
91c38cf7 96 iso14443crc.c \
9455b51c 97 iso15693tools.c \
7fe9b0b7 98 data.c \
99 graph.c \
100 ui.c \
101 cmddata.c \
eb191de6 102 lfdemod.c \
7fe9b0b7 103 cmdhf.c \
104 cmdhf14a.c \
105 cmdhf14b.c \
106 cmdhf15.c \
5acd09bd 107 cmdhfepa.c \
7fe9b0b7 108 cmdhflegic.c \
cee5a30d 109 cmdhficlass.c \
9ca155ba 110 cmdhfmf.c \
fe81b478 111 cmdhfmfu.c \
db2b81ba 112 cmdhftopaz.c \
7fe9b0b7 113 cmdhw.c \
114 cmdlf.c \
dbf6e824 115 cmdlfawid.c \
8b6abef5 116 cmdlfcotag.c\
28fdb04f 117 cmdlfem4x.c \
4db6f3bb 118 cmdlffdx.c \
946a84c3 119 cmdlfgproxii.c \
8b6abef5 120 cmdlfhid.c \
db09cb3a 121 cmdlfhitag.c \
8b6abef5 122 cmdlfio.c \
0fb65a26 123 cmdlfindala.c \
a9968da3 124 cmdlfjablotron.c \
5bce72d5 125 cmdlfnexwatch.c \
a9968da3 126 cmdlfnoralsy.c \
5bce72d5 127 cmdlfparadox.c \
c3caf040 128 cmdlfpcf7931.c \
129 cmdlfpresco.c \
130 cmdlfpyramid.c \
131 cmdlfsecurakey.c \
8b6abef5 132 cmdlft55xx.c \
133 cmdlfti.c \
134 cmdlfviking.c\
135 cmdlfvisa2000.c\
136 cmdparser.c \
137 cmdmain.c \
a0655c45 138 scripting.c\
806dc075 139 cmdscript.c\
8b6abef5 140 pm3_binlib.c\
77cd612f 141 pm3_bitlib.c\
1f6417a9 142 aes.c\
1defcf60 143 protocols.c\
1c4c0b06 144 sha1.c\
fe81b478 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\
28fdb04f 152
4b3f6d79 153ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
fb9acd45 154ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
8e074056 155#-DDEBUG -Dverbose=1
0fa01ec7 156
fb9acd45 157QTGUISRCS = proxgui.cpp proxguiqt.cpp proxguiqt.moc.cpp guidummy.cpp
a0655c45 158
759c16b3 159COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o)
46cd4046 160CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o)
f3919878 161ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o)
7fe9b0b7 162
fb9acd45 163BINS = proxmark3 flasher fpga_compress
164WINBINS = $(patsubst %, %.exe, $(BINS))
b760f0ff 165CLEAN = $(BINS) $(WINBINS) $(COREOBJS) $(CMDOBJS) $(ZLIBOBJS) $(QTGUIOBJS) $(OBJDIR)/*.o *.moc.cpp
166#./ui/ui_overlays.h
940a2012 167
fb9acd45 168all: lua_build $(BINS)
6658905f 169
709b784c 170all-static: LDLIBS:=-static $(LDLIBS)
fb9acd45 171all-static: proxmark3 flasher fpga_compress
f3919878 172
dc20a1f6 173proxmark3: LDLIBS+=$(LUALIB) $(QTLDLIBS)
fb9acd45 174proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) lualibs/usb_cmd.lua
175 $(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(QTGUIOBJS) $(LDLIBS) -o $@
db917a16 176
759c16b3 177flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS)
fb9acd45 178 $(LD) $(LDFLAGS) $^ $(LDLIBS) -o $@
46cd4046 179
f3919878 180fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS)
fb9acd45 181 $(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@
06735128 182
6658905f 183proxguiqt.moc.cpp: proxguiqt.h
184 $(MOC) -o$@ $^
185
b760f0ff 186#cannot seem to get this to work accross qt versions...
187#ui/ui_overlays.h: ./ui/overlays.ui
188# $(UIC) $^ > $@
27882d37 189
fb9acd45 190lualibs/usb_cmd.lua: ../include/usb_cmd.h
191 awk -f usb_cmd_h2lua.awk $^ > $@
192
6658905f 193clean:
940a2012 194 $(RM) $(CLEAN)
3a4c72fe 195 cd ../liblua && make clean
6658905f 196
bd846386 197tarbin: $(BINS)
fb9acd45 198 $(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
bd846386 199
806dc075 200lua_build:
30a46ed8 201 @echo Compiling liblua, using platform $(LUAPLATFORM)
202 cd ../liblua && make $(LUAPLATFORM)
806dc075 203
6658905f 204.PHONY: all clean
fb9acd45 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
3472ebe5 213 $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(QTINCLUDES) -c -o $@ $<
fb9acd45 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