mirror of
https://codeberg.org/andyscott/marCsweep.git
synced 2024-11-09 13:50:51 -05:00
47 lines
745 B
Makefile
47 lines
745 B
Makefile
CC = gcc
|
|
CFLAGS = -O3 -Wall -Wextra -Wpedantic
|
|
|
|
SRCS = main.c vm.c gc.c
|
|
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)
|
|
|
|
|
|
|