aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-08-24 23:55:22 +0900
committernsfisis <nsfisis@gmail.com>2025-08-25 00:18:08 +0900
commit36da139565202a9a39d1e4261ab8bf950041518b (patch)
treec8e8867edc4e4fed94403331b8a7837e9951d9af /Makefile
parent5bbc4414b8178ff924444857ac05e5b06cf0e651 (diff)
downloadducc-36da139565202a9a39d1e4261ab8bf950041518b.tar.gz
ducc-36da139565202a9a39d1e4261ab8bf950041518b.tar.zst
ducc-36da139565202a9a39d1e4261ab8bf950041518b.zip
feat: separate compilation
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile19
1 files changed, 17 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 6eb170a..36b4825 100644
--- a/Makefile
+++ b/Makefile
@@ -2,13 +2,28 @@ SRC_DIR := src
BUILD_DIR := build
TARGET ?= ducc
+OBJECTS := \
+ $(BUILD_DIR)/main.o \
+ $(BUILD_DIR)/ast.o \
+ $(BUILD_DIR)/cli.o \
+ $(BUILD_DIR)/codegen.o \
+ $(BUILD_DIR)/common.o \
+ $(BUILD_DIR)/io.o \
+ $(BUILD_DIR)/parse.o \
+ $(BUILD_DIR)/preprocess.o \
+ $(BUILD_DIR)/sys.o \
+ $(BUILD_DIR)/tokenize.o
+
.PHONY: all
all: $(BUILD_DIR) $(BUILD_DIR)/$(TARGET)
-$(BUILD_DIR)/$(TARGET): main.c
- $(CC) -MD -g -O0 -o $@ $<
+$(BUILD_DIR)/$(TARGET): $(OBJECTS)
+ $(CC) -MD -g -O0 -o $@ $^
$(BUILD_DIR):
@mkdir -p $(BUILD_DIR)
+$(BUILD_DIR)/%.o: src/%.c
+ $(CC) -c -MD -g -O0 -o $@ $<
+
-include $(BUILD_DIR)/*.d