calculator/Makefile

46 lines
1.0 KiB
Makefile
Raw Normal View History

2018-01-04 11:47:43 -05:00
CROSS = arm-none-eabi-
CC = gcc
AS = as
AR = ar
OBJCOPY = objcopy
2018-01-25 11:00:18 -05:00
MCUFLAGS = -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16
2018-01-04 11:47:43 -05:00
AFLAGS = $(MCUFLAGS)
CFLAGS = $(MCUFLAGS) -ggdb \
-Iinclude -Iinclude/it \
-fno-builtin -fsigned-char -ffreestanding \
-Wall -Werror -Wextra -pedantic \
-Wno-overlength-strings -Wno-discarded-qualifiers
LFLAGS = -T link.ld
2018-01-04 11:47:43 -05:00
CFILES = $(wildcard src/*.c)
AFILES = $(wildcard src/*.s)
OUTDIR = out
OFILES = $(patsubst src/%.c, $(OUTDIR)/%.o, $(CFILES)) \
$(patsubst src/%.s, $(OUTDIR)/%.asm.o, $(AFILES))
OUT = out/main.elf
2018-01-04 11:47:43 -05:00
all: $(OUT)
2018-01-04 11:47:43 -05:00
$(OUT): $(OFILES) initrd/init libinterp.a
@echo " LINK " $(OUT)
2018-02-12 11:23:59 -05:00
@./mkinitrd.sh
2018-01-04 11:47:43 -05:00
@$(CROSS)$(OBJCOPY) -B arm -I binary -O elf32-littlearm initrd.img out/initrd.img.o
@$(CROSS)$(CC) $(CFLAGS) $(LFLAGS) out/*.o -o $(OUT) -L. -linterp
2018-01-04 11:47:43 -05:00
$(OUTDIR)/%.o: src/%.c
@echo " CC " $<
@$(CROSS)$(CC) $(CFLAGS) -c $< -o $@
$(OUTDIR)/%.asm.o: src/%.s
@echo " AS " $<
@$(CROSS)$(AS) $(AFLAGS) -c $< -o $@
2017-12-30 12:27:06 -05:00
clean:
2018-01-04 11:47:43 -05:00
@echo " CLEAN"
@rm -rf out/*