From 79ff96cb2ffb140863c48803d21d10349881f907 Mon Sep 17 00:00:00 2001 From: Oxore Date: Thu, 4 May 2023 00:16:02 +0300 Subject: Add Readme, move hello world into separate dir --- 1_hello_world/Makefile | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 1_hello_world/Makefile (limited to '1_hello_world/Makefile') diff --git a/1_hello_world/Makefile b/1_hello_world/Makefile new file mode 100644 index 0000000..c66436d --- /dev/null +++ b/1_hello_world/Makefile @@ -0,0 +1,25 @@ +WARNFLAGS = -Wall -Wextra -pedantic -Wshadow -Wlogical-op +OPTFLAGS = -Os +ARCHFLAGS = -m68000 +_CFLAGS = $(CFLAGS) $(WARNFLAGS) $(ARCHFLAGS) $(OPTFLAGS) -g3 -ffunction-sections -fdata-sections +LDSCRIPTS = m68k.ld _sram.ld _rom.ld +_LDFLAGS = $(LDFLAGS) $(OPTFLAGS) $(addprefix -T,$(LDSCRIPTS)) --gc-sections + +OBJECTS=startup.o main.o + +.PHONY: all +all: hellorom.bin + +%.bin: %.elf Makefile + m68k-none-elf-objcopy -O binary $< $@ + +hellorom.elf: $(OBJECTS) $(LDSCRIPTS) Makefile + m68k-none-elf-ld -o $@ $(OBJECTS) $(_LDFLAGS) + +OBJECTS: Makefile + +%.o: %.c Makefile + m68k-none-elf-gcc -m68000 -c $< -o $@ $(_CFLAGS) + +clean: + rm -rfv hellorom.elf hellorom.bin $(OBJECTS) -- cgit v1.2.3