Compare commits

..

No commits in common. "527498a491516683fbefa38576e2840c41828380" and "a3575b89978ea98d55f234223a79d402cd6c7811" have entirely different histories.

2 changed files with 7 additions and 17 deletions

View file

@ -1,25 +1,11 @@
#!/bin/sh #!/bin/sh
COMMON_CC_EXTRA_FLAGS="-Wall -Wextra" COMMON_CC_EXTRA_FLAGS="-O3 -Wall -Wextra"
COMMON_LD_EXTRA_FLAGS=""
if [ "$1" = debug ]; then
COMMON_CC_EXTRA_FLAGS="-O0 -ggdb ${COMMON_CC_EXTRA_FLAGS}"
elif [ "$1" = release ]; then
COMMON_CC_EXTRA_FLAGS="-O3 ${COMMON_CC_EXTRA_FLAGS}"
COMMON_LD_EXTRA_FLAGS="-s ${COMMON_LD_EXTRA_FLAGS}"
else
echo pass either "debug" or "release" as an argument.
exit
fi
COMMON_CC_FLAGS="-std=c23 -ffreestanding -I include ${COMMON_CC_EXTRA_FLAGS}" COMMON_CC_FLAGS="-std=c23 -ffreestanding -I include ${COMMON_CC_EXTRA_FLAGS}"
KERNEL_CC_FLAGS="-mno-sse -I dependencies/limine ${COMMON_CC_FLAGS}" KERNEL_CC_FLAGS="-mno-sse -I dependencies/limine ${COMMON_CC_FLAGS}"
#in the future user code will be allowed to use sse #in the future user code will be allowed to use sse
USER_CC_FLAGS="-mno-sse ${COMMON_CC_FLAGS}" USER_CC_FLAGS="-mno-sse ${COMMON_CC_FLAGS}"
COMMON_LD_FLAGS="${COMMON_LD_EXTRA_FLAGS}"
if [ -e build.ninja ]; then if [ -e build.ninja ]; then
echo build.ninja already exists. echo build.ninja already exists.
exit exit
@ -39,14 +25,14 @@ echo " depfile = \$out.d" >> build.ninja
echo " command = cc -c -MD -MF \$out.d ${USER_CC_FLAGS} \$in -o \$out" >> build.ninja echo " command = cc -c -MD -MF \$out.d ${USER_CC_FLAGS} \$in -o \$out" >> build.ninja
echo "rule kernel_ld" >> build.ninja echo "rule kernel_ld" >> build.ninja
echo " command = ld ${COMMON_LD_FLAGS} -T src/kernel/link.ld \$in -o \$out" >> build.ninja echo " command = ld -T src/kernel/link.ld \$in -o \$out" >> build.ninja
echo "rule user_lib_ld" >> build.ninja echo "rule user_lib_ld" >> build.ninja
echo " command = ld -r \$in -o \$out" >> build.ninja echo " command = ld -r \$in -o \$out" >> build.ninja
#eventually maybe a libc will be linked in #eventually maybe a libc will be linked in
echo "rule user_app_ld" >> build.ninja echo "rule user_app_ld" >> build.ninja
echo " command = ld ${COMMON_LD_FLAGS} \$in -o \$out" >> build.ninja echo " command = ld \$in -o \$out" >> build.ninja
#builds everything in a directory #builds everything in a directory
# $1 - source directory # $1 - source directory

View file

@ -22,8 +22,12 @@
#define panic(message) panic_core(__FILE__, __func__, __LINE__, message); #define panic(message) panic_core(__FILE__, __func__, __LINE__, message);
#ifdef NDEBUG
#define assert(condition) ((void)0)
#else
#define assert(condition) \ #define assert(condition) \
{ \ { \
if (!(condition)) \ if (!(condition)) \
panic("assertion failed: " #condition) \ panic("assertion failed: " #condition) \
} }
#endif