summaryrefslogtreecommitdiff
path: root/firmware/decompressor/Makefile
blob: 30bb04e4807349a8cbd224d195ee6b8ef4b7a0e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#             __________               __   ___.
#   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
#   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
#   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
#   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
#                     \/            \/     \/    \/            \/
# $Id$
#

ifndef V
SILENT=@
endif
PRINTS=$(SILENT)$(call info,$(1))

LDS := link.lds
LINKFILE = $(OBJDIR)/linkage.lds
OBJS := $(OBJDIR)/decompressor.o $(OBJDIR)/uclimage.o \
        $(OBJDIR)/sh_nrv2e_d8.o $(OBJDIR)/startup.o
CFLAGS = $(GCCOPTS)

all: $(OBJDIR)/compressed.bin

$(OBJDIR)/compressed.bin : $(OBJDIR)/compressed.elf
	$(call PRINTS,OBJCOPY $(@F))$(OC) -O binary $< $@

$(OBJDIR)/compressed.elf : $(OBJS) $(LINKFILE)
	$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -nostdlib -o $@ $(OBJS) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/compressed.map

$(LINKFILE): $(LDS)
	$(SILENT)mkdir -p $(dir $@)
	$(call PRINTS,Build LDS file)cat $< | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P $(ROMBUILD) - >$@

$(OBJDIR)/decompressor.o : decompressor.c $(OBJDIR)/uclimage.c
	$(SILENT)mkdir -p $(dir $@)
	$(call PRINTS,CC $<)$(CC) $(CFLAGS) -I$(OBJDIR) -c $< -o $@

$(OBJDIR)/startup.o : startup.S
	$(SILENT)mkdir -p $(dir $@)
	$(call PRINTS,AS $<)$(CC) $(CFLAGS) -c $< -o $@

$(OBJDIR)/sh_nrv2e_d8.o : sh_nrv2e_d8.S
	$(SILENT)mkdir -p $(dir $@)
	$(call PRINTS,AS $<)$(CC) $(CFLAGS) -c $< -o $@

$(OBJDIR)/uclimage.o : $(OBJDIR)/uclimage.c
	$(SILENT)mkdir -p $(dir $@)
	$(call PRINTS,CC $(<F))$(CC) $(CFLAGS) -c $< -o $@

$(OBJDIR)/uclimage.c : $(FLASHFILE)  $(TOOLSDIR)/ucl2src.pl
	$(SILENT)mkdir -p $(dir $@)
	$(call PRINTS,UCL2SRC $(<F))perl -s $(TOOLSDIR)/ucl2src.pl -p=$(OBJDIR)/uclimage $<