2014-05-28 08:10:47 +00:00
# Makefile.in for Serval DNA
# vim: noet ts=8 sts=0 sw=8
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@
2014-03-26 05:05:43 +00:00
sysconfdir = @sysconfdir@
localstatedir = @localstatedir@
2013-10-13 08:09:17 +00:00
2012-10-18 06:40:45 +00:00
NACL_BASE = nacl/src
i n c l u d e $( NACL_BASE ) / n a c l . m k
2012-10-24 18:00:14 +00:00
i n c l u d e s o u r c e f i l e s . m k
i n c l u d e h e a d e r f i l e s . m k
2012-03-14 22:54:31 +00:00
2014-05-28 08:10:47 +00:00
OBJSDIR_SERVALD = objs_servald
OBJSDIR_LIB = objs_lib
OBJSDIR_TOOLS = objs
OBJSDIRS = $( OBJSDIR_SERVALD) $( OBJSDIR_LIB) $( OBJSDIR_TOOLS)
2014-12-01 02:18:46 +00:00
ALL_SOURCES = \
$( SERVAL_CLIENT_SOURCES) \
$( MDP_CLIENT_SOURCES) \
$( SERVAL_DAEMON_SOURCES) \
$( NACL_SOURCES) \
$( TEST_SOURCES) \
$( SERVAL_LIB_SOURCES) \
$( MONITOR_CLIENT_SRCS) \
$( SIMULATOR_SOURCES) \
$( SQLITE3_SOURCES)
2014-05-23 08:19:00 +00:00
SERVAL_DAEMON_OBJS = \
2014-05-28 08:10:47 +00:00
$( addprefix $( OBJSDIR_SERVALD) /, $( SERVAL_CLIENT_SOURCES:.c= .o) ) \
$( addprefix $( OBJSDIR_SERVALD) /, $( MDP_CLIENT_SOURCES:.c= .o) ) \
$( addprefix $( OBJSDIR_SERVALD) /, $( SERVAL_DAEMON_SOURCES:.c= .o) )
2014-05-23 08:19:00 +00:00
SERVALD_OBJS = \
2014-05-28 08:10:47 +00:00
$( addprefix $( OBJSDIR_SERVALD) /, $( notdir $( SQLITE3_SOURCES:.c= .o) ) ) \
$( addprefix $( OBJSDIR_SERVALD) /, $( NACL_SOURCES:.c= .o) ) \
$( SERVAL_DAEMON_OBJS)
2014-12-01 02:18:46 +00:00
TEST_OBJS = \
$( addprefix $( OBJSDIR_SERVALD) /, $( TEST_SOURCES:.c= .o) ) \
$( addprefix $( OBJSDIR_SERVALD) /, $( NACL_SOURCES:.c= .o) ) \
$( addprefix $( OBJSDIR_SERVALD) /, $( SERVAL_CLIENT_SOURCES:.c= .o) )
2014-05-23 08:19:00 +00:00
LIB_SERVAL_OBJS = \
2014-05-28 08:10:47 +00:00
$( addprefix $( OBJSDIR_LIB) /, $( SERVAL_CLIENT_SOURCES:.c= .o) ) \
$( addprefix $( OBJSDIR_LIB) /, $( SERVAL_LIB_SOURCES:.c= .o) ) \
$( addprefix $( OBJSDIR_LIB) /, $( MDP_CLIENT_SOURCES:.c= .o) )
2014-05-23 08:19:00 +00:00
MONITOR_CLIENT_OBJS = \
2014-05-28 08:10:47 +00:00
$( addprefix $( OBJSDIR_LIB) /, $( SERVAL_CLIENT_SOURCES:.c= .o) ) \
2016-01-18 10:46:01 +00:00
$( addprefix $( OBJSDIR_LIB) /, $( SERVAL_LIB_SOURCES:.c= .o) ) \
2014-05-28 08:10:47 +00:00
$( addprefix $( OBJSDIR_LIB) /, $( MONITOR_CLIENT_SRCS:.c= .o) )
2014-05-23 08:19:00 +00:00
SIMULATOR_OBJS = \
2014-05-28 08:10:47 +00:00
$( addprefix $( OBJSDIR_TOOLS) /, $( SIMULATOR_SOURCES:.c= .o) )
CC = @CC@
2012-03-14 22:54:31 +00:00
2014-06-11 10:42:56 +00:00
LDFLAGS = @LDFLAGS@ @LIBS@
2012-03-14 22:54:31 +00:00
2014-06-11 10:42:56 +00:00
CFLAGS = -Isqlite-amalgamation-3070900 @CPPFLAGS@ @CFLAGS@ -Inacl/include
2014-06-30 00:44:12 +00:00
CFLAGS += -DSYSCONFDIR= " \" $( sysconfdir) \" " -DLOCALSTATEDIR= " \" $( localstatedir) \" "
CFLAGS += -DSQLITE_THREADSAFE= 0 -DSQLITE_OMIT_DATETIME_FUNCS -DSQLITE_OMIT_COMPILEOPTION_DIAGS -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_VIRTUALTABLE -DSQLITE_OMIT_AUTHORIZATION
2012-08-06 07:33:00 +00:00
CFLAGS += -fPIC
2015-10-19 02:31:44 +00:00
CFLAGS += -Wall -Werror
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
- i n c l u d e M a k e f i l e . d b g
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
2014-06-27 07:56:01 +00:00
all : servald libserval .so libmonitorclient .so libmonitorclient .a test
2013-08-19 04:05:58 +00:00
2014-12-01 02:18:46 +00:00
test : tfw_createfile directory_service fakeradio simulator serval -tests
2012-03-14 22:54:31 +00:00
2014-05-28 08:10:47 +00:00
covzero : | is_built_with_coverage
@echo REMOVE all .gcda files
@find $( OBJSDIRS) -type f -name '*.gcda' -print0 | xargs -0 $( RM)
covinit : servald -initial .info
covhtml : coverage_html /index .html
is_built_with_coverage :
@for obj in $( SERVALD_OBJS) ; do \
gcno = " $$ {obj%.o}.gcno " ; \
if [ ! -r " $$ gcno " ] ; then \
echo " ERROR: servald has not been compiled for code coverage; missing $$ gcno " ; \
exit 1 ; \
fi ; \
done
has_coverage_data : | is_built_with_coverage
@count= 0; for obj in $( SERVALD_OBJS) ; do \
gcda = " $$ {obj%.o}.gcda " ; \
[ -s " $$ gcda " ] && count = $$ ( ( $$ count + 1) ) ; \
done ; \
if [ $$ count -eq 0 ] ; then \
echo "ERROR: no code coverage data; run some tests" ; \
exit 1 ; \
fi
servald-initial.info : Makefile servald | is_built_with_coverage
geninfo --quiet --initial --checksum --base-directory= $( abspath .) --no-external $( OBJSDIR_SERVALD) -o $@
servald-coverage.info : Makefile servald $( shell find $ ( OBJSDIR_SERVALD ) -type f -name '*.gcda ') | has_coverage_data
geninfo --quiet --checksum --base-directory= $( abspath .) --no-external $( OBJSDIR_SERVALD) -o $@ 2>& 1 | { grep -v 'WARNING: no data found for .*\.h$$' || true; }
@[ -s $@ ]
coverage_html/index.html : Makefile servald -initial .info servald -coverage .info
$( RM) -r coverage_html
genhtml --quiet servald-initial.info servald-coverage.info -o coverage_html
2014-11-30 23:49:09 +00:00
.PRECIOUS : Makefile
Makefile : Makefile .in config .status
$( warning Makefile may be out of date, please run ./config.status)
2012-04-20 07:40:38 +00:00
2014-11-30 23:49:09 +00:00
config.status : configure
$( warning config.status may be out of date, please run ./configure)
configure : configure .in
2014-05-23 08:19:00 +00:00
$( warning configure may be out of date, please run autoreconf -f -i)
2014-12-01 02:18:46 +00:00
$(OBJSDIR_TOOLS)/version.o : $( ALL_SOURCES ) $( HDRS ) version_servald .c version_string .sh $( wildcard VERSION .txt ) COPYRIGHT .txt
2013-08-19 04:05:58 +00:00
@echo CC version_servald.c
2014-07-02 00:39:13 +00:00
@mkdir -p $( dir $@ )
2014-05-28 08:10:47 +00:00
@$( RM) $( @:.o= .gcno) $( @:.o= .gcda)
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` " \
2014-07-02 00:39:13 +00:00
&& $( CC) $( CFLAGS) $( DEFS) -c version_servald.c -o $@ -DSERVALD_VERSION= " \" $$ V\" " -DSERVALD_COPYRIGHT= " \" $$ C\" "
2013-08-19 04:05:58 +00:00
2014-05-23 08:19:00 +00:00
#' <-- fixes vim syntax highlighting
2014-05-09 05:57:23 +00:00
2014-05-28 08:10:47 +00:00
$(OBJSDIR_SERVALD)/sqlite3.o : sqlite -amalgamation -3070900/sqlite 3.c Makefile
2014-05-23 08:19:00 +00:00
@echo SERVALD CC $<
@mkdir -p $( dir $@ )
2014-05-28 08:10:47 +00:00
@$( RM) $( @:.o= .gcno) $( @:.o= .gcda)
2014-05-23 08:19:00 +00:00
@$( CC) $( CFLAGS) $( DEFS) -c $< -o $@
# No object files in source directory!
%.o : %.c
2014-05-09 05:57:23 +00:00
2014-05-28 08:10:47 +00:00
$(OBJSDIR_TOOLS)/%.o : %.c
2012-05-10 03:53:06 +00:00
@echo CC $<
2014-05-23 08:19:00 +00:00
@mkdir -p $( dir $@ )
2014-05-29 01:34:09 +00:00
@$( RM) $( @:.o= .gcno) $( @:.o= .gcda)
2014-05-23 08:19:00 +00:00
@$( CC) $( CFLAGS) $( DEFS) -c $< -o $@
2014-05-28 08:10:47 +00:00
$(OBJSDIR_SERVALD)/%.o : %.c
2014-05-23 08:19:00 +00:00
@echo SERVALD CC $<
@mkdir -p $( dir $@ )
2014-05-29 01:34:09 +00:00
@$( RM) $( @:.o= .gcno) $( @:.o= .gcda)
2014-05-23 08:19:00 +00:00
@$( CC) $( CFLAGS) $( DEFS) -c $< -o $@
2014-05-28 08:10:47 +00:00
$(OBJSDIR_LIB)/%.o : %.c
2014-05-23 08:19:00 +00:00
@echo LIB CC $<
@mkdir -p $( dir $@ )
2014-05-29 01:34:09 +00:00
@$( RM) $( @:.o= .gcno) $( @:.o= .gcda)
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 )
2014-05-29 01:34:09 +00:00
$(SERVALD_OBJS) : Makefile
$(LIB_SERVAL_OBJS) : $( HDRS ) Makefile
2015-03-30 03:18:13 +00:00
$(TEST_OBJS) : $( HDRS ) Makefile
2015-09-21 03:15:03 +00:00
$(OBJSDIR_TOOLS)/tfw_createfile.o : str .h Makefile
$(OBJSDIR_TOOLS)/directory_service.o : $( HDRS ) Makefile
2014-05-29 01:34:09 +00:00
$(MONITOR_CLIENT_OBJS) : $( HDRS ) Makefile
$(SIMULATOR_OBJS) : $( HDRS ) Makefile
2012-11-22 07:48:00 +00:00
2014-05-28 08:10:47 +00:00
servald : $( SERVALD_OBJS ) $( OBJSDIR_TOOLS ) /version .o
2012-05-10 03:53:06 +00:00
@echo LINK $@
2014-06-11 10:42:56 +00:00
@$( CC) -Wall -o $@ $( SERVALD_OBJS) $( OBJSDIR_TOOLS) /version.o $( LDFLAGS)
2014-05-23 08:19:00 +00:00
2014-12-01 02:18:46 +00:00
serval-tests : $( TEST_OBJS ) $( OBJSDIR_TOOLS ) /version .o
@echo LINK $@
@$( CC) -Wall -o $@ $( TEST_OBJS) $( OBJSDIR_TOOLS) /version.o $( LDFLAGS)
2014-05-28 08:10:47 +00:00
libserval.a : $( LIB_SERVAL_OBJS ) $( OBJSDIR_TOOLS ) /version .o
2014-05-23 08:19:00 +00:00
@echo AR $@
2014-05-28 08:10:47 +00:00
@$( AR) -cr $@ $( LIB_SERVAL_OBJS) $( OBJSDIR_TOOLS) /version.o
2012-04-20 07:27:36 +00:00
2014-05-28 08:10:47 +00:00
directory_service : $( OBJSDIR_TOOLS ) /directory_service .o libserval .a
2012-09-14 02:20:45 +00:00
@echo LINK $@
2014-06-11 10:42:56 +00:00
@$( CC) -Wall -o $@ $( OBJSDIR_TOOLS) /directory_service.o libserval.a $( LDFLAGS)
2012-09-14 02:20:45 +00:00
2014-05-28 08:10:47 +00:00
tfw_createfile : $( OBJSDIR_TOOLS ) /tfw_createfile .o libserval .a
2012-10-31 07:43:33 +00:00
@echo LINK $@
2014-06-11 10:42:56 +00:00
@$( CC) -Wall -o $@ $( OBJSDIR_TOOLS) /tfw_createfile.o libserval.a $( LDFLAGS)
2012-10-31 07:43:33 +00:00
2014-05-28 08:10:47 +00:00
fakeradio : $( OBJSDIR_TOOLS ) /fakeradio .o libserval .a
2013-08-19 04:26:19 +00:00
@echo LINK $@
2014-06-11 10:42:56 +00:00
@$( CC) -Wall -o $@ $( OBJSDIR_TOOLS) /fakeradio.o libserval.a $( LDFLAGS)
2013-08-19 04:26:19 +00:00
2014-05-23 08:19:00 +00:00
simulator : $( SIMULATOR_OBJS ) libserval .a
2014-05-02 04:32:25 +00:00
@echo LINK $@
2014-06-11 10:42:56 +00:00
@$( CC) -Wall -o $@ $( SIMULATOR_OBJS) libserval.a $( LDFLAGS)
2014-05-02 04:32:25 +00:00
2013-12-11 04:40:01 +00:00
copyright :
@if [ -x " $( COPYRIGHT_TOOL) " ] ; then \
2014-05-28 08:10:47 +00:00
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)
2014-05-28 08:10:47 +00:00
libserval.so : $( SERVALD_OBJS ) $( OBJSDIR_TOOLS ) /version .o
2012-05-10 03:53:06 +00:00
@echo LINK $@
2014-06-11 10:42:56 +00:00
@$( CC) -Wall -shared -o $@ $( SERVALD_OBJS) $( OBJSDIR_TOOLS) /version.o $( LDFLAGS)
2012-03-14 22:54:31 +00:00
2014-05-28 08:10:47 +00:00
libmonitorclient.so : $( MONITOR_CLIENT_OBJS ) $( OBJSDIR_TOOLS ) /version .o
2012-07-29 03:05:53 +00:00
@echo LINK $@
2014-06-11 10:42:56 +00:00
@$( CC) -Wall -shared -o $@ $( MONITOR_CLIENT_OBJS) $( OBJSDIR_TOOLS) /version.o $( LDFLAGS)
2012-03-14 22:54:31 +00:00
2014-05-28 08:10:47 +00:00
libmonitorclient.a : $( MONITOR_CLIENT_OBJS ) $( OBJSDIR_TOOLS ) /version .o
2012-08-10 05:06:46 +00:00
@echo AR $@
2014-05-28 08:10:47 +00:00
@$( AR) -cr $@ $( MONITOR_CLIENT_OBJS) $( OBJSDIR_TOOLS) /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-05-28 08:10:47 +00:00
@$( RM) -r $( OBJSDIRS:%= %/*) \
servald libservald.so \
libserval.a libmonitorclient.so libmonitorclient.a \
2014-05-23 08:19:00 +00:00
fakeradio \
tfw_createfile