Split from assembly-cheat.
This commit is contained in:
31
Makefile
Normal file
31
Makefile
Normal file
@@ -0,0 +1,31 @@
|
||||
.POSIX:
|
||||
|
||||
-include params.makefile
|
||||
|
||||
BITS ?= 32
|
||||
IN_EXT ?= .S
|
||||
LD ?= ld
|
||||
MYAS ?= as
|
||||
OBJ_EXT ?= .o
|
||||
OUT_EXT ?= .img
|
||||
RUN ?= bios_hello_world
|
||||
|
||||
INS := $(wildcard *$(IN_EXT))
|
||||
OUTS := $(patsubst %$(IN_EXT),%$(OUT_EXT),$(INS))
|
||||
|
||||
.PRECIOUS: %$(OBJ_EXT)
|
||||
.PHONY: all clean run
|
||||
|
||||
all: $(OUTS)
|
||||
|
||||
%$(OUT_EXT): %$(OBJ_EXT)
|
||||
$(LD) --oformat binary -o '$@' '$<' -T a.ld #-Ttext 0x7C00
|
||||
|
||||
%$(OBJ_EXT): %$(IN_EXT)
|
||||
$(MYAS) -o '$@' '$<'
|
||||
|
||||
clean:
|
||||
rm -f *$(OBJ_EXT) *$(OUT_EXT)
|
||||
|
||||
run: all
|
||||
qemu-system-i386 '$(RUN)$(OUT_EXT)'
|
||||
Reference in New Issue
Block a user