mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-12 00:06:09 -07:00
Move most rules to Makefile.common
Add automatic dependency generation Compile ISO14443 files in ARM mode, as was the case with the Linux Makefile before
This commit is contained in:
parent
97a82e8f36
commit
0fc0fca583
3 changed files with 68 additions and 34 deletions
|
@ -1,47 +1,49 @@
|
||||||
# Makefile for armsrc, see ../common/Makefile.common for common settings
|
# Makefile for armsrc, see ../common/Makefile.common for common settings
|
||||||
include ../common/Makefile.common
|
|
||||||
|
|
||||||
APP_INCLUDES = apps.h
|
APP_INCLUDES = apps.h
|
||||||
|
|
||||||
# Add the "-DWITH_LCD" flag in APP_CLFAGS to add support for LCD
|
# Add the "-DWITH_LCD" flag in APP_CLFAGS to add support for LCD
|
||||||
# and add OBJLCD to OBJ too
|
# and add SRC_LCD to SRC_MAIN
|
||||||
APP_CFLAGS = -O6
|
APP_CFLAGS = -O6
|
||||||
|
|
||||||
OBJLCD = $(OBJDIR)/fonts.o \
|
SRC_LCD = fonts.c LCD.c
|
||||||
$(OBJDIR)/LCD.o
|
|
||||||
|
|
||||||
OBJ = $(OBJDIR)/start.o \
|
SRC_MAIN = start.c \
|
||||||
$(OBJDIR)/appmain.o \
|
appmain.c \
|
||||||
$(OBJDIR)/fpga.o \
|
fpga.c \
|
||||||
$(OBJDIR)/lfops.o \
|
lfops.c \
|
||||||
$(OBJDIR)/iso14443.o \
|
iso15693.c \
|
||||||
$(OBJDIR)/iso14443a.o \
|
util.c \
|
||||||
$(OBJDIR)/iso15693.o \
|
usb.c
|
||||||
$(OBJDIR)/util.o \
|
|
||||||
$(OBJDIR)/usb.o
|
|
||||||
|
|
||||||
OBJFPGA = \
|
# These are to be compiled in ARM mode
|
||||||
$(OBJDIR)/fpgaimg.o
|
SRC_MAIN_FAST = iso14443.c \
|
||||||
|
iso14443a.c
|
||||||
|
|
||||||
|
SRC_FPGA = fpgaimg.c
|
||||||
|
|
||||||
|
THUMBSRC = $(SRC_MAIN) $(SRC_FPGA)
|
||||||
|
ARMSRC = $(SRC_MAIN_FAST)
|
||||||
|
|
||||||
|
MAIN_OBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(SRC_MAIN) $(SRC_MAIN_FAST))
|
||||||
|
|
||||||
|
# Do not move this inclusion before the definition of {THUMB,ASM,ARM}{OBJ,SRC}
|
||||||
|
include ../common/Makefile.common
|
||||||
|
|
||||||
all: $(OBJDIR)/osimage.s19 $(OBJDIR)/fpgaimage.s19
|
all: $(OBJDIR)/osimage.s19 $(OBJDIR)/fpgaimage.s19
|
||||||
|
|
||||||
$(OBJDIR)/fpgaimage.elf: $(OBJDIR)/fpgaimg.o
|
$(OBJDIR)/fpgaimage.elf: $(OBJDIR)/fpgaimg.o
|
||||||
$(LD) -g -Tldscript-fpga -Map=$(patsubst %.elf,%.map,$@) -o $@ $^
|
$(LD) -g -Tldscript-fpga -Map=$(patsubst %.elf,%.map,$@) -o $@ $^
|
||||||
|
|
||||||
$(OBJDIR)/osimage.elf: $(OBJ) $(OBJCOMMON) $(ARMLIB)/libgcc.a
|
$(OBJDIR)/osimage.elf: $(MAIN_OBJ) $(ARMLIB)/libgcc.a
|
||||||
$(LD) -g -Tldscript -Map=$(patsubst %.elf,%.map,$@) -o $@ $^
|
$(LD) -g -Tldscript -Map=$(patsubst %.elf,%.map,$@) -o $@ $^
|
||||||
|
|
||||||
$(OBJDIR)/%.s19: $(OBJDIR)/%.elf
|
|
||||||
$(OBJCOPY) -Osrec --srec-forceS3 $^ $@
|
|
||||||
|
|
||||||
$(OBJ) $(OBJFPGA): $(OBJDIR)/%.o: %.c $(INCLUDES)
|
|
||||||
$(CC) $(CFLAGS) -mthumb -mthumb-interwork $< -o $@
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(DELETE) $(OBJDIR)$(PATHSEP)*.o
|
$(DELETE) $(OBJDIR)$(PATHSEP)*.o
|
||||||
$(DELETE) $(OBJDIR)$(PATHSEP)*.elf
|
$(DELETE) $(OBJDIR)$(PATHSEP)*.elf
|
||||||
$(DELETE) $(OBJDIR)$(PATHSEP)*.s19
|
$(DELETE) $(OBJDIR)$(PATHSEP)*.s19
|
||||||
$(DELETE) $(OBJDIR)$(PATHSEP)*.map
|
$(DELETE) $(OBJDIR)$(PATHSEP)*.map
|
||||||
|
$(DELETE) $(OBJDIR)$(PATHSEP)*.d
|
||||||
|
|
||||||
.PHONY: all clean help
|
.PHONY: all clean help
|
||||||
help:
|
help:
|
||||||
|
@ -51,3 +53,4 @@ help:
|
||||||
@echo + osimage.s19 - The OS image
|
@echo + osimage.s19 - The OS image
|
||||||
@echo + fpgaimage.s19 - The FPGA image
|
@echo + fpgaimage.s19 - The FPGA image
|
||||||
@echo + clean - Clean $(OBJDIR)
|
@echo + clean - Clean $(OBJDIR)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# Makefile for bootrom, see ../common/Makefile.common for common settings
|
# Makefile for bootrom, see ../common/Makefile.common for common settings
|
||||||
include ../common/Makefile.common
|
|
||||||
|
|
||||||
OBJJTAG = $(OBJDIR)/bootrom.o $(OBJDIR)/ram-reset.o $(OBJDIR)/usb.o
|
OBJJTAG = $(OBJDIR)/bootrom.o $(OBJDIR)/ram-reset.o $(OBJDIR)/usb.o
|
||||||
OBJFLASH = $(OBJDIR)/flash-reset.o $(OBJDIR)/fromflash.o
|
OBJFLASH = $(OBJDIR)/flash-reset.o $(OBJDIR)/fromflash.o
|
||||||
|
@ -7,8 +6,8 @@ OBJFLASH = $(OBJDIR)/flash-reset.o $(OBJDIR)/fromflash.o
|
||||||
THUMBSRC = usb.c fromflash.c bootrom.c
|
THUMBSRC = usb.c fromflash.c bootrom.c
|
||||||
ASMSRC = ram-reset.s flash-reset.s
|
ASMSRC = ram-reset.s flash-reset.s
|
||||||
|
|
||||||
THUMBOBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(THUMBSRC))
|
# Do not move this inclusion before the definition of {THUMB,ASM,ARM}{OBJ,SRC}
|
||||||
ASMOBJ = $(patsubst %.s,$(OBJDIR)/%.o,$(ASMSRC))
|
include ../common/Makefile.common
|
||||||
|
|
||||||
all: bootrom-merged.s19
|
all: bootrom-merged.s19
|
||||||
|
|
||||||
|
@ -21,20 +20,12 @@ $(OBJDIR)/bootrom.elf: $(OBJFLASH)
|
||||||
$(OBJDIR)/bootrom-forjtag.elf: $(OBJJTAG)
|
$(OBJDIR)/bootrom-forjtag.elf: $(OBJJTAG)
|
||||||
$(LD) -g -Tldscript-ram-jtag --oformat elf32-littlearm -Map=$(patsubst %.elf,%.map,$@) -o $@ $^
|
$(LD) -g -Tldscript-ram-jtag --oformat elf32-littlearm -Map=$(patsubst %.elf,%.map,$@) -o $@ $^
|
||||||
|
|
||||||
$(OBJDIR)/%.s19: $(OBJDIR)/%.elf
|
|
||||||
$(OBJCOPY) -Osrec --srec-forceS3 $^ $@
|
|
||||||
|
|
||||||
$(THUMBOBJ): $(OBJDIR)/%.o: %.c $(INCLUDES)
|
|
||||||
$(CC) $(CFLAGS) -mthumb -mthumb-interwork -o $@ $<
|
|
||||||
|
|
||||||
$(ASMOBJ): $(OBJDIR)/%.o: %.s
|
|
||||||
$(CC) $(CFLAGS) -mthumb-interwork -o $@ $<
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(DELETE) $(OBJDIR)$(PATHSEP)*.o
|
$(DELETE) $(OBJDIR)$(PATHSEP)*.o
|
||||||
$(DELETE) $(OBJDIR)$(PATHSEP)*.elf
|
$(DELETE) $(OBJDIR)$(PATHSEP)*.elf
|
||||||
$(DELETE) $(OBJDIR)$(PATHSEP)*.s19
|
$(DELETE) $(OBJDIR)$(PATHSEP)*.s19
|
||||||
$(DELETE) $(OBJDIR)$(PATHSEP)*.map
|
$(DELETE) $(OBJDIR)$(PATHSEP)*.map
|
||||||
|
$(DELETE) $(OBJDIR)$(PATHSEP)*.d
|
||||||
$(DELETE) bootrom-merged.s19
|
$(DELETE) bootrom-merged.s19
|
||||||
|
|
||||||
.PHONY: all clean help
|
.PHONY: all clean help
|
||||||
|
|
|
@ -3,27 +3,38 @@
|
||||||
# Following is a short OS detection to set up variables, all the
|
# Following is a short OS detection to set up variables, all the
|
||||||
# remaining Makefile should be portable and only depend on these
|
# remaining Makefile should be portable and only depend on these
|
||||||
# variables
|
# variables
|
||||||
|
#
|
||||||
|
|
||||||
|
# Make sure that all is the default target
|
||||||
|
# (The including Makefile still needs to define what 'all' is)
|
||||||
|
all:
|
||||||
|
|
||||||
# Windows' echo echos its input verbatim, on Posix there is some
|
# Windows' echo echos its input verbatim, on Posix there is some
|
||||||
# amount of shell command line parsing going on. echo "" on
|
# amount of shell command line parsing going on. echo "" on
|
||||||
# Windows yields literal "", on Linux yields an empty line
|
# Windows yields literal "", on Linux yields an empty line
|
||||||
ifeq ($(shell echo ""),)
|
ifeq ($(shell echo ""),)
|
||||||
|
|
||||||
# This is properly a proper system, so we can use uname
|
# This is properly a proper system, so we can use uname
|
||||||
UNAME := $(shell uname)
|
UNAME := $(shell uname)
|
||||||
ifeq ($(UNAME), Linux)
|
ifeq ($(UNAME), Linux)
|
||||||
# Linux. (Todo: Add MacOS X if appropriate)
|
# Linux. (Todo: Add MacOS X if appropriate)
|
||||||
DELETE=rm -rf
|
DELETE=rm -rf
|
||||||
|
MOVE=mv
|
||||||
PATHSEP=/
|
PATHSEP=/
|
||||||
DETECTED_OS=Linux
|
DETECTED_OS=Linux
|
||||||
# You may/should set this in your environment
|
# You may/should set this in your environment
|
||||||
ARMLIB ?= /usr/local/lib/gcc/arm-elf/4.3.3/interwork
|
ARMLIB ?= /usr/local/lib/gcc/arm-elf/4.3.3/interwork
|
||||||
endif
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
# Assume that we are running on Windows.
|
# Assume that we are running on Windows.
|
||||||
DELETE=del /q
|
DELETE=del /q
|
||||||
|
MOVE=ren
|
||||||
PATHSEP=\\#
|
PATHSEP=\\#
|
||||||
ARMLIB ?= ../../devkitARM/lib/gcc/arm-elf/4.1.0/interwork
|
ARMLIB ?= ../../devkitARM/lib/gcc/arm-elf/4.1.0/interwork
|
||||||
DETECTED_OS=Windows
|
DETECTED_OS=Windows
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CC = arm-elf-gcc
|
CC = arm-elf-gcc
|
||||||
|
@ -41,3 +52,32 @@ VPATH = . ../common/
|
||||||
INCLUDES = ../include/proxmark3.h ../include/at91sam7s128.h ../include/config_gpio.h ../include/usb_cmd.h $(APP_INCLUDES)
|
INCLUDES = ../include/proxmark3.h ../include/at91sam7s128.h ../include/config_gpio.h ../include/usb_cmd.h $(APP_INCLUDES)
|
||||||
|
|
||||||
CFLAGS = -c $(INCLUDE) -Wall $(APP_CFLAGS)
|
CFLAGS = -c $(INCLUDE) -Wall $(APP_CFLAGS)
|
||||||
|
|
||||||
|
THUMBOBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(THUMBSRC))
|
||||||
|
ARMOBJ = $(patsubst %.c,$(OBJDIR)/%.o,$(ARMSRC))
|
||||||
|
ASMOBJ = $(patsubst %.s,$(OBJDIR)/%.o,$(ASMSRC))
|
||||||
|
|
||||||
|
$(THUMBOBJ): $(OBJDIR)/%.o: %.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) -mthumb -mthumb-interwork -o $@ $<
|
||||||
|
|
||||||
|
$(ARMOBJ): $(OBJDIR)/%.o: %.c $(INCLUDES)
|
||||||
|
$(CC) $(CFLAGS) -mthumb-interwork -o $@ $<
|
||||||
|
|
||||||
|
$(ASMOBJ): $(OBJDIR)/%.o: %.s
|
||||||
|
$(CC) $(CFLAGS) -mthumb-interwork -o $@ $<
|
||||||
|
|
||||||
|
$(OBJDIR)/%.s19: $(OBJDIR)/%.elf
|
||||||
|
$(OBJCOPY) -Osrec --srec-forceS3 $^ $@
|
||||||
|
|
||||||
|
# Automatic dependency generation
|
||||||
|
DEPENDENCY_FILES = $(patsubst %.c,$(OBJDIR)/%.d,$(notdir $(THUMBSRC))) \
|
||||||
|
$(patsubst %.c,$(OBJDIR)/%.d,$(notdir $(ARMSRC))) \
|
||||||
|
$(patsubst %.s,$(OBJDIR)/%.d,$(notdir $(ASMSRC)))
|
||||||
|
|
||||||
|
$(DEPENDENCY_FILES): Makefile ../common/Makefile.common
|
||||||
|
$(OBJDIR)/%.d: %.c
|
||||||
|
$(CC) -MM -MT "$(@) $(@:.d=.o)" $(CFLAGS) $< > $@
|
||||||
|
$(OBJDIR)/%.d: %.s
|
||||||
|
$(CC) -MM -MT "$(@) $(@:.d=.o)" $(CFLAGS) $< > $@
|
||||||
|
|
||||||
|
-include $(DEPENDENCY_FILES)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue