-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
67 lines (46 loc) · 1.36 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
target := out
cxx := g++
flags := -std=c++1z
builddir = build/
sources := main.cpp lib/pa.cpp expr/lexer.cpp expr/symtable.cpp expr/parser.cpp
includes := -I ../libraries/portaudio/include
OS_HOST = OS_WIN
# OS_HOST = OS_MAC
# OS_HOST = OS_GNU
ifeq '$(OS_HOST)' 'OS_WIN'
flags += -D OS_HOST=OS_WIN
sources += lib/io_win.cpp
libs = -L ../libraries/portaudio/build -lportaudio
else ifeq '$(OS_HOST)' 'OS_MAC'
flags += -D OS_HOST=OS_MAC
sources += lib/io_mac.mm
libs = -L /usr/local/lib -lportaudio
libs += -lobjc -framework Foundation -framework Cocoa
else ifeq '$(OS_HOST)' 'OS_GNU'
flags += -D OS_HOST=OS_GNU
sources += lib/io_gnu.cpp
libs = -L /usr/local/lib -lportaudio
endif
objects := $(addprefix $(builddir), $(addsuffix .o, $(basename $(notdir $(sources)))))
$(builddir)%.o: %.cpp $(wildcard *.h)
$(cxx) $(flags) $(includes) -c $< -o $@
@echo $@
$(builddir)%.o: lib/%.cpp $(wildcard lib/*.h)
$(cxx) $(flags) $(includes) -c $< -o $@
@echo $@
$(builddir)%.o: lib/%.mm $(wildcard lib/*.h)
$(cxx) $(flags) $(includes) -c $< -o $@
@echo $@
$(builddir)%.o: expr/%.cpp $(wildcard expr/*.h)
$(cxx) $(flags) $(includes) -c $< -o $@
@echo $@
all: make_dir $(target)
$(target): $(objects) Makefile
$(cxx) $(objects) -o $(target) $(libs)
make_dir : $(builddir)
$(builddir):
mkdir -p $(builddir)
clean:
rm -f $(objects) $(target)
run:
@./$(target)