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:
henryk@ploetzli.ch 2009-08-26 17:34:19 +00:00
commit 0fc0fca583
3 changed files with 68 additions and 34 deletions

View file

@ -1,47 +1,49 @@
# Makefile for armsrc, see ../common/Makefile.common for common settings
include ../common/Makefile.common
APP_INCLUDES = apps.h
# 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
OBJLCD = $(OBJDIR)/fonts.o \
$(OBJDIR)/LCD.o
SRC_LCD = fonts.c LCD.c
OBJ = $(OBJDIR)/start.o \
$(OBJDIR)/appmain.o \
$(OBJDIR)/fpga.o \
$(OBJDIR)/lfops.o \
$(OBJDIR)/iso14443.o \
$(OBJDIR)/iso14443a.o \
$(OBJDIR)/iso15693.o \
$(OBJDIR)/util.o \
$(OBJDIR)/usb.o
SRC_MAIN = start.c \
appmain.c \
fpga.c \
lfops.c \
iso15693.c \
util.c \
usb.c
OBJFPGA = \
$(OBJDIR)/fpgaimg.o
# These are to be compiled in ARM mode
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
$(OBJDIR)/fpgaimage.elf: $(OBJDIR)/fpgaimg.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 $@ $^
$(OBJDIR)/%.s19: $(OBJDIR)/%.elf
$(OBJCOPY) -Osrec --srec-forceS3 $^ $@
$(OBJ) $(OBJFPGA): $(OBJDIR)/%.o: %.c $(INCLUDES)
$(CC) $(CFLAGS) -mthumb -mthumb-interwork $< -o $@
clean:
$(DELETE) $(OBJDIR)$(PATHSEP)*.o
$(DELETE) $(OBJDIR)$(PATHSEP)*.elf
$(DELETE) $(OBJDIR)$(PATHSEP)*.s19
$(DELETE) $(OBJDIR)$(PATHSEP)*.map
$(DELETE) $(OBJDIR)$(PATHSEP)*.d
.PHONY: all clean help
help:
@ -51,3 +53,4 @@ help:
@echo + osimage.s19 - The OS image
@echo + fpgaimage.s19 - The FPGA image
@echo + clean - Clean $(OBJDIR)