-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
53 lines (38 loc) · 970 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
TARGET = wavbuff.exe
# comment out to use basedir
builddir = build/
SRC = main.cpp wavutil.c pa.cpp pa_ringbuffer.c rb.c
SRCDIR_2 = lib
INCLUDE = -Iportaudio_win/include
INCLUDE += -Ilib
LIBS = -Lportaudio_win/build
LIBS += -lportaudio
CXX = g++
FLAGS = -g -Wall
OBJECTS = $(addprefix $(builddir), $(addsuffix .o, $(basename $(notdir $(SRC)))))
# uncomment to put exe in /build
# TARGET := $(addprefix $(builddir), $(TARGET))
# compile objects
$(builddir)%.o: %.cpp
$(CXX) $(INCLUDE) $(FLAGS) -c $< -o $@ $(LIBS)
@echo $@
$(builddir)%.o: $(SRCDIR_2)/%.c
$(CXX) $(INCLUDE) $(FLAGS) -c $< -o $@ $(LIBS)
@echo $@
$(builddir)%.o: $(SRCDIR_2)/%.cpp
$(CXX) $(INCLUDE) $(FLAGS) -c $< -o $@ $(LIBS)
@echo $@
all: make_dir $(TARGET)
# build exe
$(TARGET): $(OBJECTS)
$(CXX) $(FLAGS) $^ -o $@ $(LIBS)
make_dir : $(builddir)
$(builddir):
mkdir -p $(builddir)
clean:
rm -f $(OBJECTS) $(TARGET)
print:
@echo $(OBJECTS)
@echo $(TARGET)
run:
@./$(TARGET)