Subversion Repositories freemyipod

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
145 theseven 1
NAME := uninstaller-nano2g
2
 
3
EMBIOSDIR ?= ../../embios/trunk/
4
 
462 theseven 5
ifeq ($(shell uname),WindowsNT)
6
CCACHE :=
7
else
8
CCACHE := $(shell which ccache)
9
endif
10
 
457 theseven 11
CROSS   ?= arm-elf-eabi-
462 theseven 12
CC      := $(CCACHE) $(CROSS)gcc
145 theseven 13
AS      := $(CROSS)as
14
LD      := $(CROSS)ld
15
OBJCOPY := $(CROSS)objcopy
16
UCLPACK := ucl2e10singleblk
17
 
147 theseven 18
CFLAGS  += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -I$(EMBIOSDIR)/export -ffunction-sections -fdata-sections -mcpu=arm940t
145 theseven 19
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
20
 
21
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
22
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
23
 
24
REVISION := $(shell svnversion .)
25
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
26
 
147 theseven 27
HELPERS := build/__embios_armhelpers.o
28
 
145 theseven 29
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
30
OBJ := $(SRC:%.c=build/%.o)
147 theseven 31
OBJ := $(OBJ:%.S=build/%.o) $(HELPERS)
145 theseven 32
 
33
all: $(NAME)
34
 
35
-include $(OBJ:%=%.dep)
36
 
37
$(NAME): build/$(NAME).embiosapp.ucl
38
 
39
build/$(NAME).embiosapp.ucl: build/$(NAME).embiosapp
40
	@echo [UCL]    $<
41
	@$(UCLPACK) $^ $@
42
 
43
build/$(NAME).embiosapp: build/$(NAME).elf
44
	@echo [OC]     $<
45
	@$(OBJCOPY) -O binary $^ $@
46
 
47
build/$(NAME).elf: ls.x $(OBJ)
48
	@echo [LD]     $@
49
	@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)
50
 
51
build/%.o: %.c build/version.h
52
	@echo [CC]     $<
53
ifeq ($(shell uname),WindowsNT)
54
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
55
else
56
	@-mkdir -p $(dir $@)
57
endif
58
	@$(CC) -c $(CFLAGS) -o $@ $<
59
	@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
60
	@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
61
ifeq ($(shell uname),WindowsNT)
62
	@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
63
else
64
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
65
endif
66
	@rm -f $@.dep.tmp
67
 
68
build/%.o: %.S build/version.h
69
	@echo [CC]     $<
70
ifeq ($(shell uname),WindowsNT)
71
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
72
else
73
	@-mkdir -p $(dir $@)
74
endif
75
	@$(CC) -c $(CFLAGS) -o $@ $<
76
	@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
77
	@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
78
ifeq ($(shell uname),WindowsNT)
79
	@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
80
else
81
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
82
endif
83
	@rm -f $@.dep.tmp
84
 
147 theseven 85
build/__embios_%.o: $(EMBIOSDIR)/export/%.S
86
	@echo [CC]     $<
87
ifeq ($(shell uname),WindowsNT)
88
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
89
else
90
	@-mkdir -p $(dir $@)
91
endif
92
	@$(CC) -c $(CFLAGS) -o $@ $<
93
 
145 theseven 94
build/version.h: version.h .svn/entries
95
	@echo [PP]     $<
96
ifeq ($(shell uname),WindowsNT)
97
	@-if not exist build md build
98
	@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
99
else
100
	@-mkdir -p build
101
	@sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
102
endif
103
 
104
clean:
105
	@rm -rf build
106
 
107
.PHONY: all clean $(NAME)