From 2ca3df13380579b3630eb9a72b74606103698173 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 26 Oct 2015 21:29:33 +0330 Subject: [PATCH] - Add libpidutil as submodule for easier building - Fix build on FreeBSD --- .gitmodules | 3 +++ Makefile | 21 ++++++++++++++------- fsipd.c | 4 ++-- libpidutil | 1 + 4 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 .gitmodules create mode 160000 libpidutil diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7b62c60 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libpidutil"] + path = libpidutil + url = https://github.com/farrokhi/libpidutil.git diff --git a/Makefile b/Makefile index 395a7fc..fd504ab 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,27 @@ -PREFIX?=/usr/local -INC=-I$(PREFIX)/include -LIB=-L$(PREFIX)/lib -lpidutil -lpthread -CFLAGS=-Wall -Wextra -g -O2 -pipe -funroll-loops -ffast-math -fno-strict-aliasing CC?=cc +PREFIX?=/usr/local +INC=-I./libpidutil -I$(PREFIX)/include +LDFLAGS=-L./libpidutil -L$(PREFIX)/lib -lpidutil -lpthread +CFLAGS=-Wall -Wextra -g -O2 -static -pipe -funroll-loops -ffast-math -fno-strict-aliasing +SUBDIRS = libpidutil PROGS = fsipd logfile_test CFILES = fsipd.c logfile.c -all: fsipd +all: $(SUBDIRS) fsipd fsipd: $(CFILES) - $(CC) $(CFLAGS) $(INC) $(LIB) $(CFILES) -o fsipd + $(CC) $(CFLAGS) $(INC) $(CFILES) $(LDFLAGS) -o fsipd + +.PHONY: $(SUBDIRS) + +$(SUBDIRS): + $(MAKE) -C $@ all test: logfile.c logfile_test.c - $(CC) $(CFLAGS) $(INC) $(LIB) logfile.c logfile_test.c -o logfile_test + $(CC) $(CFLAGS) $(INC) $(LDFLAGS) logfile.c logfile_test.c -o logfile_test clean: rm -f *.BAK *.log *.o *.a a.out core temp.* $(PROGS) rm -fr *.dSYM + $(MAKE) -C libpidutil clean diff --git a/fsipd.c b/fsipd.c index 6f63c44..bffdc4a 100644 --- a/fsipd.c +++ b/fsipd.c @@ -182,7 +182,7 @@ process_request(int af, struct sockaddr *restrict src, int proto, char *str) /* * setup TCP listener socket */ -inline int +int init_tcp() { @@ -226,7 +226,7 @@ init_tcp() /* * setup UDP listener socket */ -inline int +int init_udp() { diff --git a/libpidutil b/libpidutil new file mode 160000 index 0000000..c700219 --- /dev/null +++ b/libpidutil @@ -0,0 +1 @@ +Subproject commit c7002193bce3904a5286cebca399fd9f35de0da7