mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
rework fpga_compress & isolate zlib: use Makefile.host
This commit is contained in:
parent
43ffed1a26
commit
6ebae499aa
4 changed files with 42 additions and 87 deletions
|
@ -28,7 +28,7 @@ FALSE = false
|
||||||
|
|
||||||
platform = $(shell uname)
|
platform = $(shell uname)
|
||||||
|
|
||||||
VPATH = ../common ../common/zlib uart
|
VPATH = ../common uart
|
||||||
OBJDIR = obj
|
OBJDIR = obj
|
||||||
|
|
||||||
LDLIBS ?= -L/usr/local/lib
|
LDLIBS ?= -L/usr/local/lib
|
||||||
|
@ -49,8 +49,10 @@ MBEDTLSLIBPATH = ../common/mbedtls
|
||||||
MBEDTLSLIB = $(MBEDTLSLIBPATH)/libmbedtls.a
|
MBEDTLSLIB = $(MBEDTLSLIBPATH)/libmbedtls.a
|
||||||
CBORLIBPATH = ./tinycbor
|
CBORLIBPATH = ./tinycbor
|
||||||
CBORLIB = $(CBORLIBPATH)/tinycbor.a
|
CBORLIB = $(CBORLIBPATH)/tinycbor.a
|
||||||
|
ZLIBPATH = ../common/zlib
|
||||||
|
ZLIB = $(ZLIBPATH)/libz.a
|
||||||
REVENGFLAGS = -DPRESETS
|
REVENGFLAGS = -DPRESETS
|
||||||
LIBS = -I../common/zlib -I$(LUALIBPATH) -I$(MBEDTLSLIBPATH) -I$(JANSSONLIBPATH) -I$(CBORLIBPATH)
|
LIBS = -I$(ZLIBPATH) -I$(LUALIBPATH) -I$(MBEDTLSLIBPATH) -I$(JANSSONLIBPATH) -I$(CBORLIBPATH)
|
||||||
INCLUDES_CLIENT = -I. -I../include -I../common -Iuart $(LIBS)
|
INCLUDES_CLIENT = -I. -I../include -I../common -Iuart $(LIBS)
|
||||||
CFLAGS ?= -Wall -Werror -g -O3
|
CFLAGS ?= -Wall -Werror -g -O3
|
||||||
# We cannot just use CFLAGS+=... because it has impact on sub-makes if CFLAGS is defined in env:
|
# We cannot just use CFLAGS+=... because it has impact on sub-makes if CFLAGS is defined in env:
|
||||||
|
@ -251,9 +253,6 @@ ifeq ($(MULTIARCHSRCS), )
|
||||||
CMDSRCS += hardnested/hardnested_bf_core.c hardnested/hardnested_bitarray_core.c
|
CMDSRCS += hardnested/hardnested_bf_core.c hardnested/hardnested_bitarray_core.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
|
|
||||||
ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
|
|
||||||
#-DDEBUG -Dverbose=1
|
|
||||||
|
|
||||||
REVENGSRCS = reveng/preset.c \
|
REVENGSRCS = reveng/preset.c \
|
||||||
reveng/reveng.c \
|
reveng/reveng.c \
|
||||||
|
@ -267,7 +266,6 @@ QTGUISRCS = proxgui.cpp proxguiqt.cpp proxguiqt.moc.cpp guidummy.cpp
|
||||||
COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o)
|
COREOBJS = $(CORESRCS:%.c=$(OBJDIR)/%.o)
|
||||||
CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o)
|
CMDOBJS = $(CMDSRCS:%.c=$(OBJDIR)/%.o)
|
||||||
OBJCOBJS = $(OBJCSRCS:%.m=$(OBJDIR)/%.o)
|
OBJCOBJS = $(OBJCSRCS:%.m=$(OBJDIR)/%.o)
|
||||||
ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o)
|
|
||||||
REVENGOBJS = $(REVENGSRCS:%.c=$(OBJDIR)/%.o)
|
REVENGOBJS = $(REVENGSRCS:%.c=$(OBJDIR)/%.o)
|
||||||
MULTIARCHOBJS = $(MULTIARCHSRCS:%.c=$(OBJDIR)/%_NOSIMD.o) \
|
MULTIARCHOBJS = $(MULTIARCHSRCS:%.c=$(OBJDIR)/%_NOSIMD.o) \
|
||||||
$(MULTIARCHSRCS:%.c=$(OBJDIR)/%_MMX.o) \
|
$(MULTIARCHSRCS:%.c=$(OBJDIR)/%_MMX.o) \
|
||||||
|
@ -293,18 +291,18 @@ ifeq "$(SUPPORTS_AVX512)" "True"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
BINS = proxmark3 flasher
|
BINS = proxmark3 flasher
|
||||||
CLEAN = $(BINS) $(DEPENDENCY_FILES) $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(ZLIBOBJS) $(REVENGOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h lualibs/pm3_cmd.lua lualibs/mf_default_keys.lua reveng/bmptst
|
CLEAN = $(BINS) $(DEPENDENCY_FILES) $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(REVENGOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(OBJDIR)/*.o *.moc.cpp ui/ui_overlays.h lualibs/pm3_cmd.lua lualibs/mf_default_keys.lua reveng/bmptst
|
||||||
|
|
||||||
# need to assign dependancies to build these first...
|
# need to assign dependancies to build these first...
|
||||||
all: lua_build jansson_build mbedtls_build cbor_build $(BINS)
|
all: zlib_build lua_build jansson_build mbedtls_build cbor_build $(BINS)
|
||||||
|
|
||||||
all-static: LDLIBS:=-static $(LDLIBS)
|
all-static: LDLIBS:=-static $(LDLIBS)
|
||||||
all-static: $(BINS)
|
all-static: $(BINS)
|
||||||
|
|
||||||
proxmark3: LDLIBS+=$(LUALIB) $(JANSSONLIB) $(MBEDTLSLIB) $(CBORLIB) $(QTLDLIBS)
|
proxmark3: LDLIBS+=$(ZLIB) $(LUALIB) $(JANSSONLIB) $(MBEDTLSLIB) $(CBORLIB) $(QTLDLIBS)
|
||||||
proxmark3: reveng/bmptst $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(ZLIBOBJS) $(REVENGOBJS) lualibs/pm3_cmd.lua lualibs/mf_default_keys.lua
|
proxmark3: reveng/bmptst $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(REVENGOBJS) lualibs/pm3_cmd.lua lualibs/mf_default_keys.lua
|
||||||
$(info [=] LD $@)
|
$(info [=] LD $@)
|
||||||
$(Q)$(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(ZLIBOBJS) $(REVENGOBJS) $(LDLIBS) -o $@
|
$(Q)$(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(REVENGOBJS) $(LDLIBS) -o $@
|
||||||
|
|
||||||
flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS) $(OBJCOBJS)
|
flasher: $(OBJDIR)/flash.o $(OBJDIR)/flasher.o $(COREOBJS) $(OBJCOBJS)
|
||||||
$(info [=] LD $@)
|
$(info [=] LD $@)
|
||||||
|
@ -330,6 +328,7 @@ lualibs/mf_default_keys.lua : default_keys.dic
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(Q)$(RM) $(CLEAN)
|
$(Q)$(RM) $(CLEAN)
|
||||||
|
$(Q)$(MAKE) --no-print-directory -C $(ZLIBPATH) clean
|
||||||
$(Q)$(MAKE) --no-print-directory -C $(LUALIBPATH) clean
|
$(Q)$(MAKE) --no-print-directory -C $(LUALIBPATH) clean
|
||||||
$(Q)$(MAKE) --no-print-directory -C $(JANSSONLIBPATH) clean
|
$(Q)$(MAKE) --no-print-directory -C $(JANSSONLIBPATH) clean
|
||||||
$(Q)$(MAKE) --no-print-directory -C $(MBEDTLSLIBPATH) clean
|
$(Q)$(MAKE) --no-print-directory -C $(MBEDTLSLIBPATH) clean
|
||||||
|
@ -339,6 +338,10 @@ tarbin: $(BINS)
|
||||||
$(info [=] TAR ../proxmark3-$(platform)-bin.tar)
|
$(info [=] TAR ../proxmark3-$(platform)-bin.tar)
|
||||||
$(Q)$(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
|
$(Q)$(TAR) $(TARFLAGS) ../proxmark3-$(platform)-bin.tar $(BINS:%=client/%) $(WINBINS:%=client/%)
|
||||||
|
|
||||||
|
zlib_build:
|
||||||
|
$(info [*] MAKE zlib)
|
||||||
|
$(Q)$(MAKE) --no-print-directory -C $(ZLIBPATH) all
|
||||||
|
|
||||||
lua_build:
|
lua_build:
|
||||||
$(info [*] MAKE liblua for $(LUAPLATFORM))
|
$(info [*] MAKE liblua for $(LUAPLATFORM))
|
||||||
$(Q)$(MAKE) --no-print-directory -C $(LUALIBPATH) $(LUAPLATFORM)
|
$(Q)$(MAKE) --no-print-directory -C $(LUALIBPATH) $(LUAPLATFORM)
|
||||||
|
@ -395,10 +398,11 @@ $(OBJDIR)/%_AVX512.o : %.c $(OBJDIR)/%_AVX512.d
|
||||||
$(Q)$(CC) $(DEPFLAGS:%.Td=%_AVX512.Td) $(PM3CFLAGS) $(HARD_SWITCH_AVX512) -c -o $@ $<
|
$(Q)$(CC) $(DEPFLAGS:%.Td=%_AVX512.Td) $(PM3CFLAGS) $(HARD_SWITCH_AVX512) -c -o $@ $<
|
||||||
$(Q)$(MV) -f $(OBJDIR)/$*_AVX512.Td $(OBJDIR)/$*_AVX512.d
|
$(Q)$(MV) -f $(OBJDIR)/$*_AVX512.Td $(OBJDIR)/$*_AVX512.d
|
||||||
|
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
|
$(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
|
||||||
$(info [-] CC $<)
|
$(info [-] CC $<)
|
||||||
$(Q)$(CC) $(DEPFLAGS) $(PM3CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
|
$(Q)$(CC) $(DEPFLAGS) $(PM3CFLAGS) -c -o $@ $<
|
||||||
$(Q)$(POSTCOMPILE)
|
$(Q)$(POSTCOMPILE)
|
||||||
|
|
||||||
%.o: %.cpp
|
%.o: %.cpp
|
||||||
|
@ -413,7 +417,7 @@ $(OBJDIR)/%.o : %.m $(OBJDIR)/%.d
|
||||||
$(Q)$(CC) $(DEPFLAGS) $(PM3CFLAGS) -c -o $@ $<
|
$(Q)$(CC) $(DEPFLAGS) $(PM3CFLAGS) -c -o $@ $<
|
||||||
$(Q)$(POSTCOMPILE)
|
$(Q)$(POSTCOMPILE)
|
||||||
|
|
||||||
DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(CORESRCS) $(CMDSRCS) $(ZLIBSRCS) $(REVENGSRCS)) \
|
DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(CORESRCS) $(CMDSRCS) $(REVENGSRCS)) \
|
||||||
$(patsubst %.o, %.d, $(MULTIARCHOBJS)) \
|
$(patsubst %.o, %.d, $(MULTIARCHOBJS)) \
|
||||||
$(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \
|
$(patsubst %.cpp, $(OBJDIR)/%.d, $(QTGUISRCS)) \
|
||||||
$(patsubst %.m, $(OBJDIR)/%.d, $(OBJCSRCS)) \
|
$(patsubst %.m, $(OBJDIR)/%.d, $(OBJCSRCS)) \
|
||||||
|
|
10
common/zlib/Makefile
Normal file
10
common/zlib/Makefile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
MYSRCPATHS = ../../common/zlib
|
||||||
|
MYSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
|
||||||
|
MYINCLUDES = -I../../common/zlib
|
||||||
|
MYCFLAGS = -std=c99 -D_ISOC99_SOURCE
|
||||||
|
MYDEFS = -DZ_SOLO -DNO_GZIP -DZLIB_PM3_TUNED
|
||||||
|
#-DDEBUG -Dverbose=1
|
||||||
|
|
||||||
|
LIB_A = libz.a
|
||||||
|
|
||||||
|
include ../../Makefile.host
|
|
@ -1,80 +1,21 @@
|
||||||
# Hide full compilation line:
|
MYSRCPATHS =
|
||||||
ifneq ($(V),1)
|
MYINCLUDES = -I../../common_fpga
|
||||||
Q?=@
|
MYCFLAGS = -std=c99 -D_ISOC99_SOURCE
|
||||||
endif
|
MYDEFS =
|
||||||
# To see full command lines, use make V=1
|
MYSRCS =
|
||||||
|
MYLIBS =
|
||||||
|
|
||||||
CC = gcc
|
ZLIBPATH = ../../common/zlib
|
||||||
CXX = g++
|
MYINCLUDES += -I$(ZLIBPATH)
|
||||||
LD = g++
|
MYLIBS += $(OBJDIR)/libz.a
|
||||||
RM = rm -f
|
|
||||||
MV = mv
|
|
||||||
CP = cp -a
|
|
||||||
|
|
||||||
platform = $(shell uname)
|
|
||||||
|
|
||||||
VPATH = ../../common/zlib
|
|
||||||
OBJDIR = obj
|
|
||||||
|
|
||||||
# RPi Zero gcc requires -latomic
|
|
||||||
# but MacOSX /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
|
|
||||||
# doesn't recognize option --as-needed
|
|
||||||
ifneq ($(platform),Darwin)
|
|
||||||
LDLIBS += -Wl,--as-needed -latomic -Wl,--no-as-needed
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIBS = -I../../common/zlib
|
|
||||||
INCLUDES_CLIENT = -I../../common_fpga $(LIBS)
|
|
||||||
|
|
||||||
CFLAGS += -std=c99 -D_ISOC99_SOURCE -DPRESETS $(INCLUDES_CLIENT) -Wall -Werror -g -O3
|
|
||||||
|
|
||||||
# Flags to generate temporary dependency files
|
|
||||||
DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td
|
|
||||||
# make temporary to final dependency files after successful compilation
|
|
||||||
POSTCOMPILE = $(MV) -f $(OBJDIR)/$*.Td $(OBJDIR)/$*.d
|
|
||||||
|
|
||||||
ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
|
|
||||||
ZLIBFLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
|
|
||||||
#-DDEBUG -Dverbose=1
|
|
||||||
|
|
||||||
ZLIBOBJS = $(ZLIBSRCS:%.c=$(OBJDIR)/%.o)
|
|
||||||
|
|
||||||
BINS = fpga_compress
|
BINS = fpga_compress
|
||||||
CLEAN = $(BINS) $(DEPENDENCY_FILES) $(ZLIBOBJS) $(OBJDIR)/*.o
|
|
||||||
# OSX Brew is expecting fpga_compress in client folder, some workaround for now:
|
|
||||||
ifeq ($(platform),Darwin)
|
|
||||||
CLEAN += $(foreach bin,$(BINS),../../client/$(bin))
|
|
||||||
endif
|
|
||||||
|
|
||||||
# need to assign dependancies to build these first...
|
ROOT_DIR:=$(dir $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
all: $(BINS)
|
|
||||||
|
|
||||||
all-static: LDLIBS:=-static $(LDLIBS)
|
include ../../Makefile.host
|
||||||
all-static: $(BINS)
|
|
||||||
|
|
||||||
fpga_compress: $(OBJDIR)/fpga_compress.o $(ZLIBOBJS)
|
|
||||||
$(info [=] LD $@)
|
|
||||||
$(Q)$(LD) $(LDFLAGS) $(ZLIBFLAGS) $^ $(LDLIBS) -o $@
|
|
||||||
# OSX Brew is expecting fpga_compress in client folder, some workaround for now:
|
|
||||||
ifeq ($(platform),Darwin)
|
|
||||||
$(Q)$(CP) $@ ../../client/
|
|
||||||
endif
|
|
||||||
|
|
||||||
clean:
|
|
||||||
$(Q)$(RM) $(CLEAN)
|
|
||||||
|
|
||||||
.PHONY: all clean
|
|
||||||
|
|
||||||
%.o: %.c
|
|
||||||
$(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
|
|
||||||
$(info [-] CC $<)
|
|
||||||
$(Q)$(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $<
|
|
||||||
$(Q)$(POSTCOMPILE)
|
|
||||||
|
|
||||||
DEPENDENCY_FILES = $(patsubst %.c, $(OBJDIR)/%.d, $(ZLIBSRCS)) $(OBJDIR)/fpga_compress.d
|
|
||||||
|
|
||||||
$(DEPENDENCY_FILES): ;
|
|
||||||
.PRECIOUS: $(DEPENDENCY_FILES)
|
|
||||||
|
|
||||||
-include $(DEPENDENCY_FILES)
|
|
||||||
|
|
||||||
|
fpga_compress: $(OBJDIR)/fpga_compress.o $(MYOBJS)
|
||||||
|
$(OBJDIR)/libz.a:
|
||||||
|
$(info [*] MAKE zlib)
|
||||||
|
$(Q)$(MAKE) --no-print-directory -C $(ZLIBPATH) OBJDIR=$(ROOT_DIR)$(OBJDIR) BINDIR=$(ROOT_DIR)$(OBJDIR) all
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue