marCsweep/Makefile

48 lines
745 B
Makefile
Raw Permalink Normal View History

2024-08-19 15:46:10 -04:00
CC = gcc
CFLAGS = -O3 -Wall -Wextra -Wpedantic
2024-08-20 10:51:32 -04:00
SRCS = main.c vm.c gc.c
2024-08-19 15:46:10 -04:00
OBJS = $(SRCS:.c=.o)
EXE = gc
DBDIR = debug
DBEXE = $(DBDIR)/$(EXE)
DBOBJS = $(addprefix $(DBDIR)/, $(OBJS))
DBCFLAGS = -g -O0 -DDEBUG
REDIR = build
REEXE = $(REDIR)/$(EXE)
REOBJS = $(addprefix $(REDIR)/, $(OBJS))
.PHONY: all clean debug release prep
all: debug release gc
gc: $(REEXE)
@cp $< $@
debug: prep $(DBEXE)
$(DBEXE): $(DBOBJS)
$(CC) $(CFLAGS) $(DBCFLAGS) -DTEST -o $@ $^
$(DBDIR)/%.o: %.c
$(CC) -c $(CFLAGS) $(DBCFLAGS) -o $@ $<
release: prep $(REEXE)
$(REEXE): $(REOBJS)
$(CC) $(CFLAGS) -o $@ $^
$(REDIR)/%.o: %.c
$(CC) -c $(CFLAGS) -o $@ $<
prep:
@mkdir -p $(DBDIR) $(REDIR)
clean:
rm -rf gc $(DBDIR) $(REDIR)