summaryrefslogblamecommitdiffstats
path: root/01_exercise/Makefile
blob: 4bf819817a4b4f526bb4a607e7e4d1437ada3dbb (plain) (tree)



























                                                             
#!/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)