Skip to content

Commit 161ae67

Browse files
committed
Add PortAudio linkage
1 parent d8a3d3b commit 161ae67

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

Makefile

+13-14
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ OBJS_EXTRA :=
1414
# command line option
1515
OPTS :=
1616

17-
LDFLAGS := -lm
17+
LDFLAGS :=
1818

1919
# virtio-blk
2020
ENABLE_VIRTIOBLK ?= 1
@@ -71,27 +71,26 @@ ifeq ($(call has, VIRTIOSND), 1)
7171
OBJS_EXTRA += virtio-snd.o
7272

7373
PORTAUDIOLIB := portaudio/lib/.libs/libportaudio.a
74-
LDFLAGS += -lasound -lpthread $(PORTAUDIOLIB) -lm -lrt -lpulse
75-
CFLAGS += -Icnfa -Iportaudio/include
76-
77-
cnfa/Makefile:
78-
git submodule update --init cnfa
79-
cnfa/os_generic: cnfa/Makefile
80-
$(MAKE) -C $(dir $<) os_generic.h
81-
CNFA_LIB := cnfa/CNFA_sf.h
82-
$(CNFA_LIB): cnfa/Makefile cnfa/os_generic
83-
$(MAKE) -C $(dir $<) CNFA_sf.h
74+
# PortAudio requires libm, yet we set -lm in the end of LDFLAGS
75+
# so that the other libraries will be benefited for no need to set
76+
# -lm separately.
77+
LDFLAGS += $(PORTAUDIOLIB) -lasound -lpthread -lrt -lpulse
78+
CFLAGS += -Iportaudio/include
79+
8480
portaudio/Makefile:
8581
git submodule update --init portaudio
8682
$(PORTAUDIOLIB): portaudio/Makefile
8783
@cd $(dir $<) && ./configure
8884
@cd $(dir $<) && $(MAKE)
89-
main.o: $(CNFA_LIB) $(PORTAUDIOLIB)
85+
main.o: $(PORTAUDIOLIB)
9086

91-
# suppress warning when compiling CNFA
92-
virtio-snd.o: CFLAGS += -Wno-unused-parameter -Wno-sign-compare
87+
# suppress warning when compiling PortAudio
88+
virtio-snd.o: CFLAGS += -Wno-unused-parameter
9389
endif
9490

91+
# Set libm as the last dependency so that no need to set -lm seperately.
92+
LDFLAGS += -lm
93+
9594
# .DEFAULT_GOAL should be set to all since the very first target is not all
9695
# after git submodule.
9796
.DEFAULT_GOAL := all

0 commit comments

Comments
 (0)