Always save manually entered proxy values.
[Rockbox.git] / flash / bootloader / Makefile
blob6872fcbc994e4f63045a3e7dac95e7cf48e10be4
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
10 CC = sh-elf-gcc
11 LD = sh-elf-ld
12 AR = sh-elf-ar
13 AS = sh-elf-as
14 OC = sh-elf-objcopy
16 FIRMWARE := ../../firmware
17 TOOLSDIR=../../tools
19 TARGET = bootloader
20 LDS := $(TARGET).lds
23 ifndef PLATFORM
24 not_configured:
25 @echo "No platform given."
26 @echo "Use make PLATFORM=PLAYER|RECORDER|FM|ONDIO {NO_ROM=1}"
27 ##else
28 ##configured:
29 ## @echo "Building bootloader for platform "$(PLATFORM)
30 endif
33 INCLUDES= -I$(FIRMWARE)/export -I. -I$(OBJDIR)
34 DEFINES= -DPLATFORM_$(PLATFORM)
36 OBJDIR := .
38 CFLAGS = -O -W -Wall -m1 -nostdlib -ffreestanding -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(DEFINES)
39 AFLAGS += -small -relax
42 ifdef DEBUG
43 DEFINES := -DDEBUG
44 CFLAGS += -g
45 endif
47 SRC := $(wildcard *.c)
49 OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
51 ifdef NO_ROM
52 LINKFILE = $(OBJDIR)/no_rom.lds
53 ORIGIN = 0
54 DEFINES += -DNO_ROM
55 else
56 LINKFILE = $(OBJDIR)/$(TARGET).lds
57 ORIGIN = FFFF500
58 endif
60 $(OBJDIR)/$(TARGET).bin : $(OBJDIR)/$(TARGET).elf
61 $(OC) -O binary $(OBJDIR)/$(TARGET).elf $(OBJDIR)/$(TARGET).bin
62 $(TOOLSDIR)/sh2d $(OBJDIR)/$(TARGET).bin -o $(ORIGIN) > $(OBJDIR)/$(TARGET).asm
63 ifndef NO_ROM
64 $(TOOLSDIR)/scramble $(OBJDIR)/$(TARGET).bin $(OBJDIR)/$(TARGET).ajz
65 endif
67 $(OBJDIR)/$(TARGET).elf : $(OBJS)
68 $(CC) -Os -nostdlib -o $(OBJDIR)/$(TARGET).elf -L$(OBJDIR) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/$(TARGET).map
71 clean:
72 -rm -f \
73 $(OBJS) \
74 $(OBJDIR)/$(TARGET).asm \
75 $(OBJDIR)/$(TARGET).bin \
76 $(OBJDIR)/$(TARGET).ajz \
77 $(OBJDIR)/$(TARGET).elf \
78 $(OBJDIR)/$(TARGET).map