1- DOCKER = $(shell which docker)
2- DOCKER_IMAGE = menios:latest
3-
1+ GIT_BRANCH = $(shell git branch --show-current)
42IMAGE_NAME = menios
53
4+ DOCKER = $(shell which docker)
5+ DOCKER_IMAGE = $(IMAGE_NAME ) :$(GIT_BRANCH )
6+
67ARCH ?= x86-64
78GCC_DIR = /usr/bin
89LIB_DIR = src/libc
910CINCLUDE = \
10- -I./include \
11- -I../../include \
12- -I./vendor/acpica/include \
13- -I../../vendor/acpica/include
11+ -I./include
1412
1513OUTPUT_DIR = bin
1614KERNEL_DIR = src/kernel
@@ -19,19 +17,17 @@ KERNEL = $(OUTPUT_DIR)/kernel.elf
1917
2018OBJDIR = obj
2119LIBDIR = lib
22- ACPICA_OBJ = $(OBJDIR ) /acpica
20+ UACPI_OBJ = $(OBJDIR ) /uacpi
2321KERNEL_OBJ = $(OBJDIR ) /kernel
2422
25- LIB_ACPICA = $(LIBDIR ) /libacpica.a
26-
2723KERNEL_SRC = $(shell find -L src -type f -name '* .c')
2824KERNEL_ASM = $(shell find -L src/kernel -type f -name '* .s')
2925KERNEL_OBJS = $(patsubst % .c, % .o, $(KERNEL_SRC ) )
3026
31- ACPICA_SRC = $(shell find -L vendor/acpica -type f -name '* .c')
32- ACPICA_OBJS := $(patsubst % .c, % .o, $(ACPICA_SRC ) )
27+ UACPI_SRC = $(shell find -L vendor/uacpi -type f -name '* .c')
28+ UACPI_OBJS := $(patsubst % .c, % .o, $(UACPI_SRC ) )
3329
34- OBJS = $(KERNEL_OBJS ) $(ACPICA_OBJS )
30+ OBJS = $(KERNEL_OBJS ) $(UACPI_OBJS )
3531
3632override CFLAGS += \
3733 -Wall \
@@ -55,7 +51,8 @@ override CFLAGS += \
5551 -mno-sse \
5652 -mno-sse2 \
5753 -DMENIOS_KERNEL \
58- -DACPI_DEBUG_OUTPUT
54+ -DACPI_DEBUG_OUTPUT \
55+ -DUACPI_KERNEL_INITIALIZATION
5956
6057override CPPFLAGS := \
6158 $(CINCLUDE ) \
@@ -106,12 +103,16 @@ clean:
106103
107104.PHONY : docker
108105docker :
109- ifeq ($(shell docker images menios -q) , )
110- docker rmi -f menios && \
111- docker build --platform linux/amd64 -t menios:latest .
106+ ifeq ($(OS_NAME ) ,linux)
107+ @echo Skipping Docker
108+ else
109+ ifeq ($(shell docker images $(DOCKER_IMAGE ) -q) , )
110+ docker rmi -f $(DOCKER_IMAGE) && \
111+ docker build --platform linux/amd64 -t $(DOCKER_IMAGE) .
112112else
113113 @echo "The Docker image for meniOS already exists"
114114endif
115+ endif
115116
116117% .o : % .c
117118ifeq ($(OS_NAME ) ,linux)
121122endif
122123
123124.PHONY : build
124- build : $(OBJS )
125+ build : docker $(OBJS )
125126ifeq ($(OS_NAME ) ,linux)
126127 @set -eux
127128
@@ -163,7 +164,7 @@ endif
163164
164165.PHONY : run
165166run :
166- qemu-system-x86_64 -smp cpus=1,maxcpus=1 ,sockets=1,dies=1,clusters=1,cores=1 -vga std -no-reboot --no-shutdown -M q35 -m size=2G,maxmem=2G -hda menios.hdd -serial file:com1.log -monitor stdio -d int -M hpet=on -usb -machine q35
167+ qemu-system-x86_64 -smp cpus=1,maxcpus=2 ,sockets=1,dies=1,clusters=1,cores=2 -vga std -no-reboot --no-shutdown -M q35 -m size=2G,maxmem=2G -hda menios.hdd -serial file:com1.log -monitor stdio -d int -M hpet=on -usb -machine q35 -rtc base=utc,clock=host
167168
168169.PHONY : test
169170test :
@@ -173,7 +174,7 @@ ifeq ($(OS_NAME),linux)
173174 @echo "Testing inside Linux"
174175
175176 for file in $(shell find -L test -type f -name 'test_*.c'); do \
176- gcc -I./include $$file test/unity.c src/kernel/mem/kmalloc.c -o "$$file".bin ; \
177+ gcc -DMENIOS_NO_DEBUG - I./include $$file test/unity.c src/kernel/mem/kmalloc.c -o "$$file".bin ; \
177178 echo "Testing $(.c:.bin=$$file)" ; \
178179 "$$file".bin ; \
179180 rm "$$file".bin ; \
0 commit comments