| Line 5... |
Line 5... |
| 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. -Ilibc/include -Iexport -ffunction-sections -fdata-sections
|
10 |
CFLAGS += -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -Iexport -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 |
|
| Line 28... |
Line 28... |
| 28 |
-include $$(OBJ_$(1):%=%.dep)
|
28 |
-include $$(OBJ_$(1):%=%.dep)
|
| 29 |
|
29 |
|
| 30 |
$(1): build/$(1)/$(NAME)-$(1).ucl
|
30 |
$(1): build/$(1)/$(NAME)-$(1).ucl
|
| 31 |
|
31 |
|
| 32 |
build/$(1)/$(NAME)-$(1).ucl: build/$(1)/$(NAME).bin
|
32 |
build/$(1)/$(NAME)-$(1).ucl: build/$(1)/$(NAME).bin
|
| - |
|
33 |
@echo [UCL] $$<
|
| 33 |
$(UCLPACK) $$^ $$@
|
34 |
@$(UCLPACK) $$^ $$@
|
| 34 |
|
35 |
|
| 35 |
build/$(1)/$(NAME).bin: build/$(1)/$(NAME).elf
|
36 |
build/$(1)/$(NAME).bin: build/$(1)/$(NAME).elf
|
| - |
|
37 |
@echo [OC] $$<
|
| 36 |
$(OBJCOPY) -O binary $$^ $$@
|
38 |
@$(OBJCOPY) -O binary $$^ $$@
|
| 37 |
|
39 |
|
| 38 |
build/$(1)/$(NAME).elf: target/$(1)/ls.x build/$(1)/target/$(1)/crt0.o $$(OBJ_$(1))
|
40 |
build/$(1)/$(NAME).elf: target/$(1)/ls.x build/$(1)/target/$(1)/crt0.o $$(OBJ_$(1))
|
| - |
|
41 |
@echo [LD] $$@
|
| 39 |
$(LD) $(LDFLAGS) $$(LDFLAGS_$(1)) -o $$@ -T target/$(1)/ls.x $$(OBJ_$(1))
|
42 |
@$(LD) $(LDFLAGS) $$(LDFLAGS_$(1)) -o $$@ -T target/$(1)/ls.x $$(OBJ_$(1))
|
| 40 |
|
43 |
|
| 41 |
build/$(1)/%.o: %.c build/version.h
|
44 |
build/$(1)/%.o: %.c build/version.h
|
| - |
|
45 |
@echo [CC] $$<
|
| 42 |
ifeq ($(shell uname),WindowsNT)
|
46 |
ifeq ($(shell uname),WindowsNT)
|
| 43 |
@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
|
47 |
@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
|
| 44 |
else
|
48 |
else
|
| 45 |
@-mkdir -p $$(dir $$@)
|
49 |
@-mkdir -p $$(dir $$@)
|
| 46 |
endif
|
50 |
endif
|
| 47 |
$(CC) -c $(CFLAGS) $$(CFLAGS_$(1)) -Itarget/$(1) -DTARGET_$(1) -o $$@ $$<
|
51 |
@$(CC) -c $(CFLAGS) $$(CFLAGS_$(1)) -DTARGET_$(1) -DTARGET=\"$(1)\" -DCONFIG_H=\"target/$(1)/config.h\" -DTARGET_H=\"target/$(1)/target.h\" -o $$@ $$<
|
| 48 |
@$(CC) -MM $(CFLAGS) $$(CFLAGS_$(1)) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp
|
52 |
@$(CC) -MM $(CFLAGS) $$(CFLAGS_$(1)) -DTARGET_$(1) -DTARGET=\"$(1)\" -DCONFIG_H=\"target/$(1)/config.h\" -DTARGET_H=\"target/$(1)/target.h\" $$< > $$@.dep.tmp
|
| 49 |
@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep
|
53 |
@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep
|
| 50 |
ifeq ($(shell uname),WindowsNT)
|
54 |
ifeq ($(shell uname),WindowsNT)
|
| 51 |
@sed -e "s/.*://" -e "s/\\$$$$//" < $$@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$$$/:/" >> $$@.dep
|
55 |
@sed -e "s/.*://" -e "s/\\$$$$//" < $$@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$$$/:/" >> $$@.dep
|
| 52 |
else
|
56 |
else
|
| 53 |
@sed -e 's/.*://' -e 's/\\$$$$//' < $$@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$$$/:/' >> $$@.dep
|
57 |
@sed -e 's/.*://' -e 's/\\$$$$//' < $$@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$$$/:/' >> $$@.dep
|
| 54 |
endif
|
58 |
endif
|
| 55 |
@rm -f $$@.dep.tmp
|
59 |
@rm -f $$@.dep.tmp
|
| 56 |
|
60 |
|
| 57 |
build/$(1)/%.o: %.S build/version.h
|
61 |
build/$(1)/%.o: %.S build/version.h
|
| - |
|
62 |
@echo [CC] $$<
|
| 58 |
ifeq ($(shell uname),WindowsNT)
|
63 |
ifeq ($(shell uname),WindowsNT)
|
| 59 |
@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
|
64 |
@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
|
| 60 |
else
|
65 |
else
|
| 61 |
@-mkdir -p $$(dir $$@)
|
66 |
@-mkdir -p $$(dir $$@)
|
| 62 |
endif
|
67 |
endif
|
| 63 |
$(CC) -c $(CFLAGS) $$(CFLAGS_$(1)) -Itarget/$(1) -DTARGET_$(1) -o $$@ $$<
|
68 |
@$(CC) -c $(CFLAGS) $$(CFLAGS_$(1)) -DTARGET_$(1) -DTARGET=\"$(1)\" -DCONFIG_H=\"target/$(1)/config.h\" -DTARGET_H=\"target/$(1)/target.h\" -o $$@ $$<
|
| 64 |
@$(CC) -MM $(CFLAGS) $$(CFLAGS_$(1)) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp
|
69 |
@$(CC) -MM $(CFLAGS) $$(CFLAGS_$(1)) -DTARGET_$(1) -DTARGET=\"$(1)\" -DCONFIG_H=\"target/$(1)/config.h\" -DTARGET_H=\"target/$(1)/target.h\" $$< > $$@.dep.tmp
|
| 65 |
@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep
|
70 |
@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep
|
| 66 |
ifeq ($(shell uname),WindowsNT)
|
71 |
ifeq ($(shell uname),WindowsNT)
|
| 67 |
@sed -e "s/.*://" -e "s/\\$$$$//" < $$@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$$$/:/" >> $$@.dep
|
72 |
@sed -e "s/.*://" -e "s/\\$$$$//" < $$@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$$$/:/" >> $$@.dep
|
| 68 |
else
|
73 |
else
|
| 69 |
@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
|
| Line 74... |
Line 79... |
| 74 |
all: $(TARGETS)
|
79 |
all: $(TARGETS)
|
| 75 |
|
80 |
|
| 76 |
$(foreach target,$(TARGETS),$(eval $(call TARGET_template,$(target))))
|
81 |
$(foreach target,$(TARGETS),$(eval $(call TARGET_template,$(target))))
|
| 77 |
|
82 |
|
| 78 |
build/version.h: version.h .svn/entries build
|
83 |
build/version.h: version.h .svn/entries build
|
| - |
|
84 |
@echo [PP] $<
|
| 79 |
ifeq ($(shell uname),WindowsNT)
|
85 |
ifeq ($(shell uname),WindowsNT)
|
| 80 |
@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
86 |
@sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
|
| 81 |
else
|
87 |
else
|
| 82 |
@sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
88 |
@sed -e 's/\$$REVISION\$$/$(REVISION)/' -e 's/\$$REVISIONINT\$$/$(REVISIONINT)/' < $< > $@
|
| 83 |
endif
|
89 |
endif
|