-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathMakefile
38 lines (31 loc) · 963 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
30
31
32
33
34
35
36
37
38
TARGET := sfml-widgets-demo
SRCDIR := src
SRC := $(shell find $(SRCDIR) -name "*.cpp" -type f)
OBJDIR := obj
OBJ := $(SRC:%.cpp=$(OBJDIR)/%.o)
CC := g++
CFLAGS := -I$(SRCDIR) -std=c++11 -pedantic -Wall -Wextra -Wshadow -Wwrite-strings -O2
LDFLAGS := -lsfml-graphics -lsfml-window -lsfml-system -lGL
# Demo
$(TARGET): demo/demo.cpp lib/libsfml-widgets.a
@echo "\033[1;33mlinking exec\033[0m $@"
@$(CC) $< $(CFLAGS) -L./lib -lsfml-widgets $(LDFLAGS) -o $@
@echo "\033[1;32mDone!\033[0m"
# Static library
lib/libsfml-widgets.a: $(OBJ)
@mkdir -p lib
@echo "\033[1;33mlinking library\033[0m $@"
@ar crvf $@ $(OBJ)
# Library objects
$(OBJDIR)/%.o: %.cpp
@echo "\033[1;33mcompiling\033[0m $<"
@mkdir -p $(shell dirname $@)
@$(CC) $(CFLAGS) -c $< -o $@
clean:
@echo "\033[1;33mremoving\033[0m $(OBJDIR)"
-@rm -r lib
-@rm -r $(OBJDIR)
mrproper: clean
@echo "\033[1;33mremoving\033[0m $(TARGET)"
-@rm $(TARGET)
all: mrproper $(TARGET)