Rev 18 | Blame | Last modification | View Log | RSS feed
NAME := embiosCROSS := arm-none-eabi-CC := $(CROSS)gccAS := $(CROSS)asLD := $(CROSS)ldOBJCOPY := $(CROSS)objcopyUCLPACK := ucl2e10singleblkCFLAGS ?= -Os -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -ffunction-sections -fdata-sectionsLDFLAGS ?= "$(shell $(CC) -print-libgcc-file-name)" --gc-sectionspreprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")TARGETS := $(call preprocess,TARGETS,-I.)define TARGET_templateSRC_$(1) := $$(call preprocesspaths,SOURCES,-DTARGET_$(1) -Itarget/$(1) -I.)OBJ_$(1) := $$(SRC_$(1):%.c=build/$(1)/%.o)OBJ_$(1) := $$(OBJ_$(1):%.S=build/$(1)/%.o)-include $$(OBJ_$(1):%=%.dep)$(1): build/$(1)/$(NAME)-$(1).uclbuild/$(1)/$(NAME)-$(1).ucl: build/$(1)/$(NAME).bin$(UCLPACK) $$^ $$@build/$(1)/$(NAME).bin: build/$(1)/$(NAME).elf$(OBJCOPY) -O binary $$^ $$@build/$(1)/$(NAME).elf: target/$(1)/ls.x build/$(1)/target/$(1)/crt0.o $$(OBJ_$(1))$(LD) $(LDFLAGS) -o $$@ -T target/$(1)/ls.x $$(OBJ_$(1))build/$(1)/%.o: %.cifeq ($(shell uname),WindowsNT)@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))else@-mkdir -p $$(dir $$@)endif$(CC) -c $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) -o $$@ $$<@$(CC) -MM $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep@sed -e "s/.*://" -e "s/\\$$$$//" < $$@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$$$/:/" >> $$@.dep@rm -f $$@.dep.tmpbuild/$(1)/%.o: %.Sifeq ($(shell uname),WindowsNT)@-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))else@-mkdir -p $$(dir $$@)endif$(CC) -c $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) -o $$@ $$<@$(CC) -MM $(CFLAGS) -Itarget/$(1) -DTARGET_$(1) $$< > $$@.dep.tmp@sed -e "s|.*:|$$@:|" < $$@.dep.tmp > $$@.dep@sed -e "s/.*://" -e "s/\\$$$$//" < $$@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$$$/:/" >> $$@.dep@rm -f $$@.dep.tmpendefall: $(TARGETS)$(foreach target,$(TARGETS),$(eval $(call TARGET_template,$(target))))clean:rm -rf build.PHONY: all clean $(TARGETS)