Archived
1
0

Error handler, makefile optimisation

This commit is contained in:
Sweet Bread 2022-11-06 19:11:41 +03:00
parent 0bd9f11f6f
commit dc6d943e5c
8 changed files with 36 additions and 10 deletions

View File

@ -1,9 +1,11 @@
all: main
main: ../../std.o
fasm main.asm
main: ../../std.o main.o
ld -m elf_i386 main.o ../../std.o --output main
main.o:
fasm main.asm
../../std.o:
make -C ../../ std.o

Binary file not shown.

View File

@ -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.

View File

@ -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

View File

@ -1,9 +1,11 @@
all: main
main: ../../std.o ../../string.o ../../network.o ../../dns.o ../../dnstoys.o
fasm main.asm
main: ../../std.o ../../string.o ../../network.o ../../dns.o ../../dnstoys.o main.o
ld -m elf_i386 main.o ../../std.o ../../string.o ../../network.o ../../dns.o ../../dnstoys.o --output main
main.o:
fasm main.asm
../../std.o:
make -C ../.. std.o
@ -21,4 +23,3 @@ main: ../../std.o ../../string.o ../../network.o ../../dns.o ../../dnstoys.o
clear:
rm main.o main

BIN
file.o

Binary file not shown.

View File

@ -34,6 +34,13 @@ open:
mov edx, O_DIRECTORY
int 80h
cmp eax, -2
jne @f
mov [ebp+2*4], dword 0
postlude
ret
@@:
mov [fd], eax
; fstat