mirror of
https://codeberg.org/andyscott/marCsweep.git
synced 2024-12-22 01:33:11 -05:00
Rewrite Makefile for new directory structure
This commit is contained in:
parent
02d017af64
commit
73e2716100
1 changed files with 24 additions and 26 deletions
50
Makefile
50
Makefile
|
@ -1,47 +1,45 @@
|
|||
CC = gcc
|
||||
CFLAGS = -O3 -Wall -Wextra -Wpedantic
|
||||
CC = gcc
|
||||
CFLAGS =
|
||||
CPPFLAGS = -Iinclude -MMD -MP
|
||||
|
||||
SRCS = main.c vm.c gc.c galloc.c
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
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
|
||||
DBDIR = debug
|
||||
DBEXE = $(DBDIR)/$(EXE)
|
||||
DBOBJS = $(addprefix $(DBDIR)/, $(OBJS))
|
||||
DBCFLAGS = -g -O0 -DDEBUG
|
||||
|
||||
REDIR = build
|
||||
REEXE = $(REDIR)/$(EXE)
|
||||
REOBJS = $(addprefix $(REDIR)/, $(OBJS))
|
||||
REDIR = bin
|
||||
REEXE = $(REDIR)/$(EXE)
|
||||
REOBJS = $(addprefix $(REDIR)/, $(OBJS))
|
||||
RECFLAGS = -O3 -Wall -Wextra -Wpedantic -Werror
|
||||
|
||||
.PHONY: all clean debug release prep
|
||||
.PHONY: all clean debug prep release
|
||||
|
||||
all: debug release gc
|
||||
|
||||
gc: $(REEXE)
|
||||
@cp $< $@
|
||||
all: debug release
|
||||
|
||||
debug: prep $(DBEXE)
|
||||
|
||||
$(DBEXE): $(DBOBJS)
|
||||
$(CC) $(CFLAGS) $(DBCFLAGS) -DTEST -o $@ $^
|
||||
$(CC) $(CFLAGS) $(DBCFLAGS) -o $@ $^
|
||||
|
||||
$(DBDIR)/%.o: %.c
|
||||
$(CC) -c $(CFLAGS) $(DBCFLAGS) -o $@ $<
|
||||
$(DBDIR)/%.o: $(SRCDIR)/%.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DBCFLAGS) -o $@ $<
|
||||
|
||||
release: prep $(REEXE)
|
||||
|
||||
$(REEXE): $(REOBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^
|
||||
$(CC) $(CFLAGS) $(RECFLAGS) -o $@ $^
|
||||
|
||||
$(REDIR)/%.o: %.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
$(REDIR)/%.o: $(SRCDIR)/%.c
|
||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(RECFLAGS) -o $@ $<
|
||||
|
||||
prep:
|
||||
@mkdir -p $(DBDIR) $(REDIR)
|
||||
|
||||
clean:
|
||||
rm -rf gc $(DBDIR) $(REDIR)
|
||||
|
||||
|
||||
|
||||
rm -rf $(DBDIR) $(REDIR)
|
||||
|
|
Loading…
Reference in a new issue