mirror of
https://github.com/firewalkwithm3/Sensor-Watch.git
synced 2024-11-22 19:20:30 +08:00
47 lines
925 B
Makefile
47 lines
925 B
Makefile
CFLAGS += $(INCLUDES) $(DEFINES)
|
|
|
|
OBJS = $(addprefix $(BUILD)/, $(notdir %/$(subst .c,.o, $(SRCS))))
|
|
|
|
SUBMODULES = tinyusb
|
|
|
|
all: directory $(SUBMODULES) $(BUILD)/$(BIN).elf $(BUILD)/$(BIN).hex $(BUILD)/$(BIN).bin $(BUILD)/$(BIN).uf2 size
|
|
|
|
$(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 $@
|
|
|
|
$(SUBMODULES):
|
|
git submodule update --init
|
|
|
|
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)
|