30 lines
539 B
Makefile
30 lines
539 B
Makefile
# Compiler and flags
|
|
CC = gcc
|
|
CFLAGS = -std=c99 -g -Wall
|
|
|
|
# Source files and object files
|
|
SRCS = main.c a_train.c
|
|
OBJS = $(SRCS:.c=.o)
|
|
|
|
# Target executable
|
|
TARGET = main
|
|
|
|
# Default rule to build the executable
|
|
all: $(TARGET)
|
|
|
|
# Rule to link object files and create the executable
|
|
$(TARGET): $(OBJS)
|
|
$(CC) $(OBJS) -o $(TARGET)
|
|
|
|
# Rule to compile .c files into .o files
|
|
%.o: %.c
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
|
|
|
# Clean up generated files
|
|
clean:
|
|
rm -f $(OBJS) $(TARGET)
|
|
|
|
# Phony targets (targets that are not actual files)
|
|
.PHONY: all clean
|
|
|