36 lines
850 B
Makefile
36 lines
850 B
Makefile
CC = gcc
|
|
CFLAGS = -Wall -Wextra -Werror -O3 -std=c11
|
|
INCLUDES = -Iinclude
|
|
SRCDIR = src
|
|
OBJDIR = obj
|
|
BINDIR = bin
|
|
|
|
SOURCES = $(wildcard $(SRCDIR)/*.c)
|
|
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
|
|
EXECUTABLE = $(BINDIR)/galaxies
|
|
|
|
.PHONY: all clean
|
|
|
|
all: $(EXECUTABLE)
|
|
|
|
$(EXECUTABLE): $(OBJECTS) | $(BINDIR)
|
|
$(CC) $(CFLAGS) $(OBJECTS) -o $@
|
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
|
|
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
|
|
|
|
$(OBJDIR):
|
|
mkdir -p $@
|
|
|
|
$(BINDIR):
|
|
mkdir -p $@
|
|
|
|
clean:
|
|
rm -rf $(OBJDIR) $(BINDIR)
|
|
|
|
# Header dependencies
|
|
$(OBJDIR)/main.o: include/generator.h include/solver.h include/output.h
|
|
$(OBJDIR)/generator.o: include/generator.h include/utils.h
|
|
$(OBJDIR)/solver.o: include/solver.h include/generator.h include/utils.h
|
|
$(OBJDIR)/output.o: include/output.h include/generator.h
|
|
$(OBJDIR)/utils.o: include/utils.h include/generator.h |