mirror of
https://codeberg.org/andyscott/marCsweep.git
synced 2024-11-09 13:50:51 -05:00
Added Makefile
This commit is contained in:
parent
8d7a24bfda
commit
3d55ec9731
1 changed files with 49 additions and 0 deletions
49
Makefile
Normal file
49
Makefile
Normal file
|
@ -0,0 +1,49 @@
|
|||
CC = gcc
|
||||
CFLAGS = -O3 -Wall -Wextra -Wpedantic
|
||||
|
||||
|
||||
SRCS = main.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)
|
||||
|
||||
|
||||
|
Loading…
Reference in a new issue