| Line 1... |
Line 1... |
| 1 |
NAME := embios
|
1 |
NAME := embios
|
| 2 |
|
2 |
|
| 3 |
CROSS := arm-none-eabi-
|
3 |
CROSS ?= arm-none-eabi-
|
| 4 |
CC := $(CROSS)gcc
|
4 |
CC := $(CROSS)gcc
|
| 5 |
AS := $(CROSS)as
|
5 |
AS := $(CROSS)as
|
| 6 |
LD := $(CROSS)ld
|
6 |
LD := $(CROSS)ld
|
| 7 |
OBJCOPY := $(CROSS)objcopy
|
7 |
OBJCOPY := $(CROSS)objcopy
|
| 8 |
UCLPACK := ucl2e10singleblk
|
8 |
UCLPACK := ucl2e10singleblk
|
| 9 |
|
9 |
|
| 10 |
CFLAGS ?= -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -ffunction-sections -fdata-sections
|
10 |
CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -ffunction-sections -fdata-sections
|
| 11 |
LDFLAGS ?= "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
|
11 |
LDFLAGS += "$(shell $(CC) -print-libgcc-file-name)" --gc-sections
|
| 12 |
|
12 |
|
| 13 |
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
|
13 |
preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
|
| 14 |
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
|
14 |
preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
|
| 15 |
|
15 |
|
| 16 |
REVISION := $(shell svnversion .)
|
16 |
REVISION := $(shell svnversion .)
|
| Line 46... |
Line 46... |
| 46 |
@$(CC) -MM $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp
|
46 |
@$(CC) -MM $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.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/$(1)/%.o: %.S build/version.h
|
55 |
build/$(1)/%.o: %.S build/version.h
|
| 56 |
ifeq ($(shell uname),WindowsNT)
|
56 |
ifeq ($(shell uname),WindowsNT)
|
| Line 62... |
Line 62... |
| 62 |
@$(CC) -MM $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp
|
62 |
@$(CC) -MM $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp
|
| 63 |
@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep
|
63 |
@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep
|
| 64 |
ifeq ($(shell uname),WindowsNT)
|
64 |
ifeq ($(shell uname),WindowsNT)
|
| 65 |
@sed -e "s/.*://" -e "s/\\$$$$//" < $$@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$$$/:/" >> $$@.dep
|
65 |
@sed -e "s/.*://" -e "s/\\$$$$//" < $$@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$$$/:/" >> $$@.dep
|
| 66 |
else
|
66 |
else
|
| 67 |
@sed -e "s/.*://" -e "s/\\\\$$$$//" < $$@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$$$/:/" >> $$@.dep
|
67 |
@sed -e 's/.*://' -e 's/\\$$$$//' < $$@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$$$/:/' >> $$@.dep
|
| 68 |
endif
|
68 |
endif
|
| 69 |
@rm -f $$@.dep.tmp
|
69 |
@rm -f $$@.dep.tmp
|
| 70 |
endef
|
70 |
endef
|
| 71 |
|
71 |
|
| 72 |
all: $(TARGETS)
|
72 |
all: $(TARGETS)
|
| Line 75... |
Line 75... |
| 75 |
|
75 |
|
| 76 |
build/version.h: version.h .svn/entries build
|
76 |
build/version.h: version.h .svn/entries build
|
| 77 |
ifeq ($(shell uname),WindowsNT)
|
77 |
ifeq ($(shell uname),WindowsNT)
|
| 78 |
@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
78 |
@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
| 79 |
else
|
79 |
else
|
| 80 |
@sed -e "s/\\$$REVISION\\$$/$(REVISION)/" -e "s/\\$$REVISIONINT\\$$/$(REVISIONINT)/" < $< > $@
|
80 |
@sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
| 81 |
endif
|
81 |
endif
|
| 82 |
|
82 |
|
| 83 |
build:
|
83 |
build:
|
| 84 |
@mkdir build
|
84 |
@mkdir $@
|
| 85 |
|
85 |
|
| 86 |
clean:
|
86 |
clean:
|
| 87 |
rm -rf build
|
87 |
rm -rf build
|
| 88 |
|
88 |
|
| 89 |
.PHONY: all clean $(TARGETS)
|
89 |
.PHONY: all clean $(TARGETS)
|