caur/Makefile

28 lines
548 B
Makefile
Raw Normal View History

# 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)