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
|
|
|
|
2014-03-04 11:23:01 +00:00
|
|
|
SERVALD_SRCS = \
|
|
|
|
$(SQLITE3_SOURCES) \
|
|
|
|
$(NACL_SOURCES) \
|
|
|
|
$(SERVAL_CLIENT_SOURCES) \
|
|
|
|
$(SERVAL_DAEMON_SOURCES)
|
|
|
|
|
2012-09-06 03:13:06 +00:00
|
|
|
HAVE_ALSA= @HAVE_ALSA@
|
|
|
|
ifeq (HAVE_ALSA,1)
|
2014-03-04 11:23:01 +00:00
|
|
|
SERVALD_SRCS+= audio_alsa.c
|
2012-11-22 07:48:00 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
HAVE_VOIPTEST= @HAVE_VOIPTEST@
|
|
|
|
ifeq ($(HAVE_VOIPTEST), 1)
|
2014-03-04 11:23:01 +00:00
|
|
|
SERVALD_SRCS+= 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
|
|
|
|
|
2014-03-04 11:23:01 +00:00
|
|
|
MONITOR_CLIENT_SRCS = \
|
|
|
|
$(SERVAL_CLIENT_SOURCES) \
|
|
|
|
monitor-client.c
|
2012-09-14 02:17:48 +00:00
|
|
|
|
2014-03-04 11:23:01 +00:00
|
|
|
MDP_CLIENT_SRCS = \
|
|
|
|
$(SERVAL_CLIENT_SOURCES) \
|
|
|
|
mdp_client.c \
|
|
|
|
mdp_net.c
|
2012-07-29 03:34:03 +00:00
|
|
|
|
2014-03-04 11:23:01 +00:00
|
|
|
SERVALD_OBJS= $(SERVALD_SRCS:.c=.o)
|
|
|
|
SERVAL_DAEMON_OBJS= $(SERVAL_DAEMON_SOURCES:.c=.o)
|
|
|
|
MONITOR_CLIENT_OBJS= $(MONITOR_CLIENT_SRCS:.c=.o)
|
|
|
|
MDP_CLIENT_OBJS= $(MDP_CLIENT_SRCS:.c=.o)
|
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
|
2014-02-25 04:17:00 +00:00
|
|
|
CFLAGS+=-Wformat -Werror=format-security -D_FORTIFY_SOURCE=2
|
2013-10-13 07:01:05 +00:00
|
|
|
|
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
|
|
|
|
2014-02-28 06:36:11 +00:00
|
|
|
version.o: *.h *.c version_string.sh VERSION.txt 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
|
|
|
|
2014-02-28 06:36:11 +00:00
|
|
|
VERSION.txt:
|
|
|
|
|
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
|
|
|
|
2014-03-04 11:23:01 +00:00
|
|
|
$(SERVAL_DAEMON_OBJS): $(HDRS)
|
|
|
|
$(MONITOR_CLIENT_OBJS): $(HDRS)
|
|
|
|
$(MDP_CLIENT_OBJS): $(HDRS)
|
2012-11-22 07:48:00 +00:00
|
|
|
|
2014-03-04 11:23:01 +00:00
|
|
|
servald: $(SERVALD_OBJS) version.o
|
2012-05-10 03:53:06 +00:00
|
|
|
@echo LINK $@
|
2014-03-04 11:23:01 +00:00
|
|
|
@$(CC) $(CFLAGS) -Wall -o $@ $(SERVALD_OBJS) version.o $(LDFLAGS)
|
2012-04-20 07:27:36 +00:00
|
|
|
|
2014-03-04 11:23:01 +00:00
|
|
|
directory_service: $(MDP_CLIENT_OBJS) version.o directory_service.o
|
2012-09-14 02:20:45 +00:00
|
|
|
@echo LINK $@
|
2014-03-04 11:23:01 +00:00
|
|
|
@$(CC) $(CFLAGS) -Wall -o $@ $(MDP_CLIENT_OBJS) 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-03-04 11:23:01 +00:00
|
|
|
libserval.so: $(SERVALD_OBJS) version.o
|
2012-05-10 03:53:06 +00:00
|
|
|
@echo LINK $@
|
2014-03-04 11:23:01 +00:00
|
|
|
@$(CC) $(CFLAGS) -Wall -shared -o $@ $(SERVALD_OBJS) version.o $(LDFLAGS)
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2014-03-04 11:23:01 +00:00
|
|
|
libmonitorclient.so: $(MONITOR_CLIENT_OBJS) version.o
|
2012-07-29 03:05:53 +00:00
|
|
|
@echo LINK $@
|
2014-03-04 11:23:01 +00:00
|
|
|
@$(CC) $(CFLAGS) -Wall -shared -o $@ $(MONITOR_CLIENT_OBJS) version.o $(LDFLAGS)
|
2012-03-14 22:54:31 +00:00
|
|
|
|
2014-03-04 11:23:01 +00:00
|
|
|
libmonitorclient.a: $(MONITOR_CLIENT_OBJS) version.o
|
2012-08-10 05:06:46 +00:00
|
|
|
@echo AR $@
|
2014-03-04 11:23:01 +00:00
|
|
|
@$(AR) -cr $@ $(MONITOR_CLIENT_OBJS) 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:
|
2014-03-04 11:23:01 +00:00
|
|
|
@$(RM) $(SERVALD_OBJS) $(MONITOR_CLIENT_OBJS) $(MDP_CLIENT_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
|