Initial commit

This commit is contained in:
2026-02-08 12:14:24 -06:00
commit f183ed2147
7 changed files with 141 additions and 0 deletions

56
Makefile Normal file
View File

@@ -0,0 +1,56 @@
# Compiler settings
CC=gcc
CFLAGS=-std=c11 -Wall -Wextra -O2 -Iinclude
SHELL=/bin/sh
# Directories
SRCDIR=src
INCDIR=include
OBJDIR=build
DISTDIR=dist
TESTDIR=tests
# Platform-specific sources
ifeq ($(OS),Windows_NT)
PLATFORM_SRC=$(SRCDIR)/win32_platform.c
OBJEXT=obj
LIBEXT=dll
RM=del /Q
MKDIR=if not exist "$(1)" mkdir "$(1)"
else
PLATFORM_SRC=$(SRCDIR)/linux_platform.c
OBJEXT=o
LIBEXT=so
RM=rm -f
MKDIR=mkdir -p $(1)
endif
# Sources and objects
SRC=$(PLATFORM_SRC) $(TESTDIR)/main.c
OBJ=$(patsubst %.c,$(OBJDIR)/%.$(OBJEXT),$(SRC))
# Targets
.PHONY: all clean run
all: $(DISTDIR)/app
# Build main executable
$(DISTDIR)/app: $(OBJ)
@$(call MKDIR,$(DISTDIR))
$(CC) $(CFLAGS) $(OBJ) -o $@
# Compile object files
$(OBJDIR)/%.$(OBJEXT): %.c
@$(call MKDIR,$(dir $@))
$(CC) $(CFLAGS) -c $< -o $@
# Run the app
run: $(DISTDIR)/app
$(DISTDIR)/app
# Clean
clean:
-$(RM) $(OBJ)
-$(RM) $(DISTDIR)/*
@echo "Cleaned build and dist directories"