allow common makefile options-defines (#635)

This commit is contained in:
marshmellow42 2018-08-05 12:13:44 -04:00 committed by pwpiwi
commit 5125e4263c
3 changed files with 82 additions and 29 deletions

View file

@ -10,10 +10,16 @@ APP_INCLUDES = apps.h
#remove one of the following defines and comment out the relevant line #remove one of the following defines and comment out the relevant line
#in the next section to remove that particular feature from compilation #in the next section to remove that particular feature from compilation
APP_CFLAGS = -DWITH_ISO14443a_StandAlone -DWITH_LF -DWITH_ISO15693 -DWITH_ISO14443a -DWITH_ISO14443b -DWITH_ICLASS -DWITH_LEGICRF -DWITH_HITAG -DWITH_CRC -DON_DEVICE -DWITH_HFSNOOP \ APP_CFLAGS = -DON_DEVICE \
-fno-strict-aliasing -ffunction-sections -fdata-sections -fno-strict-aliasing -ffunction-sections -fdata-sections
#-DWITH_LCD
include ../common/Makefile_Enabled_Options.common
ifneq (,$(findstring LCD,$(APP_CFLAGS)))
SRC_LCD = fonts.c LCD.c
else
SRC_LCD =
endif
#SRC_LCD = fonts.c LCD.c #SRC_LCD = fonts.c LCD.c
SRC_LF = lfops.c hitag2.c hitagS.c lfsampling.c pcf7931.c lfdemod.c protocols.c SRC_LF = lfops.c hitag2.c hitagS.c lfsampling.c pcf7931.c lfdemod.c protocols.c
SRC_ISO15693 = iso15693.c iso15693tools.c SRC_ISO15693 = iso15693.c iso15693tools.c
@ -21,7 +27,6 @@ SRC_ISO14443a = epa.c iso14443a.c mifareutil.c mifarecmd.c mifaresniff.c mifares
SRC_ISO14443b = iso14443b.c SRC_ISO14443b = iso14443b.c
SRC_CRAPTO1 = crypto1.c des.c SRC_CRAPTO1 = crypto1.c des.c
SRC_CRC = iso14443crc.c crc.c crc16.c crc32.c parity.c SRC_CRC = iso14443crc.c crc.c crc16.c crc32.c parity.c
#the FPGA bitstream files. Note: order matters! #the FPGA bitstream files. Note: order matters!
FPGA_BITSTREAMS = fpga_lf.bit fpga_hf.bit FPGA_BITSTREAMS = fpga_lf.bit fpga_hf.bit

View file

@ -23,6 +23,10 @@ LDFLAGS = $(ENV_LDFLAGS)
CFLAGS = $(ENV_CFLAGS) -std=c99 -D_ISOC99_SOURCE -I. -I../include -I../common -I../common/polarssl -I../zlib -I../uart -I/opt/local/include -I../liblua -Wall -g -O3 CFLAGS = $(ENV_CFLAGS) -std=c99 -D_ISOC99_SOURCE -I. -I../include -I../common -I../common/polarssl -I../zlib -I../uart -I/opt/local/include -I../liblua -Wall -g -O3
CXXFLAGS = -I../include -Wall -O3 CXXFLAGS = -I../include -Wall -O3
APP_CFLAGS =
include ../common/Makefile_Enabled_Options.common
CFLAGS += $(APP_CFLAGS)
LUAPLATFORM = generic LUAPLATFORM = generic
platform = $(shell uname) platform = $(shell uname)
ifneq (,$(findstring MINGW,$(platform))) ifneq (,$(findstring MINGW,$(platform)))
@ -37,32 +41,34 @@ else
endif endif
endif endif
# Check for correctly configured Qt5 ifneq (,$(findstring WITH_GUI,$(APP_CFLAGS)))
QTINCLUDES = $(shell pkg-config --cflags Qt5Core Qt5Widgets 2>/dev/null) # Check for correctly configured Qt5
QTLDLIBS = $(shell pkg-config --libs Qt5Core Qt5Widgets 2>/dev/null) QTINCLUDES = $(shell pkg-config --cflags Qt5Core Qt5Widgets 2>/dev/null)
MOC = $(shell pkg-config --variable=host_bins Qt5Core)/moc QTLDLIBS = $(shell pkg-config --libs Qt5Core Qt5Widgets 2>/dev/null)
UIC = $(shell pkg-config --variable=host_bins Qt5Core)/uic MOC = $(shell pkg-config --variable=host_bins Qt5Core)/moc
ifeq ($(QTINCLUDES), ) UIC = $(shell pkg-config --variable=host_bins Qt5Core)/uic
# if Qt5 not found check for correctly configured Qt4 ifeq ($(QTINCLUDES), )
QTINCLUDES = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) # if Qt5 not found check for correctly configured Qt4
QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null) QTINCLUDES = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null)
MOC = $(shell pkg-config --variable=moc_location QtCore) QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null)
UIC = $(shell pkg-config --variable=uic_location QtCore) MOC = $(shell pkg-config --variable=moc_location QtCore)
else UIC = $(shell pkg-config --variable=uic_location QtCore)
CXXFLAGS += -std=c++11 -fPIC else
endif CXXFLAGS += -std=c++11 -fPIC
ifeq ($(QTINCLUDES), ) endif
# if both pkg-config commands failed, search in common places ifeq ($(QTINCLUDES), )
ifneq ($(QTDIR), ) # if both pkg-config commands failed, search in common places
QTINCLUDES = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui ifneq ($(QTDIR), )
QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4 QTINCLUDES = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui
ifneq ($(wildcard $(QTDIR)/include/QtWidgets),) QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4
QTINCLUDES += -I$(QTDIR)/include/QtWidgets ifneq ($(wildcard $(QTDIR)/include/QtWidgets),)
QTLDLIBS = -L$(QTDIR)/lib -lQt5Widgets -lQt5Gui -lQt5Core QTINCLUDES += -I$(QTDIR)/include/QtWidgets
CXXFLAGS += -std=c++11 -fPIC QTLDLIBS = -L$(QTDIR)/lib -lQt5Widgets -lQt5Gui -lQt5Core
CXXFLAGS += -std=c++11 -fPIC
endif
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
endif endif
MOC = $(QTDIR)/bin/moc
UIC = $(QTDIR)/bin/uic
endif endif
endif endif
@ -79,6 +85,7 @@ DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td
# make temporary to final dependeny files after successful compilation # make temporary to final dependeny files after successful compilation
POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d
CORESRCS = uart_posix.c \ CORESRCS = uart_posix.c \
uart_win32.c \ uart_win32.c \
util.c \ util.c \
@ -303,6 +310,7 @@ DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(CORESRCS) $(CMDSRCS) $(ZLIBS
$(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \ $(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \
$(OBJDIR)/proxmark3.d $(OBJDIR)/flash.d $(OBJDIR)/flasher.d $(OBJDIR)/fpga_compress.d $(OBJDIR)/proxmark3.d $(OBJDIR)/flash.d $(OBJDIR)/flasher.d $(OBJDIR)/fpga_compress.d
$(DEPENDENCY_FILES): ; $(DEPENDENCY_FILES): ;
.PRECIOUS: $(DEPENDENCY_FILES) .PRECIOUS: $(DEPENDENCY_FILES)

View file

@ -0,0 +1,40 @@
#NOTES:
# Do not put any comments inside the definition below (before the final flag)
# All definition lines except the last must end in a \
#
#BEGIN
APP_CFLAGS += -DWITH_ISO14443a_StandAlone \
-DWITH_ISO15693 \
-DWITH_ISO14443a \
-DWITH_ISO14443b \
-DWITH_ICLASS \
-DWITH_LEGICRF \
-DWITH_HITAG \
-DWITH_CRC \
-DWITH_HFSNOOP \
-DWITH_GUI
#END
### Standalone modes:
#-DWITH_ISO14443a_StandAlone
#-DWITH_LF
#
# if both WITH_LF and WITH_ISO4443a_StandAlone are defined
# ISO14443a_StandAlone will be the only one that runs
# You must remove it and define WITH_LF for LF standalone mode
### Other options:
#-DWITH_ISO15693 \ Include ISO15693 support in build
#-DWITH_ISO14443a \ include ISO14443a support in build
#-DWITH_ISO14443b \ include ISO14443b support in build
#-DWITH_ICLASS \ include ICLASS support in build
#-DWITH_LEGICRF \ include LEGIC support in build
#-DWITH_HITAG \ include HITAG support in build
#-DWITH_CRC \ include CRC support in build
#-DWITH_HFSNOOP \ include HFSNOOP support in build
#-DWITH_SMARTCARD \ include SMARTCARD support in build
#-DWITH_GUI \ include QT GUI/Graph support in build
#-DWITH_LCD \ include LCD support in build (experimental?)
#marshmellow NOTE: tested GUI, and SMARTCARD removal only...