Subversion Repositories freemyipod

Rev

Rev 839 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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