-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
69 lines (49 loc) · 1.63 KB
/
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
## Makefile
.PHONY: clean realclean
CC=clang++
OUTNAME_BIN=tile
BUILDDIR_BIN=.
OBJDIR=obj
INCDIR=
SRCDIR=src
SRCDIR_HDRS=src
LIBS=
LIBDIR=
LDFLAGS=-framework Carbon -framework Cocoa
CPPFLAGS=-Wall -std=c++14
OPTFLAGS=-m64 -O3 -flto -march=native
#########################################################################################
INCLUDES+=$(patsubst %,-I%,$(INCDIR))
LDFLAGS+=$(patsubst %,-L%,$(LIBDIR))
CPPFLAGS+=$(OPTFLAGS)
LDFLAGS+=$(OPTFLAGS)
# SRCDIR files
HDRS=$(wildcard $(SRCDIR_HDRS)/**/**/*.h)
HDRS=$(wildcard $(SRCDIR_HDRS)/**/*.h)
HDRS+=$(wildcard $(SRCDIR_HDRS)/*.h)
HDRS+=$(wildcard $(SRCDIR_HDRS)/**/**/*.hxx)
HDRS+=$(wildcard $(SRCDIR_HDRS)/**/*.hxx)
HDRS+=$(wildcard $(SRCDIR_HDRS)/*.hxx)
OBJS+=$(patsubst $(SRCDIR)/%.cc,$(OBJDIR)/%.o, $(wildcard $(SRCDIR)/**/**/*.cc))
OBJS+=$(patsubst $(SRCDIR)/%.cc,$(OBJDIR)/%.o, $(wildcard $(SRCDIR)/**/*.cc))
OBJS+=$(patsubst $(SRCDIR)/%.cc,$(OBJDIR)/%.o, $(wildcard $(SRCDIR)/*.cc))
OBJS+=$(patsubst $(SRCDIR)/%.mm,$(OBJDIR)/%.o, $(wildcard $(SRCDIR)/**/**/*.mm))
OBJS+=$(patsubst $(SRCDIR)/%.mm,$(OBJDIR)/%.o, $(wildcard $(SRCDIR)/**/*.mm))
OBJS+=$(patsubst $(SRCDIR)/%.mm,$(OBJDIR)/%.o, $(wildcard $(SRCDIR)/*.mm))
TARGET_BIN=$(BUILDDIR_BIN)/$(OUTNAME_BIN)
all: realclean $(TARGET_BIN)
$(TARGET_BIN):$(OBJS)
@mkdir -p $(@D)
$(CC) -o $(TARGET_BIN) $(LDFLAGS) $(OBJS) $(LIBS)
# dependencies
$(OBJDIR)/%.o:$(SRCDIR)/%.cc $(HDRS)
@mkdir -p $(@D)
$(CC) -o $@ $(CPPFLAGS) $(INCLUDES) -c $<
$(OBJDIR)/%.o:$(SRCDIR)/%.mm $(HDRS)
@mkdir -p $(@D)
$(CC) -o $@ $(CPPFLAGS) $(INCLUDES) -c $<
## other options
clean:
rm -rf $(OBJS)
realclean:
rm -rf $(OBJDIR) $(TARGET_BIN)