Subversion Repositories freemyipod

Rev

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

Rev 676 Rev 870
Line 1... Line 1...
1
NAME := bootstrap_ipodclassic_itunes
1
NAME := bootstrap_ipodclassic_itunes
2
DFUIMAGE ?= ../../../apps/installer-ipodclassic/build/bootstrap-ipodclassic.dfu
2
DFUIMAGE ?= ../../../apps/installer-ipodclassic/build/bootstrap-ipodclassic.dfu
3
 
3
 
4
ifeq ($(shell uname),WindowsNT)
4
ifeq ($(shell uname),WindowsNT)
5
CCACHE :=
5
CCACHE :=
6
else
6
else
7
CCACHE := $(shell which ccache)
7
CCACHE := $(shell which ccache)
8
endif
8
endif
9
 
9
 
10
CC      := $(CCACHE) gcc
10
CC      := $(CCACHE) gcc
11
LD      := $(CCACHE) gcc
11
LD      := $(CCACHE) gcc
12
 
12
 
13
CFLAGS  += -Os -fomit-frame-pointer "-DDFUIMAGE=\"$(DFUIMAGE)\""
13
CFLAGS  += -Os -fomit-frame-pointer "-DDFUIMAGE=\"$(DFUIMAGE)\""
14
LDFLAGS += -Wl,-s
14
LDFLAGS += -Wl,-s
15
 
15
 
16
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
16
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
17
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:" | sed -e "s:^\\./::")
17
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:" | sed -e "s:^\\./::")
18
 
18
 
19
REVISION := $(shell svnversion .)
19
REVISION := $(shell svnversion .)
20
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
20
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
21
 
21
 
22
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
22
SRC := $(call preprocesspaths,SOURCES,-I. -I..)
23
OBJ := $(SRC:%.c=build/%.o)
23
OBJ := $(SRC:%.c=build/%.o)
24
OBJ := $(OBJ:%.S=build/%.o)
24
OBJ := $(OBJ:%.S=build/%.o)
25
 
25
 
26
all: $(NAME)
26
all: $(NAME)
27
 
27
 
28
-include $(OBJ:%=%.dep)
28
-include $(OBJ:%=%.dep)
29
 
29
 
30
$(NAME): build/$(NAME).exe
30
$(NAME): build/$(NAME).exe
31
 
31
 
32
build/resources.o: $(DFUIMAGE)
32
build/resources.o: $(DFUIMAGE)
33
 
33
 
34
build/$(NAME).exe: $(OBJ)
34
build/$(NAME).exe: $(OBJ)
35
	@echo [LD]     $@
35
	@echo [LD]     $@
36
	@$(LD) -o $@ $(OBJ) $(LDFLAGS)
36
	@$(LD) -o $@ $(OBJ) $(LDFLAGS)
37
 
37
 
38
build/%.o: %.c build/version.h
38
build/%.o: %.c build/version.h
39
	@echo [CC]     $<
39
	@echo [CC]     $<
40
ifeq ($(shell uname),WindowsNT)
40
ifeq ($(shell uname),WindowsNT)
41
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
41
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
42
else
42
else
43
	@-mkdir -p $(dir $@)
43
	@-mkdir -p $(dir $@)
44
endif
44
endif
45
	@$(CC) -c $(CFLAGS) -o $@ $<
45
	@$(CC) -c $(CFLAGS) -o $@ $<
46
	@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
46
	@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
47
	@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
47
	@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
48
ifeq ($(shell uname),WindowsNT)
48
ifeq ($(shell uname),WindowsNT)
49
	@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
49
	@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
50
else
50
else
51
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
51
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
52
endif
52
endif
53
	@rm -f $@.dep.tmp
53
	@rm -f $@.dep.tmp
54
 
54
 
55
build/%.o: %.S build/version.h
55
build/%.o: %.S build/version.h
56
	@echo [CC]     $<
56
	@echo [CC]     $<
57
ifeq ($(shell uname),WindowsNT)
57
ifeq ($(shell uname),WindowsNT)
58
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
58
	@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))
59
else
59
else
60
	@-mkdir -p $(dir $@)
60
	@-mkdir -p $(dir $@)
61
endif
61
endif
62
	@$(CC) -c $(CFLAGS) -o $@ $<
62
	@$(CC) -c $(CFLAGS) -o $@ $<
63
	@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
63
	@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp
64
	@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
64
	@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.dep
65
ifeq ($(shell uname),WindowsNT)
65
ifeq ($(shell uname),WindowsNT)
66
	@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
66
	@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.dep
67
else
67
else
68
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
68
	@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dep
69
endif
69
endif
70
	@rm -f $@.dep.tmp
70
	@rm -f $@.dep.tmp
71
 
71
 
72
build/version.h: version.h .svn/entries
72
build/version.h: version.h ../../../.svn/entries
73
	@echo [PP]     $<
73
	@echo [PP]     $<
74
ifeq ($(shell uname),WindowsNT)
74
ifeq ($(shell uname),WindowsNT)
75
	@-if not exist build md build
75
	@-if not exist build md build
76
	@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
76
	@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
77
else
77
else
78
	@-mkdir -p build
78
	@-mkdir -p build
79
	@sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
79
	@sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
80
endif
80
endif
81
 
81
 
82
clean:
82
clean:
83
	@rm -rf build
83
	@rm -rf build
84
 
84
 
85
.PHONY: all clean $(NAME)
85
.PHONY: all clean $(NAME)