Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 1 | # __________ __ ___. |
| 2 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 3 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 4 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 5 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 6 | # \/ \/ \/ \/ \/ |
| 7 | # $Id$ |
| 8 | # |
| 9 | |
Linus Nielsen Feltzing | eed02be | 2006-03-07 12:45:45 +0000 | [diff] [blame] | 10 | INCLUDES= $(TARGET_INC) -I$(FIRMDIR)/include -I$(FIRMDIR)/export -I. -I$(OBJDIR) \ |
Barry Wardell | 940091a | 2008-05-05 12:05:00 +0000 | [diff] [blame] | 11 | -I$(BUILDDIR) -I$(BUILDDIR)/bitmaps |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 12 | |
Daniel Stenberg | e2c140e | 2005-01-28 23:25:40 +0000 | [diff] [blame] | 13 | DEPFILE = $(OBJDIR)/dep-bootloader |
Marcoen Hirschberg | 82c5230 | 2008-03-27 23:58:03 +0000 | [diff] [blame] | 14 | LDS := $(FIRMDIR)/target/$(CPU)/$(MANUFACTURER)/boot.lds |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 15 | |
Barry Wardell | 940091a | 2008-05-05 12:05:00 +0000 | [diff] [blame] | 16 | # Set up the bitmap libraries |
| 17 | BITMAPLIBS = |
| 18 | LINKBITMAPS = |
| 19 | ifneq ($(strip $(BMP2RB_MONO)),) |
| 20 | BITMAPLIBS += $(BUILDDIR)/libbitmapsmono.a |
| 21 | LINKBITMAPS += -lbitmapsmono |
| 22 | endif |
| 23 | ifneq ($(strip $(BMP2RB_NATIVE)),) |
| 24 | BITMAPLIBS += $(BUILDDIR)/libbitmapsnative.a |
| 25 | LINKBITMAPS += -lbitmapsnative |
| 26 | endif |
| 27 | ifneq ($(strip $(BMP2RB_REMOTEMONO)),) |
| 28 | BITMAPLIBS += $(BUILDDIR)/libbitmapsremotemono.a |
| 29 | LINKBITMAPS += -lbitmapsremotemono |
| 30 | endif |
| 31 | ifneq ($(strip $(BMP2RB_REMOTENATIVE)),) |
| 32 | BITMAPLIBS += $(BUILDDIR)/libbitmapsremotenative.a |
| 33 | LINKBITMAPS += -lbitmapsremotenative |
| 34 | endif |
| 35 | |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 36 | ifdef DEBUG |
| 37 | DEFINES := -DDEBUG |
| 38 | CFLAGS += -g |
| 39 | endif |
| 40 | |
Jonathan Gordon | 9db22ef | 2007-09-09 11:20:20 +0000 | [diff] [blame] | 41 | SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) $(EXTRA_DEFINES) -E -P -include "config.h" - ) |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 42 | DIRS = . |
| 43 | |
| 44 | ifdef APPEXTRA |
Linus Nielsen Feltzing | dc9e201 | 2005-10-27 14:39:00 +0000 | [diff] [blame] | 45 | DIRS += $(subst :, ,$(APPEXTRA)) |
| 46 | INCLUDES += $(patsubst %,-I%,$(subst :, ,$(APPEXTRA))) |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 47 | endif |
| 48 | |
Linus Nielsen Feltzing | a2e8cf7 | 2005-07-15 07:42:25 +0000 | [diff] [blame] | 49 | ifndef VERSION |
| 50 | VERSION=$(shell date +%y%m%d-%H%M) |
| 51 | endif |
| 52 | |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 53 | CFLAGS = $(GCCOPTS) $(INCLUDES) $(TARGET) $(DEFINES) \ |
| 54 | -DAPPSVERSION=\"$(VERSION)\" $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} |
| 55 | |
| 56 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) |
| 57 | SOURCES = $(SRC) |
| 58 | LINKFILE = $(OBJDIR)/linkage.lds |
| 59 | MAXINFILE = $(OBJDIR)/romstart.temp |
| 60 | MAXOUTFILE = $(OBJDIR)/romstart |
| 61 | |
Jens Arnold | 5d9f67d | 2005-07-11 20:36:12 +0000 | [diff] [blame] | 62 | LIBROCKBOX = $(BUILDDIR)/librockbox.a |
| 63 | |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 64 | ifdef DEBUG |
| 65 | all: $(OBJDIR)/bootloader.elf |
| 66 | else |
Daniel Stenberg | 001f52b | 2005-05-07 23:16:25 +0000 | [diff] [blame] | 67 | all: $(BUILDDIR)/$(BINARY) $(FLASHFILE) |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 68 | endif |
| 69 | |
Barry Wardell | 940091a | 2008-05-05 12:05:00 +0000 | [diff] [blame] | 70 | $(DEPFILE): $(BITMAPLIBS) |
| 71 | |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 72 | dep: $(DEPFILE) |
| 73 | |
| 74 | $(LINKFILE): $(LDS) |
Jonathan Gordon | 9db22ef | 2007-09-09 11:20:20 +0000 | [diff] [blame] | 75 | $(call PRINTS,Build $(@F))cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) $(DEFINES) -E -P $(ROMBUILD) - >$@ |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 76 | |
| 77 | $(MAXOUTFILE): |
Jens Arnold | f40f0de | 2006-10-30 01:40:20 +0000 | [diff] [blame] | 78 | $(SILENT)echo '#include "config.h"' > $(MAXINFILE) |
| 79 | $(SILENT)echo "ROM_START" >> $(MAXINFILE) |
| 80 | $(SILENT)cat $(MAXINFILE) | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - > $(MAXOUTFILE) |
| 81 | $(SILENT)rm $(MAXINFILE) |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 82 | |
Barry Wardell | 940091a | 2008-05-05 12:05:00 +0000 | [diff] [blame] | 83 | build-bitmapsmono: |
| 84 | $(call PRINTS,MAKE in bitmaps/mono)$(MAKE) -C ../apps/bitmaps/mono OBJDIR=$(OBJDIR)/bitmaps/mono |
| 85 | |
| 86 | build-bitmapsnative: |
| 87 | $(call PRINTS,MAKE in bitmaps/native)$(MAKE) -C ../apps/bitmaps/native OBJDIR=$(OBJDIR)/bitmaps/native |
| 88 | |
| 89 | build-bitmapsremotemono: |
| 90 | $(call PRINTS,MAKE in bitmaps/remote_mono)$(MAKE) -C ../apps/bitmaps/remote_mono OBJDIR=$(OBJDIR)/bitmaps/remote_mono |
| 91 | |
| 92 | build-bitmapsremotenative: |
| 93 | $(call PRINTS,MAKE in bitmaps/remote_native)$(MAKE) -C ../apps/bitmaps/remote_native OBJDIR=$(OBJDIR)/bitmaps/remote_native |
| 94 | |
| 95 | $(BITMAPLIBS): $(BUILDDIR)/lib%.a: build-% |
| 96 | |
| 97 | $(OBJDIR)/bootloader.elf : $(OBJS) $(LINKFILE) $(DEPFILE) $(LIBROCKBOX) $(BITMAPLIBS) |
| 98 | $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Wl,--gc-sections -Os -nostdlib -o $@ $(OBJS) -L$(BUILDDIR) -L$(BUILDDIR)/firmware -lrockbox $(LINKBITMAPS) -lgcc -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/bootloader.map |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 99 | |
| 100 | $(OBJDIR)/bootloader.bin : $(OBJDIR)/bootloader.elf |
Jens Arnold | f40f0de | 2006-10-30 01:40:20 +0000 | [diff] [blame] | 101 | $(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@ |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 102 | |
| 103 | $(OBJDIR)/bootloader.asm: $(OBJDIR)/bootloader.bin |
| 104 | $(TOOLSDIR)/sh2d -sh1 $< > $@ |
| 105 | |
Daniel Stenberg | 001f52b | 2005-05-07 23:16:25 +0000 | [diff] [blame] | 106 | $(BUILDDIR)/$(BINARY) : $(OBJDIR)/bootloader.bin |
Jens Arnold | f40f0de | 2006-10-30 01:40:20 +0000 | [diff] [blame] | 107 | $(call PRINTS,Build bootloader file)$(MKFIRMWARE) $< $@ |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 108 | |
| 109 | include $(TOOLSDIR)/make.inc |
| 110 | |
| 111 | clean: |
Jens Arnold | f40f0de | 2006-10-30 01:40:20 +0000 | [diff] [blame] | 112 | $(call PRINTS,cleaning bootloader)-rm -f $(OBJS) $(BUILDDIR)/$(BINARY) $(OBJDIR)/bootloader.asm \ |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 113 | $(OBJDIR)/bootloader.bin $(OBJDIR)/bootloader.elf $(OBJDIR)/*.map \ |
| 114 | $(LINKFILE) $(MAXOUTFILE) $(DEPFILE) |
Barry Wardell | 940091a | 2008-05-05 12:05:00 +0000 | [diff] [blame] | 115 | $(SILENT)$(MAKE) -C bitmaps/mono clean OBJDIR=$(OBJDIR)/bitmaps/mono |
| 116 | $(SILENT)$(MAKE) -C bitmaps/native clean OBJDIR=$(OBJDIR)/bitmaps/native |
| 117 | $(SILENT)$(MAKE) -C bitmaps/remote_mono clean OBJDIR=$(OBJDIR)/bitmaps/remote_mono |
| 118 | $(SILENT)$(MAKE) -C bitmaps/remote_native clean OBJDIR=$(OBJDIR)/bitmaps/remote_native |
Linus Nielsen Feltzing | d397145 | 2005-01-28 12:51:10 +0000 | [diff] [blame] | 119 | |
| 120 | -include $(DEPFILE) |