From 604b774ba9cac90ba82dd07f0f70e540bc54aaa8 Mon Sep 17 00:00:00 2001 From: SpookyDervish Date: Tue, 4 Aug 2026 10:19:17 +1000 Subject: [PATCH] makefile supports nested dirs now --- Makefile | 5 +++-- src/generator.h | 14 ++++++++++++++ src/generators/linux_x86-64.c | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 src/generator.h create mode 100644 src/generators/linux_x86-64.c diff --git a/Makefile b/Makefile index 0dc9e71..ac5339c 100644 --- a/Makefile +++ b/Makefile @@ -7,13 +7,14 @@ CFLAGS=-Wall -Wextra -fPIC -O3 TARGET=libgravity.so TEST_TARGET=testapp -SRCS=$(wildcard $(SRC)/*.c) +SRCS=$(shell find $(SRC) -name '*.c') OBJS=$(patsubst $(SRC)/%.c,$(OBJ)/%.o,$(SRCS)) $(TARGET): $(OBJS) $(CC) -shared $(OBJS) -o $(TARGET) $(OBJ)/%.o: $(SRC)/%.c + @mkdir -p $(dir $@) $(CC) $(CFLAGS) -c $< -o $@ $(TEST_TARGET): test.c $(TARGET) @@ -25,7 +26,7 @@ setup: mkdir -p $(OBJ) clean: - rm -r $(OBJ)/*.o + find $(OBJ) -name '*.o' -delete rm $(TARGET) rm $(TEST_TARGET) diff --git a/src/generator.h b/src/generator.h new file mode 100644 index 0000000..d25f996 --- /dev/null +++ b/src/generator.h @@ -0,0 +1,14 @@ +#ifndef __GRAVITY__GENERATOR_H +#define __GRAVITY__GENERATOR_H + +#include "module.h" + +typedef struct GravityOpaqueGenerator* GravityGenerator; +struct GravityOpaqueGenerator { + GravityModule module; + char* (*generateAssembly)(GravityGenerator self); +}; + + + +#endif \ No newline at end of file diff --git a/src/generators/linux_x86-64.c b/src/generators/linux_x86-64.c new file mode 100644 index 0000000..0f09ee5 --- /dev/null +++ b/src/generators/linux_x86-64.c @@ -0,0 +1 @@ +#include "../generator.h" \ No newline at end of file