-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
90 lines (68 loc) · 2.02 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# TODO:
#
ifndef TRAVIS
CC := g++
endif
ifdef TRAVIS
CC := g++-5
endif
EMCC := emcc
# CC := clang --analyze # and comment out the linker last line for sanity
SRCDIR := src
BUILDDIR := build
TARGETDIR := bin
TARGET := $(TARGETDIR)/tavla
EMTARGET := $(TARGETDIR)/tavla.html
INCDIR := include
WDIR := C:\git\tavlacpp
REQDIRS := output
SRCEXT := cpp
INCEXT := h
SOURCES := $(wildcard $(SRCDIR)/*.$(SRCEXT))
HEADERS := $(wildcard $(INCDIR)/*.$(INCEXT))
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o))
EMOBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.bc))
CFLAGS := -std=c++11 -mavx -g -Ofast # -Wall
CLFLAGS :=
EMCFLAGS := -std=c++11 -O2
LIB := #
INC := -I include
all: $(TARGET) directories test
emscripten: override CC := $(EMCC)
emscripten: override CFLAGS := $(EMCFLAGS)
emscripten: override TARGET := bin/tavla.htm
emscripten: override OBJECTS := $(EMOBJECTS)
emscripten: $(EMTARGET)
#$(EMTARGET): $(EMOBJECTS)
# @echo " Linking..."
# @echo " $(CC) $^ -o $(TARGET) $(LIB)"; $(CC) $^ -o $(TARGET) $(LIB)
$(BUILDDIR)/%.bc: $(SRCDIR)/%.$(SRCEXT) $(HEADERS)
@mkdir -p $(BUILDDIR)
@mkdir -p $(TARGETDIR)
@echo " $(CC) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $<
$(TARGET): $(OBJECTS)
@echo " Linking..."
@echo " $(CC) $^ -o $(TARGET) $(CLFLAGS) $(LIB)"; $(CC) $^ -o $(TARGET) $(CLFLAGS) $(LIB)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT) $(HEADERS)
@mkdir -p $(BUILDDIR)
@mkdir -p $(TARGETDIR)
@echo " $(CC) $(CFLAGS) $(INC) -c -o $@ $<"; $(CC) $(CFLAGS) $(INC) -c -o $@ $<
directories: $(REQDIRS)
$(REQDIRS):
@mkdir -p $(REQDIRS)
clean:
@echo " Cleaning...";
@echo " $(RM) -r $(BUILDDIR) $(TARGET)"; $(RM) -r $(BUILDDIR) $(TARGET)
cleanout:
@echo " Cleaning...";
@echo " $(RM) -r $(REQDIRS)"; $(RM) -r $(REQDIRS)
@mkdir -p $(REQDIRS)
# Tests
test: $(TARGET)
$(TARGET) test
#tester:
# $(CC) $(CFLAGS) test/tester.cpp $(INC) $(LIB) -o bin/tester
# Spikes
#ticket:
# $(CC) $(CFLAGS) spikes/ticket.cpp $(INC) $(LIB) -o bin/ticket
.PHONY: clean directories