33 lines
588 B
Makefile
33 lines
588 B
Makefile
|
NAME=molehole
|
||
|
|
||
|
SRCDIR=src
|
||
|
OBJDIR=obj
|
||
|
BUILDDIR=build
|
||
|
|
||
|
SOURCES=$(shell find $(SRCDIR) -type f -name '*.c')
|
||
|
OBJSOURCES=$(patsubst %.c,$(OBJDIR)/%.o,$(notdir $(SOURCES)))
|
||
|
|
||
|
CC=clang
|
||
|
CFLAGS=-Wall -Wextra -pedantic -O0 -g
|
||
|
LDFLAGS=-lncurses -lssl -lc
|
||
|
INCLUDEFLAGS=-Iinclude
|
||
|
|
||
|
VPATH=$(dir $(SOURCES))
|
||
|
|
||
|
$(BUILDDIR)/$(NAME): $(OBJSOURCES) | $(BUILDDIR)
|
||
|
$(CC) -o $@ $^ $(CFLAGS) $(LDFLAGS)
|
||
|
|
||
|
$(OBJDIR)/%.o: %.c | $(OBJDIR)
|
||
|
$(CC) -c -o $@ $< $(CFLAGS) $(INCLUDEFLAGS)
|
||
|
|
||
|
$(BUILDDIR):
|
||
|
mkdir -p $(BUILDDIR)
|
||
|
$(OBJDIR):
|
||
|
mkdir -p $(OBJDIR)
|
||
|
|
||
|
|
||
|
.PHONY: clean
|
||
|
clean:
|
||
|
rm -rfv $(OBJDIR)
|
||
|
rm -rfv $(BUILDDIR)
|