Files
DSA-reference/data-structures/trees/binary-tree/c/Makefile
2025-11-16 12:39:36 -05:00

44 lines
657 B
Makefile

# Compiler and flags
CC = gcc
DEBUG_FLAGS = -g -Wall -Wextra
RELEASE_FLAGS = -Wall -Wextra -DNDEBUG
# LFLAGS = -lpthread
# Source files
SRCS = main.c binary-tree.c
# Object files definition
OBJS = $(SRCS:.c=.o)
TARGET = main.out
# BUILD STUFF
# Default to debug
all: debug
debug: CFLAGS = $(DEBUG_FLAGS)
debug: $(TARGET)
release: CFLAGS = $(RELEASE_FLAGS)
release: $(TARGET)
# Link object files
$(TARGET): $(OBJS)
$(CC) -o $(TARGET) $(OBJS) $(LFLAGS)
# Compile object files
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
# Object dependencies
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f $(OBJS)
rm -f $(TARGET)
.PHONY: all debug release clean