summaryrefslogtreecommitdiffstats
path: root/01_exercise/Makefile
diff options
context:
space:
mode:
Diffstat (limited to '01_exercise/Makefile')
-rw-r--r--01_exercise/Makefile28
1 files changed, 28 insertions, 0 deletions
diff --git a/01_exercise/Makefile b/01_exercise/Makefile
new file mode 100644
index 0000000..4bf8198
--- /dev/null
+++ b/01_exercise/Makefile
@@ -0,0 +1,28 @@
+#!/usr/bin/make
+.SUFFIXES:
+SRC = bootloader.c
+TAR = bootloader.bin
+PCK = lab-1.zip
+
+CFLAGS = -m32 -c -Os -march=i686 -ffreestanding -Wall -Werror
+LFLAGS = -m elf_i386 -static -Tlinker.ld -nostdlib --nmagic
+
+%.o: %.c
+ $(CC) $(CFLAGS) $^ -o $@
+
+%.elf: %.o
+ $(LD) $(LFLAGS) -o $@ $^
+
+%.bin: %.elf
+ objcopy -O binary $^ $@
+
+all: $(TAR)
+
+run: $(TAR)
+ qemu-system-x86_64 -drive format=raw,file=$^
+
+pack:
+ zip $(PCK) Makefile *.c *.h *.s
+
+clean:
+ $(RM) $(RMFILES) $(TAR) $(PCK)