forked from Bananymous/banan-os
Kernel is now in C++ :)
This commit is contained in:
parent
e6b4866ab0
commit
61609db228
|
@ -7,6 +7,7 @@ export HOST=${HOST:-$(./default-host.sh)}
|
||||||
export AR=${HOST}-ar
|
export AR=${HOST}-ar
|
||||||
export AS=${HOST}-as
|
export AS=${HOST}-as
|
||||||
export CC=${HOST}-gcc
|
export CC=${HOST}-gcc
|
||||||
|
export CXX=${HOST}-g++
|
||||||
|
|
||||||
export PREFIX=/usr
|
export PREFIX=/usr
|
||||||
export EXEC_PREFIX=$PREFIX
|
export EXEC_PREFIX=$PREFIX
|
||||||
|
@ -20,9 +21,11 @@ export CPPFLAGS=''
|
||||||
# Configure the cross-compiler to use the desired system root.
|
# Configure the cross-compiler to use the desired system root.
|
||||||
export SYSROOT="$(pwd)/sysroot"
|
export SYSROOT="$(pwd)/sysroot"
|
||||||
export CC="$CC --sysroot=$SYSROOT"
|
export CC="$CC --sysroot=$SYSROOT"
|
||||||
|
export CXX="$CXX --sysroot=$SYSROOT"
|
||||||
|
|
||||||
# Work around that the -elf gcc targets doesn't have a system include directory
|
# Work around that the -elf gcc targets doesn't have a system include directory
|
||||||
# because it was configured with --without-headers rather than --with-sysroot.
|
# because it was configured with --without-headers rather than --with-sysroot.
|
||||||
if echo "$HOST" | grep -Eq -- '-elf($|-)'; then
|
if echo "$HOST" | grep -Eq -- '-elf($|-)'; then
|
||||||
export CC="$CC -isystem=$INCLUDEDIR"
|
export CC="$CC -isystem=$INCLUDEDIR"
|
||||||
|
export CXX="$CXX -isystem=$INCLUDEDIR"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -62,6 +62,9 @@ $(ARCHDIR)/crtbegin.o $(ARCHDIR)/crtend.o:
|
||||||
.c.o:
|
.c.o:
|
||||||
$(CC) -MD -c $< -o $@ -std=gnu11 $(CFLAGS) $(CPPFLAGS)
|
$(CC) -MD -c $< -o $@ -std=gnu11 $(CFLAGS) $(CPPFLAGS)
|
||||||
|
|
||||||
|
.cpp.o:
|
||||||
|
$(CXX) -MD -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
|
||||||
|
|
||||||
.S.o:
|
.S.o:
|
||||||
$(CC) -MD -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
|
$(CC) -MD -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ void terminal_clear(void)
|
||||||
terminal_putentryat(' ', terminal_color, x, y);
|
terminal_putentryat(' ', terminal_color, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void terminal_initialize(void)
|
void terminal_initialize()
|
||||||
{
|
{
|
||||||
terminal_row = 0;
|
terminal_row = 0;
|
||||||
terminal_col = 0;
|
terminal_col = 0;
|
||||||
|
|
|
@ -2,7 +2,15 @@
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
void terminal_initialize(void);
|
void terminal_initialize(void);
|
||||||
void terminal_putchar(char c);
|
void terminal_putchar(char c);
|
||||||
void terminal_write(const char* data, size_t size);
|
void terminal_write(const char* data, size_t size);
|
||||||
void terminal_writestring(const char* data);
|
void terminal_writestring(const char* data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
extern "C"
|
||||||
void kernel_main()
|
void kernel_main()
|
||||||
{
|
{
|
||||||
terminal_initialize();
|
terminal_initialize();
|
Loading…
Reference in New Issue