Makefile: allow alternative platforms, try make PLATFORM=foo

This commit is contained in:
Philippe Teuwen 2019-03-11 00:21:14 +01:00
commit 119e3f0ed9
5 changed files with 112 additions and 9 deletions

View file

@ -23,6 +23,23 @@ else
PATHSEP=\\#
endif
ifeq ($(PLATFORM),)
-include Makefile.platform
ifeq ($(PLATFORM),)
PLATFORM=PM3RDV4
else
${info using saved PLATFORM '$(PLATFORM)'}
endif
endif
include common/Makefile.hal
$(info ===================================================================)
$(info PLATFORM: $(PLATFORM))
$(info $(PLTNAME))
$(info Included supports: $(PLATFORM_DEFS))
$(info ===================================================================)
all clean: %: client/% bootrom/% armsrc/% recovery/% mfkey/% nonce2key/%
mfkey/%: FORCE

View file

@ -8,10 +8,27 @@
APP_INCLUDES = apps.h
# This Makefile might have been called directly, not via the root Makefile, so:
ifeq ($(PLTNAME),)
-include ../Makefile.platform
ifeq ($(PLATFORM),)
PLATFORM=PM3RDV4
else
${info using saved PLATFORM '$(PLATFORM)'}
endif
include ../common/Makefile.hal
$(info ===================================================================)
$(info PLATFORM: $(PLATFORM))
$(info $(PLTNAME))
$(info Included supports: $(PLATFORM_DEFS))
$(info ===================================================================)
endif
#remove one of the following defines and comment out the relevant line
#in the next section to remove that particular feature from compilation.
# NO space,TABs after the "\" sign.
APP_CFLAGS = -DWITH_CRC \
APP_CFLAGS = $(PLATFORM_DEFS) \
-DWITH_CRC \
-DON_DEVICE \
-DWITH_LF \
-DWITH_HITAG \
@ -21,8 +38,6 @@ APP_CFLAGS = -DWITH_CRC \
-DWITH_ISO14443a \
-DWITH_ICLASS \
-DWITH_FELICA \
-DWITH_FLASH \
-DWITH_SMARTCARD \
-DWITH_HFSNOOP \
-DWITH_LF_SAMYRUN \
-fno-strict-aliasing -ffunction-sections -fdata-sections

View file

@ -4,6 +4,22 @@
# the license.
#-----------------------------------------------------------------------------
# This Makefile might have been called directly, not via the root Makefile, so:
ifeq ($(PLTNAME),)
-include ../Makefile.platform
ifeq ($(PLATFORM),)
PLATFORM=PM3RDV4
else
${info using saved PLATFORM '$(PLATFORM)'}
endif
include ../common/Makefile.hal
$(info ===================================================================)
$(info PLATFORM: $(PLATFORM))
$(info $(PLTNAME))
$(info Included supports: $(PLATFORM_DEFS))
$(info ===================================================================)
endif
# reveng will compile without macros, but these may be useful:
# Add -DBMPMACRO to use bitmap size constant macros (edit config.h)
# Add -DNOFORCE to disable the -F switch
@ -90,8 +106,7 @@ else
QTGUIOBJS = $(OBJDIR)/guidummy.o
endif
# RDV40 flag enables flashmemory commands in client. comment out if you don't have rdv40
CFLAGS += -DWITH_FLASH -DWITH_SMARTCARD
CFLAGS += $(PLATFORM_DEFS)
# Flags to generate temporary dependency files
DEPFLAGS = -MT $@ -MMD -MP -MF $(OBJDIR)/$*.Td

View file

@ -21,13 +21,13 @@ platform = $(shell uname)
all:
CROSS ?= arm-none-eabi-
CC = $(CROSS)gcc
AS = $(CROSS)as
LD = $(CROSS)ld
CC = $(CROSS)gcc
AS = $(CROSS)as
LD = $(CROSS)ld
OBJCOPY = $(CROSS)objcopy
GZIP=gzip
OBJDIR = obj
OBJDIR = obj
INCLUDE = -I../include -I../common -I.

56
common/Makefile.hal Normal file
View file

@ -0,0 +1,56 @@
define KNOWN_PLATFORMS
+--------------------------------------------------------+
| PLATFORM | DESCRIPTION |
+--------------------------------------------------------+
| PM3RDV4 (def) | Proxmark3 rdv4 with AT91SAM7S512 |
+--------------------------------------------------------+
| PM3EVO | Proxmark3 EVO with AT91SAM7S512 |
+--------------------------------------------------------+
| PM3EASY | Proxmark3 rdv3 Easy with AT91SAM7S256 |
+--------------------------------------------------------+
| PM3RDV2 | Proxmark3 rdv2 with AT91SAM7S512 |
+--------------------------------------------------------+
| PM3OLD256 | Proxmark3 V1 with AT91SAM7S256 |
+--------------------------------------------------------+
| PM3OLD512 | Proxmark3 V1 with AT91SAM7S512 |
+--------------------------------------------------------+
Options to define platform:
(1) Run make with PLATFORM specified as follows:
make PLATFORM=PM3EASY
(2) Save a file called Makefile.platform with contents:
PLATFORM=PM3EASY
endef
PLTNAME = Unknown Platform
ifeq ($(PLATFORM),PM3RDV4)
MCU = AT91SAM7S512
PLATFORM_DEFS = -DWITH_SMARTCARD -DWITH_FLASH
PLTNAME = Proxmark3 rdv4
else ifeq ($(PLATFORM),PM3EVO)
MCU = AT91SAM7S512
PLTNAME = Proxmark3 EVO
else ifeq ($(PLATFORM),PM3EASY)
MCU = AT91SAM7S256
PLTNAME = Proxmark3 rdv3 Easy
else ifeq ($(PLATFORM),PM3RDV2)
MCU = AT91SAM7S512
PLTNAME = Proxmark3 rdv2
else ifeq ($(PLATFORM),PM3OLD256)
MCU = AT91SAM7S256
PLTNAME = Proxmark3 V1 with AT91SAM7S256
else ifeq ($(PLATFORM),PM3OLD512)
MCU = AT91SAM7S512
PLTNAME = Proxmark3 V1 with AT91SAM7S512
else
$(error Invalid or empty PLATFORM: $(PLATFORM). Known platforms: $(KNOWN_PLATFORMS))
endif
export PLATFORM
export PLTNAME
export MCU
export PLATFORM_DEFS