| Line 17... |
Line 17... |
| 17 |
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
|
17 |
REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
|
| 18 |
|
18 |
|
| 19 |
TARGETS := $(call preprocess,TARGETS,-I.)
|
19 |
TARGETS := $(call preprocess,TARGETS,-I.)
|
| 20 |
|
20 |
|
| 21 |
define TARGET_template
|
21 |
define TARGET_template
|
| - |
|
22 |
-include target/$(1)/target.mk
|
| - |
|
23 |
|
| 22 |
SRC_$(1) := $$(call preprocesspaths,SOURCES,-DTARGET_$(1) -Itarget/$(1) -I.)
|
24 |
SRC_$(1) := $$(call preprocesspaths,SOURCES,-DTARGET_$(1) -Itarget/$(1) -I.)
|
| 23 |
OBJ_$(1) := $$(SRC_$(1):%.c=build/$(1)/%.o)
|
25 |
OBJ_$(1) := $$(SRC_$(1):%.c=build/$(1)/%.o)
|
| 24 |
OBJ_$(1) := $$(OBJ_$(1):%.S=build/$(1)/%.o)
|
26 |
OBJ_$(1) := $$(OBJ_$(1):%.S=build/$(1)/%.o)
|
| 25 |
|
27 |
|
| 26 |
-include $$(OBJ_$(1):%=%.dep)
|
28 |
-include $$(OBJ_$(1):%=%.dep)
|
| Line 32... |
Line 34... |
| 32 |
|
34 |
|
| 33 |
build/$(1)/$(NAME).bin: build/$(1)/$(NAME).elf
|
35 |
build/$(1)/$(NAME).bin: build/$(1)/$(NAME).elf
|
| 34 |
$(OBJCOPY) -O binary $$^ $$@
|
36 |
$(OBJCOPY) -O binary $$^ $$@
|
| 35 |
|
37 |
|
| 36 |
build/$(1)/$(NAME).elf: target/$(1)/ls.x build/$(1)/target/$(1)/crt0.o $$(OBJ_$(1))
|
38 |
build/$(1)/$(NAME).elf: target/$(1)/ls.x build/$(1)/target/$(1)/crt0.o $$(OBJ_$(1))
|
| 37 |
$(LD) $(LDFLAGS) -o $$@ -T target/$(1)/ls.x $$(OBJ_$(1))
|
39 |
$(LD) $(LDFLAGS) $$(LDFLAGS_$(1)) -o $$@ -T target/$(1)/ls.x $$(OBJ_$(1))
|
| 38 |
|
40 |
|
| 39 |
build/$(1)/%.o: %.c build/version.h
|
41 |
build/$(1)/%.o: %.c build/version.h
|
| 40 |
ifeq ($(shell uname),WindowsNT)
|
42 |
ifeq ($(shell uname),WindowsNT)
|
| 41 |
@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
|
43 |
@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
|
| 42 |
else
|
44 |
else
|
| 43 |
@-mkdir -p $$(dir $$@)
|
45 |
@-mkdir -p $$(dir $$@)
|
| 44 |
endif
|
46 |
endif
|
| 45 |
$(CC) -c $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) -o $$@ $$<
|
47 |
$(CC) -c $(CFLAGS) $$(CFLAGS_$(1)) -Itarget/$(1) -DTARGET_$(1) -o $$@ $$<
|
| 46 |
@$(CC) -MM $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp
|
48 |
@$(CC) -MM $(CFLAGS) $$(CFLAGS_$(1)) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp
|
| 47 |
@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep
|
49 |
@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep
|
| 48 |
ifeq ($(shell uname),WindowsNT)
|
50 |
ifeq ($(shell uname),WindowsNT)
|
| 49 |
@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
|
| 50 |
else
|
52 |
else
|
| 51 |
@sed -e 's/.*://' -e 's/\\$$$$//' < $$@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$$$/:/' >> $$@.dep
|
53 |
@sed -e 's/.*://' -e 's/\\$$$$//' < $$@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$$$/:/' >> $$@.dep
|
| Line 56... |
Line 58... |
| 56 |
ifeq ($(shell uname),WindowsNT)
|
58 |
ifeq ($(shell uname),WindowsNT)
|
| 57 |
@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
|
59 |
@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
|
| 58 |
else
|
60 |
else
|
| 59 |
@-mkdir -p $$(dir $$@)
|
61 |
@-mkdir -p $$(dir $$@)
|
| 60 |
endif
|
62 |
endif
|
| 61 |
$(CC) -c $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) -o $$@ $$<
|
63 |
$(CC) -c $(CFLAGS) $$(CFLAGS_$(1)) -Itarget/$(1) -DTARGET_$(1) -o $$@ $$<
|
| 62 |
@$(CC) -MM $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp
|
64 |
@$(CC) -MM $(CFLAGS) $$(CFLAGS_$(1)) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp
|
| 63 |
@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep
|
65 |
@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep
|
| 64 |
ifeq ($(shell uname),WindowsNT)
|
66 |
ifeq ($(shell uname),WindowsNT)
|
| 65 |
@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
|
| 66 |
else
|
68 |
else
|
| 67 |
@sed -e 's/.*://' -e 's/\\$$$$//' < $$@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$$$/:/' >> $$@.dep
|
69 |
@sed -e 's/.*://' -e 's/\\$$$$//' < $$@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$$$/:/' >> $$@.dep
|