Cleaning Makefile and creating asm macros
This commit is contained in:
parent
ba7e57138c
commit
fcdc14f939
3 changed files with 21 additions and 19 deletions
27
src/Makefile
27
src/Makefile
|
@ -1,34 +1,23 @@
|
|||
EXEC := bringelle
|
||||
CC := gcc -c -m32 -fno-pie -fno-builtin -fno-stack-protector
|
||||
|
||||
UTILS_SRC := $(wildcard utils/*.c)
|
||||
UTILS_OBJ := $(addsuffix .o,$(basename $(wildcard utils/*.c)))
|
||||
|
||||
all: $(EXEC)
|
||||
|
||||
$(EXEC): boot.o utils.o bringelle.o
|
||||
for obj in $^ ;\
|
||||
do \
|
||||
objcopy --remove-section .note.gnu.property $${obj} ; \
|
||||
done
|
||||
$(EXEC): boot/boot.o $(UTILS_OBJ) bringelle.o
|
||||
ld -Ttext=0x00100000 -melf_i386 -nostdlib --oformat=binary -o bringelle $^
|
||||
|
||||
bringelle.o: bringelle.c
|
||||
$(CC) $^
|
||||
|
||||
utils.o: $(UTILS_SRC)
|
||||
for src in $^ ;\
|
||||
do \
|
||||
obj=$$(basename $${src} ".c")".o" ;\
|
||||
$(CC) $${src} -o utils/$${obj} ;\
|
||||
done
|
||||
ld -melf_i386 -relocatable utils/*.o -o utils.o
|
||||
|
||||
boot.o: ./boot/boot.S
|
||||
boot/boot.o: ./boot/boot.S
|
||||
as --32 -o $@ $^ -mx86-used-note=no
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -o $@ $<
|
||||
objcopy --remove-section .note.gnu.property $@
|
||||
|
||||
clean:
|
||||
find ./ -name "*.o" -delete
|
||||
- rm $(EXEC)
|
||||
- find ./ -name "*.o" -delete
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "utils/print.h"
|
||||
#include "utils/asm.h"
|
||||
|
||||
void bringelle(){
|
||||
clear();
|
||||
print("Booting Bringelle...");
|
||||
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
|
11
src/utils/asm.h
Normal file
11
src/utils/asm.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#ifndef ASM_H
|
||||
#define ASM_H
|
||||
|
||||
#define outb(port,value) \
|
||||
asm volatile ("outb %%al, %%dx" :: "a"(value), "d" (port) )
|
||||
|
||||
#define outbj(port,value) \
|
||||
asm volatile ("outb %%al, %%dx;" :: "a" (value), "d"(port) )
|
||||
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue