@@ -77,38 +77,52 @@ $(call set-feature, VIRTIOSND)
77
77
ifeq ($(call has, VIRTIOSND) , 1)
78
78
OBJS_EXTRA += virtio-snd.o
79
79
80
- PORTAUDIOLIB := portaudio/lib/.libs/libportaudio.a
81
- LDFLAGS += $(PORTAUDIOLIB )
80
+ PA_LIB := portaudio/lib/.libs/libportaudio.a
81
+ PA_CFLAGS := -Iportaudio/include
82
+ PA_CONFIG_PARAMS :=
83
+ LDFLAGS += $(PA_LIB )
84
+ CFLAGS += $(PA_CFLAGS )
82
85
83
86
ifeq ($(UNAME_S),Linux)
84
87
LDFLAGS += -lasound -lrt
88
+ PA_CONFIG_PARAMS += --with-alsa
85
89
# Check PulseAudio installation
86
90
ifeq (0, $(call check-pa))
87
91
LDFLAGS += -lpulse
88
- else ifeq (0, $(call check-jack2))
89
- $(warning Detect JACK)
92
+ PA_CONFIG_PARAMS += --with-pulseaudio
93
+ endif
94
+ ifeq (0, $(call check-jack2))
90
95
LDFLAGS += -ljack
96
+ PA_CONFIG_PARAMS += --with-jack
91
97
endif
92
98
endif
93
99
ifeq ($(UNAME_S),Darwin)
94
100
LDFLAGS += -framework CoreServices -framework CoreFoundation -framework AudioUnit -framework AudioToolbox -framework CoreAudio
95
101
endif
96
102
97
- CFLAGS += -Iportaudio/include
98
103
# PortAudio requires libm, yet we set -lm in the end of LDFLAGS
99
104
# so that the other libraries will be benefited for no need to set
100
105
# -lm separately.
101
106
LDFLAGS += -lpthread
102
107
103
108
portaudio/Makefile :
104
109
git submodule update --init portaudio
105
- $(PORTAUDIOLIB ) : portaudio/Makefile
106
- cd $(dir $< ) && LDFLAGS=" " ./configure --without-sndio
110
+ $(PA_LIB ) : portaudio/Makefile
111
+ cd $(dir $< ) && git clean -fdx && git reset --hard HEAD
112
+ cd $(dir $< ) && ./configure \
113
+ --enable-static \
114
+ --disable-shared \
115
+ --without-samples \
116
+ --without-tests \
117
+ --without-oss \
118
+ --without-sndio \
119
+ --disable-dependency-tracking \
120
+ $(PA_CONFIG_PARAMS )
107
121
$(MAKE ) -C $(dir $< )
108
- main.o : $(PORTAUDIOLIB )
109
-
122
+ main.o : $(PA_LIB )
123
+ virtio-snd.o : $( PA_LIB )
110
124
# suppress warning when compiling PortAudio
111
- virtio-snd.o : CFLAGS += -Wno-unused-parameter
125
+ # virtio-snd.o: CFLAGS += -Wno-unused-parameter
112
126
endif
113
127
114
128
# Set libm as the last dependency so that no need to set -lm seperately.
0 commit comments