Error handler, makefile optimisation
This commit is contained in:
Binary file not shown.
+17
-3
@@ -8,9 +8,14 @@ extrn print.str
|
||||
extrn print.nl
|
||||
extrn exit
|
||||
|
||||
macro nl {
|
||||
call print.nl
|
||||
}
|
||||
|
||||
|
||||
section '.strtab'
|
||||
filename db "makefile", 0
|
||||
error db "An error occurred while opening the file", 0
|
||||
|
||||
|
||||
section '.bss' writeable
|
||||
@@ -22,17 +27,26 @@ _start:
|
||||
push filename
|
||||
call file.open
|
||||
pop eax
|
||||
|
||||
cmp eax, 0
|
||||
jne @f
|
||||
push error
|
||||
call print.str
|
||||
nl
|
||||
call exit
|
||||
|
||||
@@:
|
||||
mov [file_], eax
|
||||
|
||||
push dword [file_]
|
||||
call print.str
|
||||
call print.nl
|
||||
call print.nl
|
||||
nl
|
||||
nl
|
||||
|
||||
push dword [file_]
|
||||
call file.content
|
||||
call print.str
|
||||
call print.nl
|
||||
nl
|
||||
|
||||
push dword [file_]
|
||||
call file.close
|
||||
|
||||
Binary file not shown.
@@ -1,8 +1,10 @@
|
||||
all: main
|
||||
|
||||
main: ../../file.o ../../std.o ../../path.o ../../string.o
|
||||
main: ../../file.o ../../std.o ../../path.o ../../string.o main.o
|
||||
ld -m elf_i386 main.o ../../file.o ../../std.o ../../path.o ../../string.o --output main
|
||||
|
||||
main.o:
|
||||
fasm main.asm
|
||||
ld -m elf_i386 main.o ../../file.o ../../std.o ../../path.o --output main
|
||||
|
||||
../../std.o:
|
||||
make -C ../.. std.o
|
||||
|
||||
Reference in New Issue
Block a user