mirror of
https://github.com/Tom-on64/kern.git
synced 2026-11-03 18:22:22 +00:00
Makefile refactorin'
This commit is contained in:
+2
-2
@@ -30,7 +30,7 @@ size_t fread(void* ptr, size_t size, size_t count, FILE* stream) {
|
||||
int fd = stream->_file;
|
||||
|
||||
while (readEl != count) {
|
||||
if (read(fd, (void*)(ptr + offset), size) != size) break;
|
||||
if (read(fd, (void*)(ptr + offset), size) != (int)size) break;
|
||||
offset += size;
|
||||
readEl++;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ size_t fwrite(const void* ptr, size_t size, size_t count, FILE* stream) {
|
||||
int fd = stream->_file;
|
||||
|
||||
while (writtenEl != count) {
|
||||
if (write(fd, (void*)(ptr + offset), size) != size) break;
|
||||
if (write(fd, (void*)(ptr + offset), size) != (int)size) break;
|
||||
offset += size;
|
||||
writtenEl++;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# C Standard library
|
||||
#
|
||||
|
||||
include make.defaults
|
||||
|
||||
$(LIBC): $(LIBC_SRC)
|
||||
@echo "Building $(LIBC)..."
|
||||
for f in $(LIBC_SRC); do\
|
||||
filename=$$(basename $$f .c);\
|
||||
$(CC) $(CFLAGS) -I$(LIBC_INC) -o $(BIN)/libc/$$filename.o -c $$f;\
|
||||
done
|
||||
$(LD) $(LDFLAGS) -r -o $(LIBC) $(BIN)/libc/**.o
|
||||
|
||||
+2
-14
@@ -1,16 +1,4 @@
|
||||
#ifndef MATH_H
|
||||
#define MATH_H
|
||||
#include <math.h>
|
||||
|
||||
// Constants
|
||||
#define PI 3.141592653589 // Should be good enough
|
||||
#define E 2.718281828459
|
||||
/* TODO */
|
||||
|
||||
// Macros
|
||||
#define abs(x) ( (x) > 0 ? (x) : -(x) )
|
||||
#define sign(x) ( (x) == 0 ? 0 : ((x) < 0 ? -1 : 1 ) )
|
||||
|
||||
#define floor(x) ( (int)(x) ) // C floors floats when converting to ints
|
||||
#define round(x) ( (int)((x) + 0.5) ) // Normal rounding
|
||||
#define ceil(x) ( (int)((x) + 1) ) // Always rounds up
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#ifndef BOOL_H
|
||||
#define BOOL_H
|
||||
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user