diff options
author | Victor Mignot <victor@vmignot.fr> | 2025-07-22 15:14:14 +0200 |
---|---|---|
committer | Victor Mignot <victor@vmignot.fr> | 2025-07-23 15:08:17 +0200 |
commit | f6a2143e22f577abafea5190b242471da6e34896 (patch) | |
tree | f2465b65f11a8b9d83c467d4658ffd7257e8b0e9 /Makefile | |
download | nanji-f6a2143e22f577abafea5190b242471da6e34896.tar.gz |
cortex-m4f: bootstrap code
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8576e6f --- /dev/null +++ b/Makefile @@ -0,0 +1,31 @@ +ARCH = arm-none-eabi +CC = $(ARCH)-gcc +CFLAGS = -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -std=c23 -g -O0 -ffreestanding -Wpedantic -Wall -Wextra -Werror +LDFLAGS = -Tlink.ld -nostdlib + +SRCDIR = src +BUILDDIR = build +SRCS_C = $(wildcard src/*.c) +SRCS_S = $(wildcard src/*.s) +SRCS = $(SRCS_C) $(SRCS_S) +OBJS = $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%.o,$(basename $(SRCS))) +EXEC = $(BUILDDIR)/nanji + +all: $(BUILDDIR) $(EXEC) + +$(EXEC): $(OBJS) + $(CC) $(LDFLAGS) $^ -o $@ + +$(BUILDDIR)/%.o: $(SRCDIR)/%.c + $(CC) $(CFLAGS) -c $< -o $@ + +$(BUILDDIR)/%.o: $(SRCDIR)/%.s + $(CC) $(CFLAGS) -c $< -o $@ + +$(BUILDDIR): + mkdir -p $@ + +clean: + rm -rf $(BUILDDIR) + +.PHONY: clean |