27 lines
548 B
Makefile
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)
|