# Build configuration.
# Copyright (c) 2023-2024, Quinn Stephens and the OSMORA team.
# Provided under the BSD 3-Clause license.

ENABLE_DEBUG = 1
CC = clang
LD = ld.ldd

EXENAME = quarkc
OFILES = $(addprefix compiler/,debug.o hash.o hashmap.o lexer/char_info.o lexer/keywords.o lexer/lexer.o parser/type.o parser/parser.o main.o)
CFLAGS = -Wall -Wextra -Iinclude
LDFLAGS =

ifeq ($(ENABLE_DEBUG),1)
CFLAGS += -DENABLE_DEBUG
endif

.PHONY: all
all: $(EXENAME)

$(EXENAME): $(OFILES)
	@echo Linking $@...
	@$(CC) $^ $(LDFLAGS) -o $@

%.o: %.c
	@echo Compiling $<...
	@$(CC) -c $< $(CFLAGS) -o $@

.PHONY: clean
clean:
	@echo Cleaning...
	@rm -f $(OFILES)