Subversion Repositories freemyipod

Rev

Rev 728 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
528 theseven 1
NAME := bootmenu-ipodclassic
2
STACKSIZE := 4096
3
COMPRESS := true
4
 
5
EMCOREDIR ?= ../../emcore/trunk/
6
LIBBOOTDIR ?= ../../libs/boot/
7
LIBPNGDIR ?= ../../libs/png/
8
LIBUIDIR ?= ../../libs/ui/
660 theseven 9
LIBMKFAT32DIR ?= ../../libs/mkfat32/
528 theseven 10
 
768 user890104 11
RESOURCES = images/background.png images/icons.png images/rockbox.png
12
 
528 theseven 13
ifeq ($(shell uname),WindowsNT)
14
CCACHE :=
15
else
16
CCACHE := $(shell which ccache)
17
endif
18
 
19
CROSS   ?= arm-elf-eabi-
20
CC      := $(CCACHE) $(CROSS)gcc
21
AS      := $(CROSS)as
22
LD      := $(CROSS)ld
23
OBJCOPY := $(CROSS)objcopy
24
ELF2ECA := $(CROSS)elf2emcoreapp
25
 
660 theseven 26
LIBINCLUDES := -I$(LIBBOOTDIR)/export -I$(LIBPNGDIR)/export -I$(LIBUIDIR)/export -I$(LIBMKFAT32DIR)/export
528 theseven 27
 
728 theseven 28
CFLAGS  += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMCOREDIR)/export $(LIBINCLUDES) -ffunction-sections -fdata-sections -mcpu=arm926ej-s -DARM_ARCH=5
528 theseven 29
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --emit-relocs --gc-sections
30
 
31
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
666 theseven 32
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:" | sed -e "s:^\\./::")
528 theseven 33
 
34
REVISION := $(shell svnversion .)
35
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
36
 
37
HELPERS := build/__emcore_armhelpers.o
38
 
39
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
40
OBJ := $(SRC:%.c=build/%.o)
41
OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
42
 
43
all: $(NAME)
44
 
45
-include $(OBJ:%=%.dep)
46
 
47
$(NAME): build/$(NAME).emcoreapp
48
 
49
build/$(NAME).emcoreapp: build/$(NAME).elf
50
	@echo [EMCAPP] $<
51
ifeq ($(COMPRESS),true)
52
	@$(ELF2ECA) -z -s $(STACKSIZE) -o $@ $^
53
else
54
	@$(ELF2ECA) -s $(STACKSIZE) -o $@ $^
55
endif
56
 
768 user890104 57
build/resources.o: $(RESOURCES)
58
 
528 theseven 59
build/$(NAME).elf: ls.x $(OBJ)
60
	@echo [LD]     $@
61
	@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
62
 
63
build/%.o: %.c build/version.h
64
	@echo [CC]     $<
65
ifeq ($(shell uname),WindowsNT)
66
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
67
else
68
	@-mkdir -p $(dir $@)
69
endif
70
	@$(CC) -c $(CFLAGS) -o $@ $<
71
	@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
72
	@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
73
ifeq ($(shell uname),WindowsNT)
74
	@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
75
else
76
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
77
endif
78
	@rm -f $@.dep.tmp
79
 
80
build/%.o: %.S build/version.h
81
	@echo [CC]     $<
82
ifeq ($(shell uname),WindowsNT)
83
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
84
else
85
	@-mkdir -p $(dir $@)
86
endif
87
	@$(CC) -c $(CFLAGS) -o $@ $<
88
	@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
89
	@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
90
ifeq ($(shell uname),WindowsNT)
91
	@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
92
else
93
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
94
endif
95
	@rm -f $@.dep.tmp
96
 
97
build/__emcore_%.o: $(EMCOREDIR)/export/%.c
98
	@echo [CC]     $<
99
ifeq ($(shell uname),WindowsNT)
100
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
101
else
102
	@-mkdir -p $(dir $@)
103
endif
104
	@$(CC) -c $(CFLAGS) -o $@ $<
105
 
106
build/__emcore_%.o: $(EMCOREDIR)/export/%.S
107
	@echo [CC]     $<
108
ifeq ($(shell uname),WindowsNT)
109
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
110
else
111
	@-mkdir -p $(dir $@)
112
endif
113
	@$(CC) -c $(CFLAGS) -o $@ $<
114
 
115
build/version.h: version.h .svn/entries
116
	@echo [PP]     $<
117
ifeq ($(shell uname),WindowsNT)
118
	@-if not exist build md build
119
	@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
120
else
121
	@-mkdir -p build
122
	@sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
123
endif
124
 
125
clean:
126
	@rm -rf build
127
 
128
.PHONY: all clean $(NAME)