lab/x1/linkerscript/Makefile

34 lines
596 B
Makefile
Raw Permalink Normal View History

2021-12-14 01:01:31 +09:00
CROSS_COMPILE := arm-linux-gnueabihf-
AS := $(CROSS_COMPILE)as
CC := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)ld
OBJCOPY := $(CROSS_COMPILE)objcopy
TARGET := AppMain
OBJS := crt0.o main.o
2021-12-15 01:27:08 +09:00
LIBS := libbrain/libbrain.a
2021-12-14 01:01:31 +09:00
ASFLAGS := -W
2021-12-15 01:27:08 +09:00
CFLAGS := -Wall -ffreestanding -fomit-frame-pointer -Os -Ilibbrain
2021-12-14 01:01:31 +09:00
LDFLAGS := -T x1.ld
.PHONY:
all: $(TARGET).bin
.PHONY:
clean:
-rm -f $(TARGET).bin $(TARGET).elf $(OBJS)
%.o: %.s
$(AS) $(ASFLAGS) $< -o $@
%.o: %.c
$(CC) -c $(CFLAGS) $<
$(TARGET).elf: $(OBJS)
2021-12-15 01:27:08 +09:00
$(LD) $(LDFLAGS) $^ $(LIBS) -o $@
2021-12-14 01:01:31 +09:00
$(TARGET).bin: $(TARGET).elf
$(OBJCOPY) -O binary $< $@