CC ?= gcc
CFLAGS = -Wall -Wextra -O2 -Iinclude
LDFLAGS =
TARGET = shelltoassembly
SRCS = src/main.c src/core.c src/ast.c src/optimizer.c src/codegen_arm64.c src/elf.c src/runner.c src/util.c
OBJS = $(SRCS:.c=.o)

all: $(TARGET)

$(TARGET): $(OBJS)
	$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

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

clean:
	rm -f $(OBJS) $(TARGET)

test: all
	bash run_all_tests.sh

.PHONY: all clean test
