allow common makefile options-defines (#635)
authormarshmellow42 <marshmellow42@users.noreply.github.com>
Sun, 5 Aug 2018 16:13:44 +0000 (12:13 -0400)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Sun, 5 Aug 2018 16:13:44 +0000 (18:13 +0200)
armsrc/Makefile
client/Makefile
common/Makefile_Enabled_Options.common [new file with mode: 0644]

index dea5d06c1b499b1e4abec9bd9386838626255ea7..3a7293e574a3ee7dbd44693950a7b2e659f01571 100644 (file)
@@ -10,10 +10,16 @@ APP_INCLUDES = apps.h
 
 #remove one of the following defines and comment out the relevant line
 #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 \
-                               -fno-strict-aliasing -ffunction-sections -fdata-sections
-#-DWITH_LCD
+APP_CFLAGS  = -DON_DEVICE \
+        -fno-strict-aliasing -ffunction-sections -fdata-sections
 
+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_LF = lfops.c hitag2.c hitagS.c lfsampling.c pcf7931.c lfdemod.c protocols.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_CRAPTO1 = crypto1.c des.c
 SRC_CRC = iso14443crc.c crc.c crc16.c crc32.c parity.c
-
 #the FPGA bitstream files. Note: order matters!
 FPGA_BITSTREAMS = fpga_lf.bit fpga_hf.bit
 
index 917dc767f8ee062ca487cc17b55919f34ec07229..2d256b72e46a53e8650c144228a005d798e48db4 100644 (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
 CXXFLAGS = -I../include -Wall -O3
 
+APP_CFLAGS =
+include ../common/Makefile_Enabled_Options.common
+CFLAGS += $(APP_CFLAGS)
+
 LUAPLATFORM = generic
 platform = $(shell uname)
 ifneq (,$(findstring MINGW,$(platform)))
@@ -37,32 +41,34 @@ else
        endif
 endif
 
-# Check for correctly configured Qt5
-QTINCLUDES = $(shell pkg-config --cflags Qt5Core Qt5Widgets 2>/dev/null)
-QTLDLIBS = $(shell pkg-config --libs Qt5Core Qt5Widgets 2>/dev/null)
-MOC = $(shell pkg-config --variable=host_bins Qt5Core)/moc
-UIC = $(shell pkg-config --variable=host_bins Qt5Core)/uic
-ifeq ($(QTINCLUDES), )
-# if Qt5 not found check for correctly configured Qt4  
-       QTINCLUDES = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null)
-       QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null)
-       MOC = $(shell pkg-config --variable=moc_location QtCore)
-       UIC = $(shell pkg-config --variable=uic_location QtCore)
-else
-       CXXFLAGS += -std=c++11 -fPIC
-endif
-ifeq ($(QTINCLUDES), )
-# if both pkg-config commands failed, search in common places
-       ifneq ($(QTDIR), )
-               QTINCLUDES = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui
-               QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4
-               ifneq ($(wildcard $(QTDIR)/include/QtWidgets),)
-                       QTINCLUDES += -I$(QTDIR)/include/QtWidgets
-                       QTLDLIBS = -L$(QTDIR)/lib -lQt5Widgets -lQt5Gui -lQt5Core
-                       CXXFLAGS += -std=c++11 -fPIC
+ifneq (,$(findstring WITH_GUI,$(APP_CFLAGS)))
+       # Check for correctly configured Qt5
+       QTINCLUDES = $(shell pkg-config --cflags Qt5Core Qt5Widgets 2>/dev/null)
+       QTLDLIBS = $(shell pkg-config --libs Qt5Core Qt5Widgets 2>/dev/null)
+       MOC = $(shell pkg-config --variable=host_bins Qt5Core)/moc
+       UIC = $(shell pkg-config --variable=host_bins Qt5Core)/uic
+       ifeq ($(QTINCLUDES), )
+       # if Qt5 not found check for correctly configured Qt4   
+               QTINCLUDES = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null)
+               QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null)
+               MOC = $(shell pkg-config --variable=moc_location QtCore)
+               UIC = $(shell pkg-config --variable=uic_location QtCore)
+       else
+               CXXFLAGS += -std=c++11 -fPIC
+       endif
+       ifeq ($(QTINCLUDES), )
+       # if both pkg-config commands failed, search in common places
+               ifneq ($(QTDIR), )
+                       QTINCLUDES = -I$(QTDIR)/include -I$(QTDIR)/include/QtCore -I$(QTDIR)/include/QtGui
+                       QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4
+                       ifneq ($(wildcard $(QTDIR)/include/QtWidgets),)
+                               QTINCLUDES += -I$(QTDIR)/include/QtWidgets
+                               QTLDLIBS = -L$(QTDIR)/lib -lQt5Widgets -lQt5Gui -lQt5Core
+                               CXXFLAGS += -std=c++11 -fPIC
+                       endif
+                       MOC = $(QTDIR)/bin/moc
+                       UIC = $(QTDIR)/bin/uic
                endif
-               MOC = $(QTDIR)/bin/moc
-               UIC = $(QTDIR)/bin/uic
        endif
 endif
 
@@ -79,6 +85,7 @@ DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td
 # make temporary to final dependeny files after successful compilation
 POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d
 
+
 CORESRCS =     uart_posix.c \
                        uart_win32.c \
                        util.c \
@@ -303,6 +310,7 @@ DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(CORESRCS) $(CMDSRCS) $(ZLIBS
        $(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \
        $(OBJDIR)/proxmark3.d $(OBJDIR)/flash.d $(OBJDIR)/flasher.d $(OBJDIR)/fpga_compress.d
 
+
 $(DEPENDENCY_FILES): ;
 .PRECIOUS: $(DEPENDENCY_FILES)
 
diff --git a/common/Makefile_Enabled_Options.common b/common/Makefile_Enabled_Options.common
new file mode 100644 (file)
index 0000000..acb413b
--- /dev/null
@@ -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...
Impressum, Datenschutz