2021-08-29 01:58:21 +08:00
|
|
|
CFLAGS += $(INCLUDES) $(DEFINES)
|
|
|
|
|
|
|
|
OBJS = $(addprefix $(BUILD)/, $(notdir %/$(subst .c,.o, $(SRCS))))
|
|
|
|
|
2021-12-06 02:35:29 +08:00
|
|
|
SUBMODULES = tinyusb
|
|
|
|
|
2022-01-26 04:03:22 +08:00
|
|
|
ifndef EMSCRIPTEN
|
2021-12-06 02:35:29 +08:00
|
|
|
all: directory $(SUBMODULES) $(BUILD)/$(BIN).elf $(BUILD)/$(BIN).hex $(BUILD)/$(BIN).bin $(BUILD)/$(BIN).uf2 size
|
2022-01-26 04:03:22 +08:00
|
|
|
else
|
|
|
|
all: directory $(SUBMODULES) $(BUILD)/$(BIN).html
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(BUILD)/$(BIN).html: $(OBJS)
|
|
|
|
@echo HTML $@
|
|
|
|
@$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@ \
|
2022-01-28 00:12:01 +08:00
|
|
|
-s ASYNCIFY=1 \
|
2022-01-26 04:03:22 +08:00
|
|
|
-s EXPORTED_FUNCTIONS=_main \
|
|
|
|
--shell-file=$(TOP)/watch-library/simulator/shell.html
|
2021-08-29 01:58:21 +08:00
|
|
|
|
|
|
|
$(BUILD)/$(BIN).elf: $(OBJS)
|
|
|
|
@echo LD $@
|
|
|
|
@$(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
|
|
|
|
|
|
|
|
$(BUILD)/$(BIN).hex: $(BUILD)/$(BIN).elf
|
|
|
|
@echo OBJCOPY $@
|
|
|
|
@$(OBJCOPY) -O ihex $^ $@
|
|
|
|
|
|
|
|
$(BUILD)/$(BIN).bin: $(BUILD)/$(BIN).elf
|
|
|
|
@echo OBJCOPY $@
|
|
|
|
@$(OBJCOPY) -O binary $^ $@
|
|
|
|
|
|
|
|
$(BUILD)/$(BIN).uf2: $(BUILD)/$(BIN).bin
|
|
|
|
@echo UF2CONV $@
|
|
|
|
@$(UF2) $^ -co $@
|
|
|
|
|
2021-12-06 02:35:29 +08:00
|
|
|
$(SUBMODULES):
|
2021-12-09 04:51:41 +08:00
|
|
|
git submodule update --init
|
2021-12-06 02:35:29 +08:00
|
|
|
|
2021-08-29 01:58:21 +08:00
|
|
|
install:
|
|
|
|
@$(UF2) -D $(BUILD)/$(BIN).uf2
|
|
|
|
|
|
|
|
%.o:
|
|
|
|
@echo CC $@
|
|
|
|
@$(CC) $(CFLAGS) $(filter %/$(subst .o,.c,$(notdir $@)), $(SRCS)) -c -o $@
|
|
|
|
|
|
|
|
directory:
|
|
|
|
@$(MKDIR) -p $(BUILD)
|
|
|
|
|
|
|
|
size: $(BUILD)/$(BIN).elf
|
|
|
|
@echo size:
|
|
|
|
@$(SIZE) -t $^
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo clean
|
|
|
|
@-rm -rf $(BUILD)
|
|
|
|
|
|
|
|
-include $(wildcard $(BUILD)/*.d)
|