Rev 457 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
NAME := ftlstubifeq ($(shell uname),WindowsNT)CCACHE :=elseCCACHE := $(shell which ccache)endifCROSS ?= arm-elf-eabi-CC := $(CCACHE) $(CROSS)gccAS := $(CROSS)asLD := $(CROSS)ldOBJCOPY := $(CROSS)objcopyUCLPACK := ucl2e10singleblkCFLAGS += -Os -mthumb -fno-pie -fno-stack-protector -fomit-frame-pointer -I. -ffunction-sectionsLDFLAGS += --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))&:")SRC := $(call preprocesspaths,SOURCES,)OBJ := $(SRC:%.c=build/%.o)OBJ := $(OBJ:%.S=build/%.o)all: $(NAME)$(NAME): build/$(NAME).uclbuild/$(NAME).ucl: build/$(NAME).bin@echo [UCL] $<@$(UCLPACK) $^ $@build/$(NAME).bin: build/$(NAME).elf@echo [OC] $<@$(OBJCOPY) -O binary $^ $@build/$(NAME).elf: ls.x $(OBJ) build/main.o@echo [LD] $@@$(LD) $(LDFLAGS) -o $@ -T ls.x $(OBJ)build/%.o: %.c@echo [CC] $<ifeq ($(shell uname),WindowsNT)@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))else@-mkdir -p $(dir $@)endif@$(CC) -c $(CFLAGS) -o $@ $<@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.depifeq ($(shell uname),WindowsNT)@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.depelse@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dependif@rm -f $@.dep.tmpbuild/%.o: %.S@echo [CC] $<ifeq ($(shell uname),WindowsNT)@-if not exist $(subst /,\,$(dir $@)) md $(subst /,\,$(dir $@))else@-mkdir -p $(dir $@)endif@$(CC) -c $(CFLAGS) -o $@ $<@$(CC) -MM $(CFLAGS) $< > $@.dep.tmp@sed -e "s|.*:|$@:|" < $@.dep.tmp > $@.depifeq ($(shell uname),WindowsNT)@sed -e "s/.*://" -e "s/\\$$//" < $@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$/:/" >> $@.depelse@sed -e 's/.*://' -e 's/\\$$//' < $@.dep.tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $@.dependif@rm -f $@.dep.tmp-include $(OBJ:%=%.dep)clean:rm -rf build.PHONY: all clean $(NAME)