aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
blob: 70c141b5b9b0d27ea7c1d752665548e1a4ee3513 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
SRC_DIR := src
TARGET ?= ducc
BUILD_ROOT_DIR := build
BUILD_DIR := $(BUILD_ROOT_DIR)/.$(TARGET)

OBJECTS := \
	$(BUILD_DIR)/main.o \
	$(BUILD_DIR)/ast.o \
	$(BUILD_DIR)/cli.o \
	$(BUILD_DIR)/codegen.o \
	$(BUILD_DIR)/common.o \
	$(BUILD_DIR)/fs.o \
	$(BUILD_DIR)/io.o \
	$(BUILD_DIR)/json.o \
	$(BUILD_DIR)/parse.o \
	$(BUILD_DIR)/preprocess.o \
	$(BUILD_DIR)/sys.o \
	$(BUILD_DIR)/token.o \
	$(BUILD_DIR)/tokenize.o

.PHONY: all
all: $(BUILD_DIR) $(BUILD_ROOT_DIR)/$(TARGET)

$(BUILD_DIR):
	@mkdir -p $(BUILD_DIR)

# TODO: provide release build?
$(BUILD_ROOT_DIR)/$(TARGET): $(OBJECTS)
	$(CC) -Wall -MMD -g -O0 --std=c23 -o $@ $^

# TODO: provide release build?
$(BUILD_DIR)/%.o: src/%.c
	$(CC) -c $(CFLAGS) -Wall -MMD -g -O0 --std=c23 -o $@ $<

-include $(BUILD_DIR)/*.d