mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-22 06:27:51 +00:00
175 lines
5.7 KiB
Makefile
175 lines
5.7 KiB
Makefile
prefix=@prefix@
|
|
exec_prefix=@exec_prefix@
|
|
bindir=@bindir@
|
|
sbindir=@sbindir@
|
|
sysconfdir=@sysconfdir@
|
|
localstatedir=@localstatedir@
|
|
|
|
NACL_BASE= nacl/src
|
|
include $(NACL_BASE)/nacl.mk
|
|
include sourcefiles.mk
|
|
include headerfiles.mk
|
|
|
|
SERVAL_DAEMON_OBJS = \
|
|
$(addprefix objs_servald/, $(SERVAL_CLIENT_SOURCES:.c=.o)) \
|
|
$(addprefix objs_servald/, $(MDP_CLIENT_SOURCES:.c=.o)) \
|
|
$(addprefix objs_servald/, $(SERVAL_DAEMON_SOURCES:.c=.o))
|
|
SERVALD_OBJS = \
|
|
$(addprefix objs_servald/, $(notdir $(SQLITE3_SOURCES:.c=.o))) \
|
|
$(addprefix objs_servald/, $(NACL_SOURCES:.c=.o)) \
|
|
$(SERVAL_DAEMON_OBJS)
|
|
LIB_SERVAL_OBJS = \
|
|
$(addprefix objs_lib/, $(SERVAL_CLIENT_SOURCES:.c=.o)) \
|
|
$(addprefix objs_lib/, $(SERVAL_LIB_SOURCES:.c=.o)) \
|
|
$(addprefix objs_lib/, $(MDP_CLIENT_SOURCES:.c=.o))
|
|
MONITOR_CLIENT_OBJS = \
|
|
$(addprefix objs_lib/, $(SERVAL_CLIENT_SOURCES:.c=.o)) \
|
|
$(addprefix objs_lib/, $(MONITOR_CLIENT_SRCS:.c=.o))
|
|
SIMULATOR_OBJS = \
|
|
$(addprefix objs/, $(SIMULATOR_SOURCES:.c=.o))
|
|
|
|
LDFLAGS=@LDFLAGS@ @LIBS@ @PTHREAD_LIBS@
|
|
|
|
CFLAGS= -Isqlite-amalgamation-3070900 @CPPFLAGS@ @CFLAGS@ @PTHREAD_CFLAGS@ -Inacl/include
|
|
CFLAGS+=-DSYSCONFDIR="\"$(sysconfdir)\"" -DLOCALSTATEDIR="\"$(localstatedir)\""
|
|
CFLAGS+=-fPIC
|
|
CFLAGS+=-Wall -Wno-unused-value -Werror
|
|
# Solaris magic
|
|
CFLAGS+=-DSHA2_USE_INTTYPES_H -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__=1
|
|
# OSX magic to compensate for the Solaris magic
|
|
CFLAGS+=-D_DARWIN_C_SOURCE
|
|
|
|
INSTALL= install
|
|
INSTALL_PROGRAM=$(INSTALL)
|
|
INSTALL_DATA= $(INSTALL) -m 644
|
|
|
|
-include Makefile.dbg
|
|
|
|
# More warnings, discover problems that only happen on some archs
|
|
CFLAGS+=-Wextra
|
|
# Security enhancements from Debian
|
|
CFLAGS+=-Wformat -Werror=format-security -D_FORTIFY_SOURCE=2
|
|
|
|
DEFS= @DEFS@
|
|
|
|
.PHONY: all test clean
|
|
|
|
all: servald libmonitorclient.so libmonitorclient.a test
|
|
|
|
test: tfw_createfile directory_service fakeradio config_test simulator
|
|
|
|
Makefile: $(wildcard Makefile.in) $(wildcard configure)
|
|
$(warning Makefile may be out of date, please run ./configure)
|
|
|
|
configure: $(wildcard configure.in)
|
|
$(warning configure may be out of date, please run autoreconf -f -i)
|
|
|
|
objs/version.o: $(SERVALD_OBJS) version_string.sh $(wildcard VERSION.txt) COPYRIGHT.txt Makefile
|
|
@echo CC version_servald.c
|
|
@V=`./version_string.sh --ignore-untracked` \
|
|
&& 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\""
|
|
|
|
#' <-- fixes vim syntax highlighting
|
|
|
|
objs_servald/sqlite3.o: sqlite-amalgamation-3070900/sqlite3.c Makefile
|
|
@echo SERVALD CC $<
|
|
@mkdir -p $(dir $@)
|
|
@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
|
|
|
|
# No object files in source directory!
|
|
%.o: %.c
|
|
|
|
objs/%.o: %.c
|
|
@echo CC $<
|
|
@mkdir -p $(dir $@)
|
|
@$(RM) $(@:.o=.gcno) $(@:.o=.gcda)
|
|
@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
|
|
|
|
objs_servald/%.o: %.c
|
|
@echo SERVALD CC $<
|
|
@mkdir -p $(dir $@)
|
|
@$(RM) $(@:.o=.gcno) $(@:.o=.gcda)
|
|
@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
|
|
|
|
objs_lib/%.o: %.c
|
|
@echo LIB CC $<
|
|
@mkdir -p $(dir $@)
|
|
@$(RM) $(@:.o=.gcno) $(@:.o=.gcda)
|
|
@$(CC) $(CFLAGS) $(DEFS) -c $< -o $@
|
|
|
|
$(SERVAL_DAEMON_OBJS): $(HDRS)
|
|
$(SERVALD_OBJS): Makefile
|
|
$(LIB_SERVAL_OBJS): $(HDRS) Makefile
|
|
$(MONITOR_CLIENT_OBJS): $(HDRS) Makefile
|
|
$(SIMULATOR_OBJS): $(HDRS) Makefile
|
|
objs/directory_service.o objs/tfw_createfile.o objs/fakeradio.o \
|
|
objs/config_test.o objs/conf_om.o objs/conf_schema.o objs/conf_parse.o libserval.a \
|
|
: $(HDRS) Makefile
|
|
|
|
servald: $(SERVALD_OBJS) objs/version.o
|
|
@echo LINK $@
|
|
@$(CC) $(CFLAGS) -Wall -o $@ $(SERVALD_OBJS) objs/version.o $(LDFLAGS)
|
|
|
|
libserval.a: $(LIB_SERVAL_OBJS) objs/version.o
|
|
@echo AR $@
|
|
@$(AR) -cr $@ $(LIB_SERVAL_OBJS) objs/version.o
|
|
|
|
directory_service: objs/directory_service.o libserval.a
|
|
@echo LINK $@
|
|
@$(CC) $(CFLAGS) -Wall -o $@ objs/directory_service.o libserval.a $(LDFLAGS)
|
|
|
|
tfw_createfile: objs/tfw_createfile.o libserval.a
|
|
@echo LINK $@
|
|
@$(CC) $(CFLAGS) -Wall -o $@ objs/tfw_createfile.o libserval.a $(LDFLAGS)
|
|
|
|
fakeradio: objs/fakeradio.o libserval.a
|
|
@echo LINK $@
|
|
@$(CC) $(CFLAGS) -Wall -o $@ objs/fakeradio.o libserval.a $(LDFLAGS)
|
|
|
|
simulator: $(SIMULATOR_OBJS) libserval.a
|
|
@echo LINK $@
|
|
@$(CC) $(CFLAGS) -Wall -o $@ $(SIMULATOR_OBJS) libserval.a $(LDFLAGS)
|
|
|
|
config_test: objs/config_test.o objs/conf_om.o objs/conf_schema.o objs/conf_parse.o libserval.a
|
|
@echo LINK $@
|
|
@$(CC) $(CFLAGS) -Wall -o $@ objs/config_test.o objs/conf_om.o objs/conf_schema.o objs/conf_parse.o libserval.a $(LDFLAGS)
|
|
|
|
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
|
|
|
|
findPATH = $(firstword $(wildcard $(addsuffix /$(1),$(subst :, ,$(PATH)))))
|
|
COPYRIGHT_TOOL := $(call findPATH,sp-copyright-tool)
|
|
|
|
# This does not build on 64 bit elf platforms as NaCL isn't built with -fPIC
|
|
# DOC 20120615
|
|
libserval.so: $(SERVALD_OBJS) objs/version.o
|
|
@echo LINK $@
|
|
@$(CC) $(CFLAGS) -Wall -shared -o $@ $(SERVALD_OBJS) objs/version.o $(LDFLAGS)
|
|
|
|
libmonitorclient.so: $(MONITOR_CLIENT_OBJS) objs/version.o
|
|
@echo LINK $@
|
|
@$(CC) $(CFLAGS) -Wall -shared -o $@ $(MONITOR_CLIENT_OBJS) objs/version.o $(LDFLAGS)
|
|
|
|
libmonitorclient.a: $(MONITOR_CLIENT_OBJS) objs/version.o
|
|
@echo AR $@
|
|
@$(AR) -cr $@ $(MONITOR_CLIENT_OBJS) objs/version.o
|
|
|
|
install: servald
|
|
$(INSTALL_PROGRAM) -D servald $(DESTDIR)$(sbindir)/servald
|
|
|
|
uninstall:
|
|
$(RM) $(DESTDIR)$(sbindir)/servald
|
|
|
|
clean:
|
|
@$(RM) -r objs/* objs_servald/* objs_lib/* \
|
|
servald libservald.so \
|
|
libserval.a libmonitorclient.so libmonitorclient.a \
|
|
fakeradio \
|
|
tfw_createfile
|