-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (43 loc) · 954 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
NAME=mandelbrot
CXX=g++
CXXFLAGS+=-std=c++14 -Wall -Wextra -Werror -pedantic
SRCEXT:=.cpp
OBJEXT:=.o
SRCDIR:=src
OBJDIR:=obj
BINDIR:=bin
TGT:=$(BINDIR)/$(NAME)
MODS:=main
MODS+=gradient
MODS+=color-palette
MODS+=transforms
SRCS+=$(addprefix $(SRCDIR)/,$(addsuffix $(SRCEXT),$(MODS)))
OBJS+=$(addprefix $(OBJDIR)/,$(addsuffix $(OBJEXT),$(MODS)))
LIBS+=sfml-graphics
LIBS+=sfml-system
LIBS+=sfml-window
ifeq ($(OS),Windows_NT)
else
UNAME=$(shell uname)
ifeq ($(UNAME),Linux)
CXXFLAGS += -D Linux
LIBRARIES := $(addprefix -l,$(LIBS))
endif
ifeq ($(UNAME),Darwin)
CXXFLAGS += -D OSX
LIBS += SFML
FWKDIR := /Library/Frameworks
FWKS := $(addprefix -framework ,$(LIBS))
LIBRARIES := $(FWKS) -F $(FWKDIR)
endif
endif
all: $(TGT)
$(TGT): $(OBJS)
$(CXX) -o $@ $(OBJS) $(LIBRARIES)
$(OBJDIR)/%$(OBJEXT): $(SRCDIR)/%$(SRCEXT)
$(CXX) -o $@ -c $^ $(CXXFLAGS)
run: $(TGT)
./$(TGT)
clean:
rm -f $(TGT) $(OBJS)
.PHONY: all clean run