-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
28 lines (20 loc) · 874 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
source_files := $(wildcard build/*.asm)
source_files += $(addprefix build/,$(wildcard *.asm))
obj_files := $(patsubst %.asm,%.o,$(source_files))
v86_executables := $(patsubst %.asm,%.img,$(source_files))
inc_files := $(addprefix build/,$(wildcard *.inc))
all: $(source_files) $(obj_files) $(inc_files) $(v86_executables)
.PHONY: all
build/%.o: build/%.asm $(inc_files)
nasm -w+error -felf32 -o $@ $<
# used both as a multiboot image for v86 and as a regular elf executable for gdb
build/%.img: build/%.o
ld -g $< -m elf_i386 --section-start=.bss=0x100000 --section-start=.text=0x80000 --section-start=.multiboot=0x20000 -o $@
build/%.asm: %.asm
mkdir -p build; cp $< $@
build/%.inc: %.inc
mkdir -p build; cp $< $@
.PHONY: clean
clean:
rm -f *.o *.bin *.img *.fixture gen_*.asm # old location
rm -f build/*.o build/*.bin build/*.img build/*.fixture build/*.asm