diff options
author | Danny Holman <dholman@gymli.org> | 2024-08-25 00:18:42 -0500 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2024-08-25 00:18:42 -0500 |
commit | 6b13ea53aeedb646b082a13bf16f67f8556087ae (patch) | |
tree | 7cf38f381a7af9daa9ad511c8f9abe58b41b119a | |
parent | a002576056e26673f0141e46786f44f0b9c90b70 (diff) |
core: refactor entire project root
Reorganize the project root such that each subsystem is placed into its
own subdirectory. This allows the build system to select which
subsystems to enable for a particular build.
Signed-off-by: Danny Holman <dholman@gymli.org>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 36 | ||||
-rw-r--r-- | core/logging.c (renamed from src/logging.c) | 0 | ||||
-rw-r--r-- | core/make.config | 6 | ||||
-rw-r--r-- | include/rune_logging.h | 2 | ||||
-rw-r--r-- | render-vulkan/make.config | 7 |
6 files changed, 35 insertions, 17 deletions
@@ -20,6 +20,7 @@ *.out *.patch *.so +*.sym *.tar *.xz *.zstd @@ -2,41 +2,45 @@ CC?=gcc INCLUDE?=-Iinclude CFLAGS?=-O0 LDFLAGS?= -LIBS?=-lglfw -lvulkan +RENDER?=render-vulkan +PLATFORM?=linux # -- Do not edit below this line -- VERSION:="$(shell git describe --abbrev=4 --dirty --always --tags)" +CC:=$(CC) INCLUDE:=$(INCLUDE) -CFLAGS:=$(CFLAGS) -Wall -Wextra -DVERSION=\"$(VERSION)\" -ggdb -fstack-protector-all -fPIC +CFLAGS:=$(CFLAGS) $(INCLUDE) -Wall -Wextra -DVERSION=\"$(VERSION)\" -ggdb -fstack-protector-all -fPIC LDFLAGS:=$(LDFLAGS) -shared -LIBS:=$(LIBS) -ENGINE=librune.so -ENGINE_OBJS=src/init.o \ - src/graphics.o \ - src/callbacks.o \ +COREDIR:=core +RENDERDIR:=$(RENDER) +ENGINE:=librune.so -LINK_LIST=$(LDFLAGS) \ - $(ENGINE_OBJS) \ - $(LIBS) \ +include $(COREDIR)/make.config $(RENDERDIR)/make.config + +LDFLAGS:=$(LDFLAGS) $(RENDER_LDFLAGS) $(CORE_LDFLAGS) +LIBS:=$(LIBS) $(RENDER_LIBS) $(CORE_LIBS) +OBJS:=$(RENDER_OBJS) $(CORE_OBJS) .PHONY: all clean install install-headers .SUFFIXES: .o .c all: $(ENGINE) -$(ENGINE): $(ENGINE_OBJS) - @$(CC) -o $@ $(LINK_LIST) +$(ENGINE): $(OBJS) + @$(CC) -o $@ $(LIBS) $(LDFLAGS) $? @echo [LD] $@ + @objcopy --only-keep-debug $(ENGINE) $(ENGINE:.so=.sym) + @strip -s $(ENGINE) + @objcopy --add-gnu-debuglink=$(ENGINE:.so=.sym) $(ENGINE) + @echo [strip] $(ENGINE) .c.o: @$(CC) -MD -c $< -o $@ $(CFLAGS) $(INCLUDE) @echo [CC] $@ clean: - $(RM) $(ENGINE) - $(RM) $(ENGINE_OBJS) *.o */*.o */*/*.o - $(RM) $(ENGINE_OBJS:.o=.d) *.d */*.d */*/*.d + $(RM) $(OBJS) $(OBJS:o=.d) --include $(ENGINE_OBJS:.o=.d) +-include $(OBJS:.o=.d) diff --git a/src/logging.c b/core/logging.c index e755710..e755710 100644 --- a/src/logging.c +++ b/core/logging.c diff --git a/core/make.config b/core/make.config new file mode 100644 index 0000000..94dce85 --- /dev/null +++ b/core/make.config @@ -0,0 +1,6 @@ +CORE_LDFLAGS= +CORE_LIBS=-lglfw + +CORE_OBJS=$(COREDIR)/graphics.o \ + $(COREDIR)/init.o \ + $(COREDIR)/logging.o \ diff --git a/include/rune_logging.h b/include/rune_logging.h index a0b9e29..f8876db 100644 --- a/include/rune_logging.h +++ b/include/rune_logging.h @@ -11,6 +11,6 @@ enum log_level { LOG_DEBUG }; -void log_output(int level, const char *fmt, ...); +RAPI void log_output(int level, const char *fmt, ...); #endif diff --git a/render-vulkan/make.config b/render-vulkan/make.config new file mode 100644 index 0000000..1999079 --- /dev/null +++ b/render-vulkan/make.config @@ -0,0 +1,7 @@ +RENDER_LDFLAGS= +RENDER_LIBS=-lvulkan + +RENDER_OBJS=$(RENDERDIR)/vulkan_context.o \ + $(RENDERDIR)/vulkan_debug.o \ + $(RENDERDIR)/vulkan_device.o \ + $(RENDERDIR)/vulkan_swapchain.o \ |