From: Ayabusa Date: Fri, 5 Jun 2026 04:21:31 +0000 (+0200) Subject: Changed the Makefile and CPU detection seems to be working X-Git-Url: https://git.ayabusa.dev/?a=commitdiff_plain;h=07e85fb572666bbf8df79d8f12952ef22b8db1c4;p=thoryum.git Changed the Makefile and CPU detection seems to be working --- diff --git a/Makefile b/Makefile index 24d9fb2..b43dc53 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,19 @@ CFLAGS = -Wall -Wextra -fsanitize=address -g -SRC = src/main.c -OBJ = build/main.o +SRC = src/main.c src/cpu.c +OBJ = build/main.o build/cpu.o RES = build/Thoryum -all: comp +all: setup $(OBJ) build $(CC) $(CFLAGS) $(OBJ) -o $(RES) -comp: $(SRC) +build/main.o: src/main.c + $(CC) $(CFLAGS) -c $^ -o $@ + +build/cpu.o: src/cpu.c + $(CC) $(CFLAGS) -c $^ -o $@ + +setup: mkdir -p build - $(CC) $(CFLAGS) -c $(SRC) -o $(OBJ) clean: $(RM) $(OBJ) $(RES) diff --git a/src/cpu.c b/src/cpu.c index 791b964..b60d4d5 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -20,7 +20,7 @@ enum CPU_opti CPU_fetch_opti() { return POTATO; // Bruh... You in the 50s or wat ? } -void CPU_opti_name(char[5] buf, enum CPU_opti opti) { +void CPU_opti_name(char buf[5], enum CPU_opti opti) { if (opti == AVX2) strcpy(buf, "AVX2"); else if (opti == AVX) diff --git a/src/cpu.h b/src/cpu.h index dd7eeb8..15694dd 100644 --- a/src/cpu.h +++ b/src/cpu.h @@ -10,6 +10,6 @@ enum CPU_opti { }; enum CPU_opti CPU_fetch_opti(); -void CPU_opti_name(char[5] buf, enum CPU_opti opti); +void CPU_opti_name(char buf[5], enum CPU_opti opti); #endif diff --git a/src/main.c b/src/main.c index c23c0bc..6bb056e 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,10 @@ #include +#include "cpu.h" int main() { printf("Hello this is Thoryum ;)\n"); + enum CPU_opti opti = CPU_fetch_opti(); + char opti_name[5] = {0}; + CPU_opti_name(opti_name, opti); + printf("You are using the CPU : '%s'\n", opti_name); }