Browse Source

Reorganize the files.

coderain 8 months ago
parent
commit
1d2617f421
47 changed files with 98 additions and 52 deletions
  1. 4 6
      .gitignore
  2. 12 16
      Makefile
  3. 2 2
      drivers/acpica/Makefile
  4. 2 2
      drivers/fatfs/Makefile
  5. 2 2
      drivers/floppy/Makefile
  6. 2 2
      drivers/ps2/Makefile
  7. 2 2
      drivers/ramfs/Makefile
  8. 2 2
      drivers/serial/Makefile
  9. 2 2
      drivers/speaker/Makefile
  10. 2 2
      drivers/vesa/Makefile
  11. 2 2
      kernel/Makefile
  12. 1 1
      kernel/include/heap.h
  13. 1 0
      libraries/.gitignore
  14. 26 0
      libraries/Makefile
  15. 0 0
      libraries/mlcrt/.gitignore
  16. 3 3
      crt/Makefile
  17. 0 0
      libraries/mlcrt/include/ctype.h
  18. 0 0
      libraries/mlcrt/include/errno.h
  19. 0 0
      libraries/mlcrt/include/fcntl.h
  20. 0 0
      libraries/mlcrt/include/malloc.h
  21. 0 0
      libraries/mlcrt/include/setjmp.h
  22. 0 0
      libraries/mlcrt/include/stdio.h
  23. 0 0
      libraries/mlcrt/include/stdlib.h
  24. 0 0
      libraries/mlcrt/include/string.h
  25. 0 0
      libraries/mlcrt/include/unistd.h
  26. 0 0
      libraries/mlcrt/src/algorithm.c
  27. 0 0
      libraries/mlcrt/src/crt0.c
  28. 0 0
      libraries/mlcrt/src/ctype.c
  29. 0 0
      libraries/mlcrt/src/errno.c
  30. 0 0
      libraries/mlcrt/src/exit.c
  31. 0 0
      libraries/mlcrt/src/fcntl.c
  32. 0 0
      libraries/mlcrt/src/io.c
  33. 0 0
      libraries/mlcrt/src/io_priv.h
  34. 0 0
      libraries/mlcrt/src/malloc.c
  35. 0 0
      libraries/mlcrt/src/numconv.c
  36. 0 0
      libraries/mlcrt/src/printf.c
  37. 0 0
      libraries/mlcrt/src/setjmp.c
  38. 0 0
      libraries/mlcrt/src/string.c
  39. 0 0
      libraries/mlcrt/src/wd.c
  40. 0 0
      libraries/mlsys/.gitignore
  41. 4 4
      library/Makefile
  42. 0 0
      libraries/mlsys/src/syscall.asm
  43. 1 0
      programs/.gitignore
  44. 24 0
      programs/Makefile
  45. 0 0
      programs/manager/.gitignore
  46. 4 4
      manager/Makefile
  47. 0 0
      programs/manager/src/start.c

+ 4 - 6
.gitignore

@@ -15,14 +15,12 @@
 !tools/packages/*.sig
 !kernel
 !kernel/*
-!crt
-!crt/*
-!library
-!library/*
+!libraries
+!libraries/**
 !tests
 !tests/**
-!manager
-!manager/*
+!programs
+!programs/**
 !drivers
 !drivers/**
 !sdk

+ 12 - 16
Makefile

@@ -1,4 +1,4 @@
-.PHONY: all clean crt kernel drivers library manager tests generate
+.PHONY: all clean kernel drivers libraries programs tests generate
 
 TOOLSDIR     := tools
 TOOLSROOTDIR := root
@@ -10,20 +10,17 @@ GENERATED_SOURCES := sdk/syscall_enum.h kernel/src/syscall_table.inl library/src
 
 all: livecd.iso tests
 
-crt:
-	$(MAKE) -C crt all
-
-kernel: generate crt
+kernel: generate libraries
 	$(MAKE) -C kernel all
 
 drivers: kernel
 	$(MAKE) -C drivers all
 
-library: generate crt
-	$(MAKE) -C library all
+libraries: generate
+	$(MAKE) -C libraries all
 
-manager: library
-	$(MAKE) -C manager all
+programs: libraries
+	$(MAKE) -C programs all
 
 tests:
 	$(MAKE) -C tests all
@@ -32,25 +29,24 @@ generate: $(GENERATED_SOURCES)
 
 sdk/syscall_enum.h: $(wildcard sdk/*.h) syscalls.awk
 	@echo 'Generating system call sources/headers...'
-	sort sdk/* | awk -v enum_file=sdk/syscall_enum.h -v table_file=kernel/src/syscall_table.inl -v wrappers_file=library/src/wrappers.c -f syscalls.awk
+	sort sdk/* | awk -v enum_file=sdk/syscall_enum.h -v table_file=kernel/src/syscall_table.inl -v wrappers_file=libraries/mlsys/src/wrappers.c -f syscalls.awk
 
 kernel/src/syscall_table.inl: sdk/syscall_enum.h
 
 library/src/wrappers.c: sdk/syscall_enum.h
 
-livecd.iso : kernel drivers library manager
+livecd.iso : kernel drivers libraries programs
 	mkdir -p livecd/monolithium livecd/boot/grub livecd/monolithium/drivers
 	cp kernel/monolithium livecd/monolithium/kernel
-	find drivers -type f -name '*.drv' -exec cp {} livecd/monolithium/drivers/ \;
-	cp manager/manager livecd/monolithium/manager
+	cp drivers/bin/* livecd/monolithium/drivers/
+	cp programs/bin/* livecd/monolithium/
 	cp grub.cfg livecd/boot/grub/grub.cfg
 	grub-mkrescue -o $@ livecd
 
 clean:
-	$(MAKE) -C crt clean
 	$(MAKE) -C kernel clean
 	$(MAKE) -C drivers clean
-	$(MAKE) -C library clean
-	$(MAKE) -C manager clean
+	$(MAKE) -C libraries clean
+	$(MAKE) -C programs clean
 	$(MAKE) -C tests clean
 	rm -f $(GENERATED_SOURCES) livecd.iso

+ 2 - 2
drivers/acpica/Makefile

@@ -21,7 +21,7 @@
 DEBUG := yes
 
 # Flags
-CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I include -I ../../kernel/include -I ../../crt/include
+CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I include -I ../../kernel/include -I ../../libraries/mlcrt/include
 ASMFLAGS := -felf
 
 LINK_WITH_LIBGCC := yes
@@ -29,6 +29,6 @@ LINK_WITH_LIBGCC := yes
 # Input and output files
 SOURCES = $(shell find $(SRCDIR) -type f -name \*.c)
 
-OUTPUT_DRIVER := acpica.drv
+OUTPUT_DRIVER := ../bin/acpica.drv
 
 -include ../../common.mk

+ 2 - 2
drivers/fatfs/Makefile

@@ -21,12 +21,12 @@
 DEBUG := yes
 
 # Flags
-CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../crt/include
+CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../libraries/mlcrt/include
 ASMFLAGS := -felf
 
 # Input and output files
 SOURCES = $(wildcard $(SRCDIR)/*.c) $(wildcard $(SRCDIR)/*.asm)
 
-OUTPUT_DRIVER := fatfs.drv
+OUTPUT_DRIVER := ../bin/fatfs.drv
 
 -include ../../common.mk

+ 2 - 2
drivers/floppy/Makefile

@@ -21,12 +21,12 @@
 DEBUG := yes
 
 # Flags
-CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../crt/include
+CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../libraries/mlcrt/include
 ASMFLAGS := -felf
 
 # Input and output files
 SOURCES = $(wildcard $(SRCDIR)/*.c) $(wildcard $(SRCDIR)/*.asm)
 
-OUTPUT_DRIVER := floppy.drv
+OUTPUT_DRIVER := ../bin/floppy.drv
 
 -include ../../common.mk

+ 2 - 2
drivers/ps2/Makefile

@@ -21,12 +21,12 @@
 DEBUG := yes
 
 # Flags
-CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../crt/include
+CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../libraries/mlcrt/include
 ASMFLAGS := -felf
 
 # Input and output files
 SOURCES = $(wildcard $(SRCDIR)/*.c) $(wildcard $(SRCDIR)/*.asm)
 
-OUTPUT_DRIVER := ps2.drv
+OUTPUT_DRIVER := ../bin/ps2.drv
 
 -include ../../common.mk

+ 2 - 2
drivers/ramfs/Makefile

@@ -21,12 +21,12 @@
 DEBUG := yes
 
 # Flags
-CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../crt/include
+CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../libraries/mlcrt/include
 ASMFLAGS := -felf
 
 # Input and output files
 SOURCES = $(wildcard $(SRCDIR)/*.c) $(wildcard $(SRCDIR)/*.asm)
 
-OUTPUT_DRIVER := ramfs.drv
+OUTPUT_DRIVER := ../bin/ramfs.drv
 
 -include ../../common.mk

+ 2 - 2
drivers/serial/Makefile

@@ -21,12 +21,12 @@
 DEBUG := yes
 
 # Flags
-CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../crt/include
+CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../libraries/mlcrt/include
 ASMFLAGS := -felf
 
 # Input and output files
 SOURCES = $(wildcard $(SRCDIR)/*.c) $(wildcard $(SRCDIR)/*.asm)
 
-OUTPUT_DRIVER := serial.drv
+OUTPUT_DRIVER := ../bin/serial.drv
 
 -include ../../common.mk

+ 2 - 2
drivers/speaker/Makefile

@@ -21,12 +21,12 @@
 DEBUG := yes
 
 # Flags
-CFLAGS = -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../crt/include
+CFLAGS = -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../libraries/mlcrt/include
 ASMFLAGS = -felf
 
 # Input and output files
 SOURCES = $(wildcard $(SRCDIR)/*.c) $(wildcard $(SRCDIR)/*.asm)
 
-OUTPUT_DRIVER := speaker.drv
+OUTPUT_DRIVER := ../bin/speaker.drv
 
 -include ../../common.mk

+ 2 - 2
drivers/vesa/Makefile

@@ -21,12 +21,12 @@
 DEBUG := yes
 
 # Flags
-CFLAGS = -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../crt/include
+CFLAGS = -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I ../.. -I ../../kernel/include -I ../../libraries/mlcrt/include
 ASMFLAGS = -felf
 
 # Input and output files
 SOURCES = $(wildcard $(SRCDIR)/*.c) $(wildcard $(SRCDIR)/*.asm)
 
-OUTPUT_DRIVER := vesa.drv
+OUTPUT_DRIVER := ../bin/vesa.drv
 
 -include ../../common.mk

+ 2 - 2
kernel/Makefile

@@ -21,9 +21,9 @@
 DEBUG := yes
 
 # Flags
-CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I include -I .. -I ../crt/include
+CFLAGS   := -Wall -Werror -Wno-strict-aliasing -ffreestanding -nostdlib -I include -I .. -I ../libraries/mlcrt/include
 ASMFLAGS := -felf
-LDFLAGS  := -T link.ld -L ../crt -lmlcrt
+LDFLAGS  := -T link.ld -L ../libraries/bin -lmlcrt
 
 LINK_WITH_LIBGCC := yes
 

+ 1 - 1
kernel/include/heap.h

@@ -22,7 +22,7 @@
 
 #include <common.h>
 #include <lock.h>
-#include <crt/include/malloc.h>
+#include <libraries/mlcrt/include/malloc.h>
 
 #define SYSTEM_HEAP_START    0x90000000
 #define SYSTEM_HEAP_END      (EVICTABLE_HEAP_START - 1)

+ 1 - 0
libraries/.gitignore

@@ -0,0 +1 @@
+bin

+ 26 - 0
libraries/Makefile

@@ -0,0 +1,26 @@
+#
+# Makefile
+#
+# Copyright (C) 2018 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+all:
+	$(MAKE) -C mlcrt all
+	$(MAKE) -C mlsys all
+
+clean:
+	$(MAKE) -C mlcrt clean
+	$(MAKE) -C mlsys clean

crt/.gitignore → libraries/mlcrt/.gitignore


+ 3 - 3
crt/Makefile

@@ -21,13 +21,13 @@
 DEBUG = yes
 
 # Flags
-CFLAGS   := -Wall -Werror -ffreestanding -nostdlib -fPIC -I include -I ../sdk
+CFLAGS   := -Wall -Werror -ffreestanding -nostdlib -fPIC -I include -I ../../sdk
 ASMFLAGS := -felf
 
 # Input and output files
 SOURCES =  $(wildcard $(SRCDIR)/*.c)
 SOURCES += $(wildcard $(SRCDIR)/*.asm)
 
-OUTPUT_STATIC_LIB = libmlcrt.a
+OUTPUT_STATIC_LIB = ../bin/libmlcrt.a
 
--include ../common.mk
+-include ../../common.mk

crt/include/ctype.h → libraries/mlcrt/include/ctype.h


crt/include/errno.h → libraries/mlcrt/include/errno.h


crt/include/fcntl.h → libraries/mlcrt/include/fcntl.h


crt/include/malloc.h → libraries/mlcrt/include/malloc.h


crt/include/setjmp.h → libraries/mlcrt/include/setjmp.h


crt/include/stdio.h → libraries/mlcrt/include/stdio.h


crt/include/stdlib.h → libraries/mlcrt/include/stdlib.h


crt/include/string.h → libraries/mlcrt/include/string.h


crt/include/unistd.h → libraries/mlcrt/include/unistd.h


crt/src/algorithm.c → libraries/mlcrt/src/algorithm.c


crt/src/crt0.c → libraries/mlcrt/src/crt0.c


crt/src/ctype.c → libraries/mlcrt/src/ctype.c


crt/src/errno.c → libraries/mlcrt/src/errno.c


crt/src/exit.c → libraries/mlcrt/src/exit.c


crt/src/fcntl.c → libraries/mlcrt/src/fcntl.c


crt/src/io.c → libraries/mlcrt/src/io.c


crt/src/io_priv.h → libraries/mlcrt/src/io_priv.h


crt/src/malloc.c → libraries/mlcrt/src/malloc.c


crt/src/numconv.c → libraries/mlcrt/src/numconv.c


crt/src/printf.c → libraries/mlcrt/src/printf.c


crt/src/setjmp.c → libraries/mlcrt/src/setjmp.c


crt/src/string.c → libraries/mlcrt/src/string.c


crt/src/wd.c → libraries/mlcrt/src/wd.c


library/.gitignore → libraries/mlsys/.gitignore


+ 4 - 4
library/Makefile

@@ -20,13 +20,13 @@
 # Settings
 DEBUG := yes
 
-CFLAGS   := -Wall -Werror -ffreestanding -nostdlib -fPIC -I ..
+CFLAGS   := -Wall -Werror -ffreestanding -nostdlib -fPIC -I ../..
 ASMFLAGS := -felf
 
 # Input and output files
 SOURCES = $(wildcard $(SRCDIR)/*.c) $(wildcard $(SRCDIR)/*.asm)
 
-OUTPUT_STATIC_LIB  := libmlsys.a
-OUTPUT_DYNAMIC_LIB := mlsys.dyn
+OUTPUT_STATIC_LIB  := ../bin/libmlsys.a
+OUTPUT_DYNAMIC_LIB := ../bin/mlsys.dyn
 
--include ../common.mk
+-include ../../common.mk

library/src/syscall.asm → libraries/mlsys/src/syscall.asm


+ 1 - 0
programs/.gitignore

@@ -0,0 +1 @@
+bin

+ 24 - 0
programs/Makefile

@@ -0,0 +1,24 @@
+#
+# Makefile
+#
+# Copyright (C) 2018 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+all:
+	$(MAKE) -C manager all
+clean:
+	$(MAKE) -C manager clean
+

manager/.gitignore → programs/manager/.gitignore


+ 4 - 4
manager/Makefile

@@ -21,9 +21,9 @@
 DEBUG := yes
 
 # Flags
-CFLAGS   += -Wall -Werror -ffreestanding -nostdlib -I ../sdk -I ../crt/include
+CFLAGS   += -Wall -Werror -ffreestanding -nostdlib -I ../../sdk -I ../../libraries/mlcrt/include
 ASMFLAGS += -felf
-LDFLAGS  += -L ../library -L ../crt -lmlcrt -lmlsys
+LDFLAGS  += -L ../../libraries/bin -lmlcrt -lmlsys
 
 LINK_WITH_LIBGCC := yes
 
@@ -32,6 +32,6 @@ SOURCES =  $(wildcard $(SRCDIR)/*.c)
 SOURCES += $(wildcard $(SRCDIR)/servers/*.c)
 SOURCES += $(wildcard $(SRCDIR)/*.asm)
 
-OUTPUT_PROGRAM := manager
+OUTPUT_PROGRAM := ../bin/manager
 
--include ../common.mk
+-include ../../common.mk

manager/src/start.c → programs/manager/src/start.c