2013-10-13 08:09:17 +00:00
|
|
|
prefix=@prefix@
|
2013-12-03 03:59:13 +00:00
|
|
|
exec_prefix=@exec_prefix@
|
|
|
|
bindir=@bindir@
|
|
|
|
sbindir=@sbindir@
|
2013-10-13 08:09:17 +00:00
|
|
|
|
2012-10-18 06:40:45 +00:00
|
|
|
NACL_BASE= nacl/src
|
|
|
|
include $(NACL_BASE)/nacl.mk
|
2012-10-24 18:00:14 +00:00
|
|
|
include sourcefiles.mk
|
|
|
|
include headerfiles.mk
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2012-09-06 03:13:06 +00:00
|
|
|
HAVE_ALSA= @HAVE_ALSA@
|
|
|
|
ifeq (HAVE_ALSA,1)
|
2014-03-03 01:42:56 +00:00
|
|
|
SERVAL_SOURCES+= audio_alsa.c
|
2012-11-22 07:48:00 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
HAVE_VOIPTEST= @HAVE_VOIPTEST@
|
|
|
|
ifeq ($(HAVE_VOIPTEST), 1)
|
2014-03-03 01:42:56 +00:00
|
|
|
SERVAL_SOURCES+= pa_phone.c
|
2012-11-22 07:48:00 +00:00
|
|
|
VOIPTEST_CFLAGS=-DHAVE_VOIPTEST=1
|
2012-09-05 09:23:22 +00:00
|
|
|
endif
|
|
|
|
|
2012-11-22 07:48:00 +00:00
|
|
|
SRCS= $(NACL_SOURCES) $(SERVAL_SOURCES)
|
|
|
|
|
2012-07-29 03:34:03 +00:00
|
|
|
MONITORCLIENTSRCS=conf.c \
|
2012-12-04 03:42:28 +00:00
|
|
|
conf_om.c \
|
|
|
|
conf_parse.c \
|
|
|
|
conf_schema.c \
|
2012-12-09 23:09:15 +00:00
|
|
|
dataformats.c \
|
2012-07-29 03:34:03 +00:00
|
|
|
log.c \
|
2013-11-21 01:42:46 +00:00
|
|
|
log_util.c \
|
2013-03-26 07:54:37 +00:00
|
|
|
xprintf.c \
|
2012-12-03 23:42:35 +00:00
|
|
|
os.c \
|
2012-12-03 23:26:24 +00:00
|
|
|
mem.c \
|
2012-07-29 03:34:03 +00:00
|
|
|
monitor-client.c \
|
2012-12-07 03:39:55 +00:00
|
|
|
instance.c \
|
2012-07-29 03:34:03 +00:00
|
|
|
net.c \
|
2013-09-19 07:56:06 +00:00
|
|
|
socket.c \
|
2012-08-06 02:55:45 +00:00
|
|
|
str.c \
|
2012-07-29 03:34:03 +00:00
|
|
|
strbuf.c \
|
2013-04-29 05:00:44 +00:00
|
|
|
strbuf_helpers.c \
|
|
|
|
rotbuf.c
|
2012-07-29 03:34:03 +00:00
|
|
|
|
2012-09-14 02:17:48 +00:00
|
|
|
MDPCLIENTSRCS=conf.c \
|
2012-12-04 03:42:28 +00:00
|
|
|
conf_om.c \
|
|
|
|
conf_parse.c \
|
|
|
|
conf_schema.c \
|
2012-09-18 02:56:30 +00:00
|
|
|
dataformats.c \
|
2012-12-03 23:42:35 +00:00
|
|
|
os.c \
|
2012-12-03 23:26:24 +00:00
|
|
|
mem.c \
|
2012-09-14 02:17:48 +00:00
|
|
|
log.c \
|
2013-11-21 01:42:46 +00:00
|
|
|
log_util.c \
|
2013-03-26 07:54:37 +00:00
|
|
|
xprintf.c \
|
2012-09-14 02:17:48 +00:00
|
|
|
mdp_client.c \
|
2012-12-07 03:39:55 +00:00
|
|
|
instance.c \
|
2012-09-14 02:17:48 +00:00
|
|
|
net.c \
|
2013-11-21 01:42:46 +00:00
|
|
|
mdp_net.c \
|
2013-09-19 07:56:06 +00:00
|
|
|
socket.c \
|
2012-09-14 02:17:48 +00:00
|
|
|
str.c \
|
|
|
|
strbuf.c \
|
2013-04-29 05:00:44 +00:00
|
|
|
strbuf_helpers.c \
|
|
|
|
rotbuf.c
|
2012-09-14 02:17:48 +00:00
|
|
|
|
2012-04-19 06:18:00 +00:00
|
|
|
OBJS= $(SRCS:.c=.o)
|
2012-11-22 07:48:00 +00:00
|
|
|
SERVAL_OBJS= $(SERVAL_SOURCES:.c=.o)
|
2012-07-29 03:34:03 +00:00
|
|
|
MONITORCLIENTOBJS= $(MONITORCLIENTSRCS:.c=.o)
|
2012-09-14 02:17:48 +00:00
|
|
|
MDPCLIENTOBJS= $(MDPCLIENTSRCS:.c=.o)
|
2012-07-29 03:34:03 +00:00
|
|
|
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2012-09-05 09:23:22 +00:00
|
|
|
LDFLAGS=@LDFLAGS@ @LIBS@ @PORTAUDIO_LIBS@ @SRC_LIBS@ @SPANDSP_LIBS@ @CODEC2_LIBS@ @PTHREAD_LIBS@
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2012-10-18 06:40:45 +00:00
|
|
|
CFLAGS= -Isqlite-amalgamation-3070900 @CPPFLAGS@ @CFLAGS@ @PORTAUDIO_CFLAGS@ @SRC_CFLAGS@ @SPANDSP_CFLAGS@ @PTHREAD_CFLAGS@ $(VOIPTEST_CFLAGS) -Inacl/include
|
2012-08-06 07:33:00 +00:00
|
|
|
CFLAGS+=-fPIC
|
2012-06-15 05:31:14 +00:00
|
|
|
CFLAGS+=-Wall -Wno-unused-value
|
2012-09-05 09:23:22 +00:00
|
|
|
# Solaris magic
|
|
|
|
CFLAGS+=-DSHA2_USE_INTTYPES_H -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1
|
2012-09-06 05:02:17 +00:00
|
|
|
# OSX magic to compensate for the Solaris magic
|
|
|
|
CFLAGS+=-D_DARWIN_C_SOURCE
|
2013-12-03 03:59:13 +00:00
|
|
|
|
|
|
|
INSTALL= install
|
|
|
|
INSTALL_PROGRAM=$(INSTALL)
|
|
|
|
INSTALL_DATA= $(INSTALL) -m 644
|
|
|
|
|
2012-07-29 05:25:10 +00:00
|
|
|
-include Makefile.dbg
|
2012-06-15 05:31:14 +00:00
|
|
|
|
2013-10-13 07:01:05 +00:00
|
|
|
# More warnings, discover problems that only happen on some archs
|
|
|
|
CFLAGS+=-Wextra
|
|
|
|
# Security enhancements from Debian
|
|
|
|
CFLAGS+=-fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2
|
|
|
|
|
2012-06-15 05:31:14 +00:00
|
|
|
DEFS= @DEFS@
|
2012-04-23 10:47:11 +00:00
|
|
|
|
2013-08-19 07:29:10 +00:00
|
|
|
.PHONY: all test clean
|
|
|
|
|
2013-08-19 04:05:58 +00:00
|
|
|
all: servald libmonitorclient.so libmonitorclient.a test
|
|
|
|
|
2013-11-21 01:42:46 +00:00
|
|
|
test: tfw_createfile directory_service fakeradio config_test
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2012-08-27 07:33:50 +00:00
|
|
|
sqlite-amalgamation-3070900/sqlite3.o: sqlite-amalgamation-3070900/sqlite3.c
|
2012-05-10 03:53:06 +00:00
|
|
|
@echo CC $<
|
2012-08-27 07:33:50 +00:00
|
|
|
@$(CC) $(CFLAGS) $(DEFS) -c $< -o sqlite-amalgamation-3070900/sqlite3.o
|
2012-04-20 07:40:38 +00:00
|
|
|
|
2013-12-05 02:51:58 +00:00
|
|
|
version.o: *.h *.c version_string.sh COPYRIGHT.txt Makefile
|
2013-08-19 04:05:58 +00:00
|
|
|
@echo CC version_servald.c
|
2013-09-12 07:57:07 +00:00
|
|
|
@V=`./version_string.sh --ignore-untracked` \
|
2013-12-05 02:51:58 +00:00
|
|
|
&& C="`sed -e :a -e N -e '$$!ba' -e 's/[\\\\"]/\\\\&/g' -e 's/\\n/\\\\n/g' COPYRIGHT.txt`" \
|
|
|
|
&& $(CC) -c version_servald.c -o $@ -DSERVALD_VERSION="\"$$V\"" -DSERVALD_COPYRIGHT="\"$$C\""
|
2013-08-19 04:05:58 +00:00
|
|
|
|
2012-11-22 07:48:00 +00:00
|
|
|
%.o: %.c
|
2012-05-10 03:53:06 +00:00
|
|
|
@echo CC $<
|
2012-10-18 06:40:45 +00:00
|
|
|
@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2012-11-22 07:48:00 +00:00
|
|
|
$(SERVAL_OBJS): $(HDRS)
|
|
|
|
$(MONITORCLIENTOBJS): $(HDRS)
|
|
|
|
$(MDPCLIENTOBJS): $(HDRS)
|
|
|
|
|
2013-08-19 04:05:58 +00:00
|
|
|
servald: $(OBJS) version.o
|
2012-05-10 03:53:06 +00:00
|
|
|
@echo LINK $@
|
2013-08-19 04:05:58 +00:00
|
|
|
@$(CC) $(CFLAGS) -Wall -o $@ $(OBJS) version.o $(LDFLAGS)
|
2012-04-20 07:27:36 +00:00
|
|
|
|
2013-08-19 04:05:58 +00:00
|
|
|
directory_service: $(MDPCLIENTOBJS) version.o directory_service.o
|
2012-09-14 02:20:45 +00:00
|
|
|
@echo LINK $@
|
2013-08-19 04:05:58 +00:00
|
|
|
@$(CC) $(CFLAGS) -Wall -o $@ $(MDPCLIENTOBJS) version.o directory_service.o $(LDFLAGS)
|
2012-09-14 02:20:45 +00:00
|
|
|
|
2012-11-20 03:13:51 +00:00
|
|
|
tfw_createfile: tfw_createfile.o str.o strbuf.o strbuf_helpers.o
|
2012-10-31 07:43:33 +00:00
|
|
|
@echo LINK $@
|
2012-11-20 03:13:51 +00:00
|
|
|
@$(CC) $(CFLAGS) -Wall -o $@ tfw_createfile.o str.o strbuf.o strbuf_helpers.o
|
2012-10-31 07:43:33 +00:00
|
|
|
|
2013-08-19 04:26:19 +00:00
|
|
|
fakeradio: fakeradio.o
|
|
|
|
@echo LINK $@
|
|
|
|
@$(CC) $(CFLAGS) -Wall -o $@ fakeradio.o
|
|
|
|
|
2013-11-21 01:42:46 +00:00
|
|
|
config_test: config_test.o conf_om.o conf_schema.o conf_parse.o str.o strbuf.o strbuf_helpers.o mem.o dataformats.o net.o log_util.o
|
|
|
|
@echo LINK $@
|
2013-12-06 02:20:08 +00:00
|
|
|
@$(CC) $(CFLAGS) -Wall -o $@ config_test.o conf_om.o conf_schema.o conf_parse.o str.o strbuf.o strbuf_helpers.o mem.o dataformats.o net.o log_util.o $(LDFLAGS)
|
2013-11-21 01:42:46 +00:00
|
|
|
|
2013-12-11 04:40:01 +00:00
|
|
|
copyright:
|
|
|
|
@if [ -x "$(COPYRIGHT_TOOL)" ]; then \
|
|
|
|
echo GENERATE COPYRIGHT.txt; \
|
|
|
|
$(COPYRIGHT_TOOL) -o COPYRIGHT.txt condense *.c *.h; \
|
|
|
|
else \
|
|
|
|
echo 'sp-copyright-tool is not in $$PATH; COPYRIGHT.txt not updated'; \
|
|
|
|
fi
|
2013-12-05 02:51:58 +00:00
|
|
|
|
|
|
|
findPATH = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
|
|
|
|
COPYRIGHT_TOOL := $(call findPATH,sp-copyright-tool)
|
|
|
|
|
2012-06-15 05:31:14 +00:00
|
|
|
# This does not build on 64 bit elf platforms as NaCL isn't built with -fPIC
|
|
|
|
# DOC 20120615
|
2014-02-12 03:59:13 +00:00
|
|
|
libserval.so: $(OBJS) version.o
|
2012-05-10 03:53:06 +00:00
|
|
|
@echo LINK $@
|
2013-08-19 04:05:58 +00:00
|
|
|
@$(CC) $(CFLAGS) -Wall -shared -o $@ $(OBJS) version.o $(LDFLAGS)
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2013-08-19 04:05:58 +00:00
|
|
|
libmonitorclient.so: $(MONITORCLIENTOBJS) version.o
|
2012-07-29 03:05:53 +00:00
|
|
|
@echo LINK $@
|
2013-08-19 04:05:58 +00:00
|
|
|
@$(CC) $(CFLAGS) -Wall -shared -o $@ $(MONITORCLIENTOBJS) version.o $(LDFLAGS)
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2013-08-19 04:05:58 +00:00
|
|
|
libmonitorclient.a: $(MONITORCLIENTOBJS) version.o
|
2012-08-10 05:06:46 +00:00
|
|
|
@echo AR $@
|
2013-08-19 04:05:58 +00:00
|
|
|
@$(AR) -cr $@ $(MONITORCLIENTOBJS) version.o
|
2012-08-10 05:06:46 +00:00
|
|
|
|
2013-10-13 08:09:17 +00:00
|
|
|
install: servald
|
2013-12-03 03:59:13 +00:00
|
|
|
$(INSTALL_PROGRAM) -D servald $(DESTDIR)$(sbindir)/servald
|
|
|
|
|
|
|
|
uninstall:
|
|
|
|
$(RM) $(DESTDIR)$(sbindir)/servald
|
2013-10-13 08:09:17 +00:00
|
|
|
|
2012-05-21 04:23:34 +00:00
|
|
|
clean:
|
2013-12-03 03:59:13 +00:00
|
|
|
@$(RM) $(OBJS) \
|
2013-08-19 04:05:58 +00:00
|
|
|
tfw_createfile.o version.o \
|
2013-08-19 04:26:19 +00:00
|
|
|
fakeradio.o fakeradio \
|
2013-08-19 04:05:58 +00:00
|
|
|
tfw_createfile servald \
|
|
|
|
libservald.so libmonitorclient.so libmonitorclient.a
|