From 786338948698ebfb02273931d688e757fe18d58c Mon Sep 17 00:00:00 2001 From: "Chloe M." Date: Sun, 28 Jun 2026 01:29:09 +0000 Subject: [PATCH] build: Make builds more modular Signed-off-by: Chloe M. --- Makefile | 25 +++++-------------------- core/Makefile | 23 +++++++++++++++++++++++ mk/global.mk | 12 ++++++++++++ 3 files changed, 40 insertions(+), 20 deletions(-) create mode 100644 core/Makefile create mode 100644 mk/global.mk diff --git a/Makefile b/Makefile index 36cdda3..1d6f875 100644 --- a/Makefile +++ b/Makefile @@ -2,28 +2,13 @@ # Copyright (c) 2026, Chloe M. # Provided under the BSD-3 clause # -# Description: CUMHOLE build script +# Description: Top-level build script # Author: Chloe M. # -.SILENT: -PROMPT := printf "%s\t\t%s\n" - -CC = gcc -CFILES = $(shell find . -name "*.c") -OFILES = $(CFILES:.c=.o) - -CFLAGS = \ - -Wall \ - -pedantic - .PHONY: all -all: hole +all: core -.PHONY: hole -hole: $(OFILES) - $(CC) $^ -o $@ - -%.o: %.c - $(PROMPT) "CC" $< - $(CC) -c $(CFLAGS) $< -o $@ +.PHONY: core +core: + cd core/; $(MAKE) diff --git a/core/Makefile b/core/Makefile new file mode 100644 index 0000000..b023378 --- /dev/null +++ b/core/Makefile @@ -0,0 +1,23 @@ +# +# Copyright (c) 2026, Chloe M. +# Provided under the BSD-3 clause +# +# Description: CUMHOLE build script +# Author: Chloe M. +# + +include ../mk/global.mk +.SILENT: + +CFILES = $(shell find . -name "*.c") +OFILES = $(CFILES:.c=.o) + +.PHONY: all +all: ../hole + +.PHONY: hole +../hole: $(OFILES) + $(CC) $^ -o $@ + +%.o: %.c + $(CC) -c $(CFLAGS) $< -o $@ diff --git a/mk/global.mk b/mk/global.mk new file mode 100644 index 0000000..34197af --- /dev/null +++ b/mk/global.mk @@ -0,0 +1,12 @@ +# +# Copyright (c) 2026, Chloe M. +# Provided under the BSD-3 clause +# +# Description: CUMHOLE global vars +# Author: Chloe M. +# + +CC = gcc +CFLAGS = \ + -Wall \ + -pedantic