mirror of
https://codeberg.org/andyscott/marCsweep.git
synced 2024-11-13 15:50:50 -05:00
45 lines
863 B
Makefile
45 lines
863 B
Makefile
CC = gcc
|
|
CFLAGS =
|
|
CPPFLAGS = -Iinclude -MMD -MP
|
|
|
|
SRCDIR = src
|
|
|
|
SRCS = $(wildcard $(SRCDIR)/*.c)
|
|
OBJS = $(patsubst $(SRCDIR)/%.c,%.o,$(SRCS))
|
|
EXE = gc
|
|
|
|
DBDIR = debug
|
|
DBEXE = $(DBDIR)/$(EXE)
|
|
DBOBJS = $(addprefix $(DBDIR)/, $(OBJS))
|
|
DBCFLAGS = -g -O0 -DDEBUG
|
|
|
|
REDIR = bin
|
|
REEXE = $(REDIR)/$(EXE)
|
|
REOBJS = $(addprefix $(REDIR)/, $(OBJS))
|
|
RECFLAGS = -O3 -Wall -Wextra -Wpedantic -Werror
|
|
|
|
.PHONY: all clean debug prep release
|
|
|
|
all: debug release
|
|
|
|
debug: prep $(DBEXE)
|
|
|
|
$(DBEXE): $(DBOBJS)
|
|
$(CC) $(CFLAGS) $(DBCFLAGS) -o $@ $^
|
|
|
|
$(DBDIR)/%.o: $(SRCDIR)/%.c
|
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DBCFLAGS) -o $@ $<
|
|
|
|
release: prep $(REEXE)
|
|
|
|
$(REEXE): $(REOBJS)
|
|
$(CC) $(CFLAGS) $(RECFLAGS) -o $@ $^
|
|
|
|
$(REDIR)/%.o: $(SRCDIR)/%.c
|
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(RECFLAGS) -o $@ $<
|
|
|
|
prep:
|
|
@mkdir -p $(DBDIR) $(REDIR)
|
|
|
|
clean:
|
|
rm -rf $(DBDIR) $(REDIR)
|