mirror of
https://github.com/opus-tango/DSA-reference.git
synced 2026-03-20 03:55:22 +00:00
44 lines
643 B
Makefile
44 lines
643 B
Makefile
# Compiler and flags
|
|
CC = gcc
|
|
DEBUG_FLAGS = -g -Wall -Wextra
|
|
RELEASE_FLAGS = -Wall -Wextra -DNDEBUG
|
|
# LFLAGS = -lpthread
|
|
|
|
# Source files
|
|
SRCS = main.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
|