gardenia/Makefile

57 lines
1.2 KiB
Makefile
Raw Normal View History

2024-01-14 08:20:28 +00:00
2018-05-01 05:15:48 +00:00
CC = $(DEVKITARM)/bin/arm-none-eabi-gcc
LD = $(DEVKITARM)/bin/arm-none-eabi-ld
OBJCOPY = $(DEVKITARM)/bin/arm-none-eabi-objcopy
2024-01-14 08:20:28 +00:00
TARGET := bootloader
BUILD := build
SOURCEDIR := loader
2018-05-01 05:15:48 +00:00
OBJS = $(addprefix $(BUILD)/, \
2024-01-31 08:45:11 +00:00
stack.o \
2024-01-14 08:20:28 +00:00
main.o \
fuse.o \
usb.o \
util.o \
mc.o \
timer.o \
clock.o \
pinmux.o \
gpio.o \
2024-01-31 08:45:11 +00:00
heap.o \
uart.o \
2024-01-14 08:20:28 +00:00
)
OBJS += $(addprefix $(BUILD)/, \
printf.o \
2018-05-01 05:15:48 +00:00
)
2024-01-14 08:20:28 +00:00
INCLUDE:=-I lib/printf -I loader
2018-05-01 05:15:48 +00:00
ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork
2024-01-14 08:20:28 +00:00
CFLAGS = $(ARCH) $(INCLUDE) -fno-common -nostdlib -lnosys -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -lgcc -Wl,--nmagic # -Wall
LDFLAGS = $(ARCH) -nostartfiles -lgcc -lnosys -Wl,--nmagic#do not use --gc-sections here,it will cause strange problem
2018-05-01 05:15:48 +00:00
.PHONY: all clean
all: $(BUILD)/$(TARGET)
clean:
@rm -rf $(OBJS)
@rm -rf $(BUILD)/$(TARGET).elf
@rm -rf $(BUILD)/$(TARGET)
$(BUILD)/$(TARGET): $(BUILD)/$(TARGET).elf
$(OBJCOPY) -S -O binary $< $@
$(BUILD)/$(TARGET).elf: $(OBJS)
2024-01-14 08:20:28 +00:00
$(CC) $(LDFLAGS) -T loader/link.ld $^ -o $@
2018-05-01 05:15:48 +00:00
$(BUILD)/%.o: $(SOURCEDIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD)/%.o: $(SOURCEDIR)/%.S
$(CC) $(CFLAGS) -c $< -o $@
2024-01-14 08:20:28 +00:00
$(BUILD)/%.o: lib/printf/%.c
$(CC) $(CFLAGS) -c $< -o $@