Initial Commit, project structure and build system.

This commit is contained in:
2025-10-18 23:52:08 +02:00
commit 6f587de022
9 changed files with 121 additions and 0 deletions

21
make/include/defaults.mk Normal file
View File

@@ -0,0 +1,21 @@
CC ?= i686-w64-mingw32-gcc
CFLAGS = -Wall -Wextra -pedantic -Werror -std=c23
SRC_DIR = src
SRC_DIR_COMMON = $(SRC_DIR)/common
SRC_DIR_RUNTIME = $(SRC_DIR)/runtime
SRC_DIR_LOADER = $(SRC_DIR)/loader
SOURCES_COMMON := $(shell find $(SRC_DIR_COMMON) -name '*.c')
SOURCES_RUNTIME := $(shell find $(SRC_DIR_RUNTIME) -name '*.c')
SOURCES_LOADER := $(shell find $(SRC_DIR_LOADER) -name '*.c')
BUILD_DIR ?= build
OBJECTS_COMMON = $(SOURCES_COMMON:%.c=$(BUILD_DIR)/%.o)
OBJECTS_RUNTIME = $(SOURCES_RUNTIME:%.c=$(BUILD_DIR)/%.o)
OBJECTS_LOADER = $(SOURCES_LOADER:%.c=$(BUILD_DIR)/%.o)
DEPS_COMMON = $(SOURCES_COMMON:%.c=$(BUILD_DIR)/%.d)
DEPS_RUNTIME = $(SOURCES_RUNTIME:%.c=$(BUILD_DIR)/%.d)
DEPS_LOADER = $(SOURCES_LOADER:%.c=$(BUILD_DIR)/%.d)

9
make/include/shared.mk Normal file
View File

@@ -0,0 +1,9 @@
$(TARGET): $(OBJECTS)
@mkdir -p $(dir $@)
$(CC) $(OBJECTS) $(LDFLAGS) -o $@
$(BUILD_DIR)/%.o: %.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -MMD -MP -c $< -o $@
-include $(DEPS)