build: Make builds more modular

Signed-off-by: Chloe M. <chloe@mensia.org>
This commit is contained in:
Chloe M.
2026-06-28 01:29:09 +00:00
parent 6424cb799e
commit 7863389486
3 changed files with 40 additions and 20 deletions
+5 -20
View File
@@ -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)
+23
View File
@@ -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 $@
+12
View File
@@ -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