caur/Makefile
2024-08-31 01:17:14 -04:00

27 lines
548 B
Makefile

# Define the compiler and flags
CC = gcc
CFLAGS = -Wall -Wextra -Werror
# Define the target executable and the source files
TARGET = caur
SRCS = $(wildcard src/*.c)
OBJS = $(SRCS:.c=.o)
# The default rule: build the target
all: $(TARGET)
# Link the object files into the target executable
$(TARGET): $(OBJS)
$(CC) $(CFLAGS) -o $(TARGET) $(OBJS)
# Compile the .c files into .o files
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Clean up the build artifacts
clean:
rm -f $(TARGET) $(OBJS)
# Run the program
run: $(TARGET)
./$(TARGET)