-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
29 lines (24 loc) · 880 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
CC = clang++ -v -std=c++17
CFLAGS_RELEASE = -Llib/ -DGLEW_STATIC -lglfw3 -lGLEW -ldl -lX11 -lXrandr -Wl,-Bdynamic -lGL -lz -pthread -lfreetype
CFLAGS_DEBUG = -lGL -lGLEW -lglfw -lz -lX11 -lXrandr -lfreetype
SRCDIR = src
BUILDDIR = build
TARGET = zezlup
SRCEXT = cpp
FREETYPE = -I/usr/include/freetype2
RELEASE = -O3
DEBUG = -g
SOURCES = $(shell find $(SRCDIR) -type f -name *.$(SRCEXT))
OBJECTS = $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
release: export CMODE := $(RELEASE)
release: $(OBJECTS)
$(CC) $(RELEASE) $^ -o $(TARGET) $(CFLAGS_RELEASE)
debug: export CMODE := $(DEBUG)
debug: $(OBJECTS)
$(CC) $(DEBUG) $^ -o $(TARGET) $(CFLAGS_DEBUG)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(dir $@)
$(CC) $(CMODE) $(FREETYPE) -Wall -c -o $@ $<
clean:
@echo " Cleaning...";
@echo " $(RM) -r $(BUILDDIR) $(TARGET)"; $(RM) -r $(BUILDDIR) $(TARGET)