Archived
3
0

Merge branch 'master' of ssh://git.karchnu.fr:2202/Karchnu/perfectos-junk

This commit is contained in:
Philippe PITTOLI 2016-06-10 21:15:14 +02:00
commit c064288ac4
7 changed files with 157 additions and 198 deletions

288
Makefile
View File

@ -10,12 +10,12 @@ INCLUDEDIR := $(PREFIX)/include
CC := cc CC := cc
AR := ar AR := ar
RANLIB := ranlib RANLIB := ranlib
CFLAGS := -O2 -Wall -Wextra -Wshadow -ansi -pedantic -std=c99 CFLAGS := -O2 -Wall -Wextra -Wshadow -ansi -pedantic -std=c99 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199309L
LDFLAGS := LDFLAGS :=
Q := @ Q := @
all: libposj init-connection open-read-close-fifo open-write-close-fifo service-test pubsub/pubsubd all: libposj pingpong/pingpong pubsub/pubsub pubsub/pubsub-test-send
libposj: libposj.so libposj.a libposj: libposj.so libposj.a
@: @:
@ -25,94 +25,60 @@ libposj.clean: libposj.so.clean libposj.a.clean
libposj.uninstall: libposj.so.uninstall libposj.a.uninstall libposj.uninstall: libposj.so.uninstall libposj.a.uninstall
init-connection: init-connection.o lib/communication.o libposj.a pingpong/pingpong: pingpong/pingpong.o libposj.a
@echo ' [LD] init-connection' @echo ' [LD] pingpong/pingpong'
$(Q)$(CC) -o init-connection $(LDFLAGS) init-connection.o lib/communication.o libposj.a $(Q)$(CC) -o pingpong/pingpong $(LDFLAGS) pingpong/pingpong.o libposj.a -lpthread
init-connection.install: init-connection pingpong/pingpong.install: pingpong/pingpong
@echo ' [IN] $(BINDIR)/init-connection' @echo ' [IN] $(BINDIR)/pingpong'
$(Q)mkdir -p '$(DESTDIR)$(BINDIR)' $(Q)mkdir -p '$(DESTDIR)$(BINDIR)'
$(Q)install -m0755 init-connection $(DESTDIR)$(BINDIR)/init-connection $(Q)install -m0755 pingpong/pingpong $(DESTDIR)$(BINDIR)/pingpong
init-connection.clean: init-connection.o.clean lib/communication.o.clean pingpong/pingpong.clean: pingpong/pingpong.o.clean
@echo ' [RM] init-connection' @echo ' [RM] pingpong/pingpong'
$(Q)rm -f init-connection $(Q)rm -f pingpong/pingpong
init-connection.uninstall: pingpong/pingpong.uninstall:
@echo ' [RM] $(BINDIR)/init-connection' @echo ' [RM] $(BINDIR)/pingpong'
$(Q)rm -f '$(DESTDIR)$(BINDIR)/init-connection' $(Q)rm -f '$(DESTDIR)$(BINDIR)/pingpong'
open-read-close-fifo: open-read-close-fifo.o lib/communication.o libposj.a pubsub/pubsub: pubsub/pubsubd.o libposj.a
@echo ' [LD] open-read-close-fifo' @echo ' [LD] pubsub/pubsub'
$(Q)$(CC) -o open-read-close-fifo $(LDFLAGS) open-read-close-fifo.o lib/communication.o libposj.a $(Q)$(CC) -o pubsub/pubsub $(LDFLAGS) pubsub/pubsubd.o libposj.a -lpthread
open-read-close-fifo.install: open-read-close-fifo pubsub/pubsub.install: pubsub/pubsub
@echo ' [IN] $(BINDIR)/open-read-close-fifo' @echo ' [IN] $(BINDIR)/pubsub'
$(Q)mkdir -p '$(DESTDIR)$(BINDIR)' $(Q)mkdir -p '$(DESTDIR)$(BINDIR)'
$(Q)install -m0755 open-read-close-fifo $(DESTDIR)$(BINDIR)/open-read-close-fifo $(Q)install -m0755 pubsub/pubsub $(DESTDIR)$(BINDIR)/pubsub
open-read-close-fifo.clean: open-read-close-fifo.o.clean lib/communication.o.clean pubsub/pubsub.clean: pubsub/pubsubd.o.clean
@echo ' [RM] open-read-close-fifo' @echo ' [RM] pubsub/pubsub'
$(Q)rm -f open-read-close-fifo $(Q)rm -f pubsub/pubsub
open-read-close-fifo.uninstall: pubsub/pubsub.uninstall:
@echo ' [RM] $(BINDIR)/open-read-close-fifo' @echo ' [RM] $(BINDIR)/pubsub'
$(Q)rm -f '$(DESTDIR)$(BINDIR)/open-read-close-fifo' $(Q)rm -f '$(DESTDIR)$(BINDIR)/pubsub'
open-write-close-fifo: open-write-close-fifo.o lib/communication.o libposj.a pubsub/pubsub-test-send: pubsub/pubsub-test-send.o libposj.a
@echo ' [LD] open-write-close-fifo' @echo ' [LD] pubsub/pubsub-test-send'
$(Q)$(CC) -o open-write-close-fifo $(LDFLAGS) open-write-close-fifo.o lib/communication.o libposj.a $(Q)$(CC) -o pubsub/pubsub-test-send $(LDFLAGS) pubsub/pubsub-test-send.o libposj.a -lpthread
open-write-close-fifo.install: open-write-close-fifo pubsub/pubsub-test-send.install: pubsub/pubsub-test-send
@echo ' [IN] $(BINDIR)/open-write-close-fifo' @echo ' [IN] $(BINDIR)/pubsub-test-send'
$(Q)mkdir -p '$(DESTDIR)$(BINDIR)' $(Q)mkdir -p '$(DESTDIR)$(BINDIR)'
$(Q)install -m0755 open-write-close-fifo $(DESTDIR)$(BINDIR)/open-write-close-fifo $(Q)install -m0755 pubsub/pubsub-test-send $(DESTDIR)$(BINDIR)/pubsub-test-send
open-write-close-fifo.clean: open-write-close-fifo.o.clean lib/communication.o.clean pubsub/pubsub-test-send.clean: pubsub/pubsub-test-send.o.clean
@echo ' [RM] open-write-close-fifo' @echo ' [RM] pubsub/pubsub-test-send'
$(Q)rm -f open-write-close-fifo $(Q)rm -f pubsub/pubsub-test-send
open-write-close-fifo.uninstall: pubsub/pubsub-test-send.uninstall:
@echo ' [RM] $(BINDIR)/open-write-close-fifo' @echo ' [RM] $(BINDIR)/pubsub-test-send'
$(Q)rm -f '$(DESTDIR)$(BINDIR)/open-write-close-fifo' $(Q)rm -f '$(DESTDIR)$(BINDIR)/pubsub-test-send'
service-test: service-test.o lib/communication.o libposj.a libposj.so: lib/communication.o lib/process.o lib/pubsubd.o
@echo ' [LD] service-test'
$(Q)$(CC) -o service-test $(LDFLAGS) service-test.o lib/communication.o libposj.a
service-test.install: service-test
@echo ' [IN] $(BINDIR)/service-test'
$(Q)mkdir -p '$(DESTDIR)$(BINDIR)'
$(Q)install -m0755 service-test $(DESTDIR)$(BINDIR)/service-test
service-test.clean: service-test.o.clean lib/communication.o.clean
@echo ' [RM] service-test'
$(Q)rm -f service-test
service-test.uninstall:
@echo ' [RM] $(BINDIR)/service-test'
$(Q)rm -f '$(DESTDIR)$(BINDIR)/service-test'
pubsub/pubsubd: pubsub/list.o pubsub/pubsubd.o
@echo ' [LD] pubsub/pubsubd'
$(Q)$(CC) -o pubsub/pubsubd $(LDFLAGS) pubsub/list.o pubsub/pubsubd.o libposj.a
pubsub/pubsubd.install: pubsub/pubsubd
@echo ' [IN] $(BINDIR)/pubsubd'
$(Q)mkdir -p '$(DESTDIR)$(BINDIR)'
$(Q)install -m0755 pubsub/pubsubd $(DESTDIR)$(BINDIR)/pubsubd
pubsub/pubsubd.clean: pubsub/list.o.clean pubsub/pubsubd.o.clean
@echo ' [RM] pubsub/pubsubd'
$(Q)rm -f pubsub/pubsubd
pubsub/pubsubd.uninstall:
@echo ' [RM] $(BINDIR)/pubsubd'
$(Q)rm -f '$(DESTDIR)$(BINDIR)/pubsubd'
libposj.so: lib/communication.o
@echo ' [LD] libposj.so' @echo ' [LD] libposj.so'
$(Q)$(CC) -o libposj.so -shared $(LDFLAGS) lib/communication.o $(Q)$(CC) -o libposj.so -shared $(LDFLAGS) lib/communication.o lib/process.o lib/pubsubd.o
libposj.so.install: libposj.so libposj.so.install: libposj.so
@echo ' [IN] $(LIBDIR)/libposj.so.0.0.1' @echo ' [IN] $(LIBDIR)/libposj.so.0.0.1'
@ -139,9 +105,9 @@ libposj.so.uninstall:
@echo ' [RM] $(LIBDIR)/libposj.so' @echo ' [RM] $(LIBDIR)/libposj.so'
$(Q)rm -f '$(DESTDIR)$(LIBDIR)/libposj.so' $(Q)rm -f '$(DESTDIR)$(LIBDIR)/libposj.so'
libposj.a: lib/communication.o libposj.a: lib/communication.o lib/process.o lib/pubsubd.o
@echo ' [LD] libposj.a' @echo ' [LD] libposj.a'
$(Q)$(AR) rc 'libposj.a' lib/communication.o $(Q)$(AR) rc 'libposj.a' lib/communication.o lib/process.o lib/pubsubd.o
libposj.a.install: libposj.a libposj.a.install: libposj.a
@echo ' [IN] $(LIBDIR)/libposj.a' @echo ' [IN] $(LIBDIR)/libposj.a'
@ -156,17 +122,41 @@ libposj.a.uninstall:
@echo ' [RM] $(LIBDIR)/libposj.a' @echo ' [RM] $(LIBDIR)/libposj.a'
$(Q)rm -f '$(DESTDIR)$(LIBDIR)/libposj.a' $(Q)rm -f '$(DESTDIR)$(LIBDIR)/libposj.a'
init-connection.o: init-connection.c ./lib/communication.h pingpong/pingpong.o: pingpong/pingpong.c pingpong/../lib/communication.h
@echo ' [CC] init-connection.o' @echo ' [CC] pingpong/pingpong.o'
$(Q)$(CC) $(CFLAGS) -c init-connection.c -o init-connection.o $(Q)$(CC) $(CFLAGS) -c pingpong/pingpong.c -o pingpong/pingpong.o
init-connection.o.install: pingpong/pingpong.o.install:
init-connection.o.clean: pingpong/pingpong.o.clean:
@echo ' [RM] init-connection.o' @echo ' [RM] pingpong/pingpong.o'
$(Q)rm -f init-connection.o $(Q)rm -f pingpong/pingpong.o
init-connection.o.uninstall: pingpong/pingpong.o.uninstall:
pubsub/pubsubd.o: pubsub/pubsubd.c pubsub/../lib/pubsubd.h
@echo ' [CC] pubsub/pubsubd.o'
$(Q)$(CC) $(CFLAGS) -c pubsub/pubsubd.c -o pubsub/pubsubd.o
pubsub/pubsubd.o.install:
pubsub/pubsubd.o.clean:
@echo ' [RM] pubsub/pubsubd.o'
$(Q)rm -f pubsub/pubsubd.o
pubsub/pubsubd.o.uninstall:
pubsub/pubsub-test-send.o: pubsub/pubsub-test-send.c pubsub/../lib/pubsubd.h
@echo ' [CC] pubsub/pubsub-test-send.o'
$(Q)$(CC) $(CFLAGS) -c pubsub/pubsub-test-send.c -o pubsub/pubsub-test-send.o
pubsub/pubsub-test-send.o.install:
pubsub/pubsub-test-send.o.clean:
@echo ' [RM] pubsub/pubsub-test-send.o'
$(Q)rm -f pubsub/pubsub-test-send.o
pubsub/pubsub-test-send.o.uninstall:
lib/communication.o: lib/communication.c lib/communication.h lib/communication.o: lib/communication.c lib/communication.h
@echo ' [CC] lib/communication.o' @echo ' [CC] lib/communication.o'
@ -180,65 +170,29 @@ lib/communication.o.clean:
lib/communication.o.uninstall: lib/communication.o.uninstall:
open-read-close-fifo.o: open-read-close-fifo.c lib/process.o: lib/process.c lib/process.h
@echo ' [CC] open-read-close-fifo.o' @echo ' [CC] lib/process.o'
$(Q)$(CC) $(CFLAGS) -c open-read-close-fifo.c -o open-read-close-fifo.o $(Q)$(CC) $(CFLAGS) -fPIC -c lib/process.c -fPIC -o lib/process.o
open-read-close-fifo.o.install: lib/process.o.install:
open-read-close-fifo.o.clean: lib/process.o.clean:
@echo ' [RM] open-read-close-fifo.o' @echo ' [RM] lib/process.o'
$(Q)rm -f open-read-close-fifo.o $(Q)rm -f lib/process.o
open-read-close-fifo.o.uninstall: lib/process.o.uninstall:
open-write-close-fifo.o: open-write-close-fifo.c lib/pubsubd.o: lib/pubsubd.c lib/pubsubd.h
@echo ' [CC] open-write-close-fifo.o' @echo ' [CC] lib/pubsubd.o'
$(Q)$(CC) $(CFLAGS) -c open-write-close-fifo.c -o open-write-close-fifo.o $(Q)$(CC) $(CFLAGS) -fPIC -c lib/pubsubd.c -fPIC -o lib/pubsubd.o
open-write-close-fifo.o.install: lib/pubsubd.o.install:
open-write-close-fifo.o.clean: lib/pubsubd.o.clean:
@echo ' [RM] open-write-close-fifo.o' @echo ' [RM] lib/pubsubd.o'
$(Q)rm -f open-write-close-fifo.o $(Q)rm -f lib/pubsubd.o
open-write-close-fifo.o.uninstall: lib/pubsubd.o.uninstall:
service-test.o: service-test.c ./lib/communication.h
@echo ' [CC] service-test.o'
$(Q)$(CC) $(CFLAGS) -c service-test.c -o service-test.o
service-test.o.install:
service-test.o.clean:
@echo ' [RM] service-test.o'
$(Q)rm -f service-test.o
service-test.o.uninstall:
pubsub/list.o: pubsub/list.c pubsub/list.h
@echo ' [CC] pubsub/list.o'
$(Q)$(CC) $(CFLAGS) -I lib -c pubsub/list.c -I lib -o pubsub/list.o
pubsub/list.o.install:
pubsub/list.o.clean:
@echo ' [RM] pubsub/list.o'
$(Q)rm -f pubsub/list.o
pubsub/list.o.uninstall:
pubsub/pubsubd.o: pubsub/pubsubd.c
@echo ' [CC] pubsub/pubsubd.o'
$(Q)$(CC) $(CFLAGS) -I lib -c pubsub/pubsubd.c -I lib -o pubsub/pubsubd.o
pubsub/pubsubd.o.install:
pubsub/pubsubd.o.clean:
@echo ' [RM] pubsub/pubsubd.o'
$(Q)rm -f pubsub/pubsubd.o
pubsub/pubsubd.o.uninstall:
$(DESTDIR)$(PREFIX): $(DESTDIR)$(PREFIX):
@echo ' [DIR] $(PREFIX)' @echo ' [DIR] $(PREFIX)'
@ -255,12 +209,12 @@ $(DESTDIR)$(SHAREDIR):
$(DESTDIR)$(INCLUDEDIR): $(DESTDIR)$(INCLUDEDIR):
@echo ' [DIR] $(INCLUDEDIR)' @echo ' [DIR] $(INCLUDEDIR)'
$(Q)mkdir -p $(DESTDIR)$(INCLUDEDIR) $(Q)mkdir -p $(DESTDIR)$(INCLUDEDIR)
install: subdirs.install libposj.install init-connection.install open-read-close-fifo.install open-write-close-fifo.install service-test.install pubsub/pubsubd.install libposj.so.install libposj.a.install init-connection.o.install lib/communication.o.install open-read-close-fifo.o.install lib/communication.o.install open-write-close-fifo.o.install lib/communication.o.install service-test.o.install lib/communication.o.install pubsub/list.o.install pubsub/pubsubd.o.install lib/communication.o.install lib/communication.o.install install: subdirs.install libposj.install pingpong/pingpong.install pubsub/pubsub.install pubsub/pubsub-test-send.install libposj.so.install libposj.a.install pingpong/pingpong.o.install pubsub/pubsubd.o.install pubsub/pubsub-test-send.o.install lib/communication.o.install lib/process.o.install lib/pubsubd.o.install lib/communication.o.install lib/process.o.install lib/pubsubd.o.install
@: @:
subdirs.install: subdirs.install:
uninstall: subdirs.uninstall libposj.uninstall init-connection.uninstall open-read-close-fifo.uninstall open-write-close-fifo.uninstall service-test.uninstall pubsub/pubsubd.uninstall libposj.so.uninstall libposj.a.uninstall init-connection.o.uninstall lib/communication.o.uninstall open-read-close-fifo.o.uninstall lib/communication.o.uninstall open-write-close-fifo.o.uninstall lib/communication.o.uninstall service-test.o.uninstall lib/communication.o.uninstall pubsub/list.o.uninstall pubsub/pubsubd.o.uninstall lib/communication.o.uninstall lib/communication.o.uninstall uninstall: subdirs.uninstall libposj.uninstall pingpong/pingpong.uninstall pubsub/pubsub.uninstall pubsub/pubsub-test-send.uninstall libposj.so.uninstall libposj.a.uninstall pingpong/pingpong.o.uninstall pubsub/pubsubd.o.uninstall pubsub/pubsub-test-send.o.uninstall lib/communication.o.uninstall lib/process.o.uninstall lib/pubsubd.o.uninstall lib/communication.o.uninstall lib/process.o.uninstall lib/pubsubd.o.uninstall
@: @:
subdirs.uninstall: subdirs.uninstall:
@ -270,7 +224,7 @@ test: all subdirs subdirs.test
subdirs.test: subdirs.test:
clean: libposj.clean init-connection.clean open-read-close-fifo.clean open-write-close-fifo.clean service-test.clean pubsub/pubsubd.clean libposj.so.clean libposj.a.clean init-connection.o.clean lib/communication.o.clean open-read-close-fifo.o.clean lib/communication.o.clean open-write-close-fifo.o.clean lib/communication.o.clean service-test.o.clean lib/communication.o.clean pubsub/list.o.clean pubsub/pubsubd.o.clean lib/communication.o.clean lib/communication.o.clean clean: libposj.clean pingpong/pingpong.clean pubsub/pubsub.clean pubsub/pubsub-test-send.clean libposj.so.clean libposj.a.clean pingpong/pingpong.o.clean pubsub/pubsubd.o.clean pubsub/pubsub-test-send.o.clean lib/communication.o.clean lib/process.o.clean lib/pubsubd.o.clean lib/communication.o.clean lib/process.o.clean lib/pubsubd.o.clean
distclean: clean distclean: clean
@ -285,46 +239,46 @@ dist-gz: $(PACKAGE)-$(VERSION).tar.gz
$(PACKAGE)-$(VERSION).tar.gz: distdir $(PACKAGE)-$(VERSION).tar.gz: distdir
@echo ' [TAR] $(PACKAGE)-$(VERSION).tar.gz' @echo ' [TAR] $(PACKAGE)-$(VERSION).tar.gz'
$(Q)tar czf $(PACKAGE)-$(VERSION).tar.gz \ $(Q)tar czf $(PACKAGE)-$(VERSION).tar.gz \
$(PACKAGE)-$(VERSION)/init-connection.c \
$(PACKAGE)-$(VERSION)/pubsub/list.c \
$(PACKAGE)-$(VERSION)/pubsub/pubsubd.c \
$(PACKAGE)-$(VERSION)/service-test.c \
$(PACKAGE)-$(VERSION)/open-write-close-fifo.c \
$(PACKAGE)-$(VERSION)/open-read-close-fifo.c \
$(PACKAGE)-$(VERSION)/lib/communication.c \ $(PACKAGE)-$(VERSION)/lib/communication.c \
$(PACKAGE)-$(VERSION)/lib/process.c \
$(PACKAGE)-$(VERSION)/lib/pubsubd.c \
$(PACKAGE)-$(VERSION)/pingpong/pingpong.c \
$(PACKAGE)-$(VERSION)/pubsub/pubsub-test-send.c \
$(PACKAGE)-$(VERSION)/pubsub/pubsubd.c \
$(PACKAGE)-$(VERSION)/libposj.a \ $(PACKAGE)-$(VERSION)/libposj.a \
$(PACKAGE)-$(VERSION)/pubsub/list.h \ $(PACKAGE)-$(VERSION)/lib/communication.h \
$(PACKAGE)-$(VERSION)/lib/communication.h $(PACKAGE)-$(VERSION)/lib/process.h \
$(PACKAGE)-$(VERSION)/lib/pubsubd.h
dist-xz: $(PACKAGE)-$(VERSION).tar.xz dist-xz: $(PACKAGE)-$(VERSION).tar.xz
$(PACKAGE)-$(VERSION).tar.xz: distdir $(PACKAGE)-$(VERSION).tar.xz: distdir
@echo ' [TAR] $(PACKAGE)-$(VERSION).tar.xz' @echo ' [TAR] $(PACKAGE)-$(VERSION).tar.xz'
$(Q)tar cJf $(PACKAGE)-$(VERSION).tar.xz \ $(Q)tar cJf $(PACKAGE)-$(VERSION).tar.xz \
$(PACKAGE)-$(VERSION)/init-connection.c \
$(PACKAGE)-$(VERSION)/pubsub/list.c \
$(PACKAGE)-$(VERSION)/pubsub/pubsubd.c \
$(PACKAGE)-$(VERSION)/service-test.c \
$(PACKAGE)-$(VERSION)/open-write-close-fifo.c \
$(PACKAGE)-$(VERSION)/open-read-close-fifo.c \
$(PACKAGE)-$(VERSION)/lib/communication.c \ $(PACKAGE)-$(VERSION)/lib/communication.c \
$(PACKAGE)-$(VERSION)/lib/process.c \
$(PACKAGE)-$(VERSION)/lib/pubsubd.c \
$(PACKAGE)-$(VERSION)/pingpong/pingpong.c \
$(PACKAGE)-$(VERSION)/pubsub/pubsub-test-send.c \
$(PACKAGE)-$(VERSION)/pubsub/pubsubd.c \
$(PACKAGE)-$(VERSION)/libposj.a \ $(PACKAGE)-$(VERSION)/libposj.a \
$(PACKAGE)-$(VERSION)/pubsub/list.h \ $(PACKAGE)-$(VERSION)/lib/communication.h \
$(PACKAGE)-$(VERSION)/lib/communication.h $(PACKAGE)-$(VERSION)/lib/process.h \
$(PACKAGE)-$(VERSION)/lib/pubsubd.h
dist-bz2: $(PACKAGE)-$(VERSION).tar.bz2 dist-bz2: $(PACKAGE)-$(VERSION).tar.bz2
$(PACKAGE)-$(VERSION).tar.bz2: distdir $(PACKAGE)-$(VERSION).tar.bz2: distdir
@echo ' [TAR] $(PACKAGE)-$(VERSION).tar.bz2' @echo ' [TAR] $(PACKAGE)-$(VERSION).tar.bz2'
$(Q)tar cjf $(PACKAGE)-$(VERSION).tar.bz2 \ $(Q)tar cjf $(PACKAGE)-$(VERSION).tar.bz2 \
$(PACKAGE)-$(VERSION)/init-connection.c \
$(PACKAGE)-$(VERSION)/pubsub/list.c \
$(PACKAGE)-$(VERSION)/pubsub/pubsubd.c \
$(PACKAGE)-$(VERSION)/service-test.c \
$(PACKAGE)-$(VERSION)/open-write-close-fifo.c \
$(PACKAGE)-$(VERSION)/open-read-close-fifo.c \
$(PACKAGE)-$(VERSION)/lib/communication.c \ $(PACKAGE)-$(VERSION)/lib/communication.c \
$(PACKAGE)-$(VERSION)/lib/process.c \
$(PACKAGE)-$(VERSION)/lib/pubsubd.c \
$(PACKAGE)-$(VERSION)/pingpong/pingpong.c \
$(PACKAGE)-$(VERSION)/pubsub/pubsub-test-send.c \
$(PACKAGE)-$(VERSION)/pubsub/pubsubd.c \
$(PACKAGE)-$(VERSION)/libposj.a \ $(PACKAGE)-$(VERSION)/libposj.a \
$(PACKAGE)-$(VERSION)/pubsub/list.h \ $(PACKAGE)-$(VERSION)/lib/communication.h \
$(PACKAGE)-$(VERSION)/lib/communication.h $(PACKAGE)-$(VERSION)/lib/process.h \
$(PACKAGE)-$(VERSION)/lib/pubsubd.h
help: help:
@echo ' :: perfect-os-junk-0.0.1' @echo ' :: perfect-os-junk-0.0.1'
@ -350,11 +304,9 @@ help:
@echo '' @echo ''
@echo 'Project targets: ' @echo 'Project targets: '
@echo ' - libposj library' @echo ' - libposj library'
@echo ' - init-connectionbinary' @echo ' - pingpong/pingpongbinary'
@echo ' - open-read-close-fifobinary' @echo ' - pubsub/pubsub binary'
@echo ' - open-write-close-fifobinary' @echo ' - pubsub/pubsub-test-sendbinary'
@echo ' - service-test binary'
@echo ' - pubsub/pubsubdbinary'
@echo '' @echo ''
@echo 'Makefile options:' @echo 'Makefile options:'
@echo ' - gnu: true' @echo ' - gnu: true'

View File

@ -6,7 +6,7 @@ int file_open (FILE **f, const char *path, const char *mode)
{ {
printf ("opening %s\n", path); printf ("opening %s\n", path);
if (*f != NULL) { if (*f != NULL) {
printf ("f != NULL : %p\n", *f); printf ("f != NULL : %p\n", (void*) *f);
fclose (*f); fclose (*f);
} }
*f = fopen (path, mode); *f = fopen (path, mode);
@ -35,7 +35,7 @@ void srv_init (struct service *srv, const char *sname)
return; return;
// gets the service path, such as /tmp/<service> // gets the service path, such as /tmp/<service>
bzero (srv->spath, PATH_MAX); memset (srv->spath, 0, PATH_MAX);
strncat (srv->spath, TMPDIR, PATH_MAX); strncat (srv->spath, TMPDIR, PATH_MAX);
strncat (srv->spath, sname, PATH_MAX); strncat (srv->spath, sname, PATH_MAX);
@ -93,7 +93,7 @@ int srv_close (struct service *srv)
int srv_get_listen_raw (const struct service *srv, char **buf, size_t *msize) int srv_get_listen_raw (const struct service *srv, char **buf, size_t *msize)
{ {
*buf = malloc(BUFSIZ); *buf = malloc(BUFSIZ);
bzero (*buf, BUFSIZ); memset (*buf, 0, BUFSIZ);
FILE * f = fopen (srv->spath, "r"); FILE * f = fopen (srv->spath, "r");
fgets (*buf, BUFSIZ, f); fgets (*buf, BUFSIZ, f);
@ -111,7 +111,7 @@ int srv_get_new_process (const struct service *srv, struct process *p)
} }
char buf[BUFSIZ]; char buf[BUFSIZ];
bzero (buf, BUFSIZ); memset (buf, 0, BUFSIZ);
// read the pipe, get a process to work on // read the pipe, get a process to work on
struct timespec ts = { 0 }; struct timespec ts = { 0 };

View File

@ -24,8 +24,8 @@ void srv_process_gen (struct process *p
p->version = version; p->version = version;
p->index = index; p->index = index;
bzero (p->path_in, PATH_MAX); memset (p->path_in, 0, PATH_MAX);
bzero (p->path_out, PATH_MAX); memset (p->path_out, 0, PATH_MAX);
snprintf(p->path_in , PATH_MAX, "%s/%d-%d-in" , TMPDIR, pid, index); snprintf(p->path_in , PATH_MAX, "%s/%d-%d-in" , TMPDIR, pid, index);
snprintf(p->path_out, PATH_MAX, "%s/%d-%d-out", TMPDIR, pid, index); snprintf(p->path_out, PATH_MAX, "%s/%d-%d-out", TMPDIR, pid, index);
p->in = NULL; p->in = NULL;

View File

@ -52,7 +52,7 @@ struct channel * pubsubd_channel_copy (struct channel *c)
struct channel *copy = NULL; struct channel *copy = NULL;
copy = malloc (sizeof(struct channel)); copy = malloc (sizeof(struct channel));
bzero (copy, sizeof (struct channel)); memset (copy, 0, sizeof (struct channel));
memcpy (copy, c, sizeof(struct channel)); memcpy (copy, c, sizeof(struct channel));
@ -334,7 +334,7 @@ int pubsubd_get_new_process (struct service *srv, struct app_list_elm *ale
int version = 0; int version = 0;
char chan[BUFSIZ]; char chan[BUFSIZ];
bzero (chan, BUFSIZ); memset (chan, 0, BUFSIZ);
for (str = buf, i = 1; ; str = NULL, i++) { for (str = buf, i = 1; ; str = NULL, i++) {
token = strtok_r(str, " ", &saveptr); token = strtok_r(str, " ", &saveptr);
@ -542,7 +542,7 @@ void pubsub_connection (struct service *srv, struct process *p, enum app_list_el
straction = pubsub_action_to_str (action); straction = pubsub_action_to_str (action);
char line[BUFSIZ]; char line[BUFSIZ];
bzero (line, BUFSIZ); memset (line, 0, BUFSIZ);
// line fmt : pid index version action chan // line fmt : pid index version action chan
// "quit" action is also possible (see pubsub_disconnect) // "quit" action is also possible (see pubsub_disconnect)

View File

@ -2,23 +2,30 @@
package=perfect-os-junk package=perfect-os-junk
version=0.0.1 version=0.0.1
CFLAGS="-O2 -Wall -Wextra -Wshadow -ansi -pedantic -std=c99" CFLAGS="-O2 -Wall -Wextra -Wshadow -ansi -pedantic -std=c99 -D_XOPEN_SOURCE=500 -D_POSIX_C_SOURCE=199309L"
targets=(libposj) targets=(libposj)
type[libposj]=library type[libposj]=library
sources[libposj]="$(echo lib/*.c)" sources[libposj]="$(echo lib/*.c)"
for i in *.c; do target="pingpong/pingpong"
targets+=(${i%.c}) targets+=(${target})
sources[${i%.c}]="$i $(echo lib/*.c)" sources[${target}]="$(echo pingpong/*.c)"
type[${i%.c}]=binary type[${target}]=binary
depends[${i%.c}]="libposj.a" depends[${target}]="libposj.a"
ldflags[${i%.c}]="libposj.a" ldflags[${target}]="libposj.a -lpthread"
done
targets+=(pubsub/pubsubd) target="pubsub/pubsub"
type[pubsub/pubsubd]=binary targets+=(${target})
sources[pubsub/pubsubd]="pubsub/list.c pubsub/pubsubd.c" sources[${target}]="$(ls pubsub/*.c | grep -v test-send)"
cflags[pubsub/pubsubd]="-I lib" type[${target}]=binary
ldflags[pubsub/pubsubd]="libposj.a" depends[${target}]="libposj.a"
ldflags[${target}]="libposj.a -lpthread"
target="pubsub/pubsub-test-send"
targets+=(${target})
sources[${target}]="pubsub/pubsub-test-send.c"
type[${target}]=binary
depends[${target}]="libposj.a"
ldflags[${target}]="libposj.a -lpthread"

View File

@ -15,12 +15,12 @@ ohshit(int rvalue, const char* str) {
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
struct service srv; struct service srv;
bzero (&srv, sizeof (struct service)); memset (&srv, 0, sizeof (struct service));
srv_init (&srv, PUBSUB_SERVICE_NAME); srv_init (&srv, PUBSUB_SERVICE_NAME);
printf ("Writing on %s.\n", srv.spath); printf ("Writing on %s.\n", srv.spath);
struct process p; struct process p;
bzero (&p, sizeof (struct process)); memset (&p, 0, sizeof (struct process));
int index = 1; int index = 1;
if (app_create (&p, index)) // called by the application if (app_create (&p, index)) // called by the application
@ -31,7 +31,7 @@ main(int argc, char* argv[])
pubsub_connection (&srv, &p, PUBSUB_PUB, MYCHAN); pubsub_connection (&srv, &p, PUBSUB_PUB, MYCHAN);
struct pubsub_msg m; struct pubsub_msg m;
bzero (&m, sizeof (struct pubsub_msg)); memset (&m, 0, sizeof (struct pubsub_msg));
// first message, "coucou" // first message, "coucou"
m.type = PUBSUB_TYPE_INFO; m.type = PUBSUB_TYPE_INFO;

View File

@ -27,7 +27,7 @@ void * pubsubd_worker_thread (void *params)
printf ("publish or publish and subscribe to something\n"); printf ("publish or publish and subscribe to something\n");
struct pubsub_msg m; struct pubsub_msg m;
bzero (&m, sizeof (struct pubsub_msg)); memset (&m, 0, sizeof (struct pubsub_msg));
pubsubd_msg_recv (wp->ale->p, &m); pubsubd_msg_recv (wp->ale->p, &m);
pubsubd_msg_print (&m); pubsubd_msg_print (&m);
@ -46,7 +46,7 @@ void * pubsubd_worker_thread (void *params)
} }
else { else {
printf ("\033[31mdo not know what you want to do\033[00m\n"); printf ("\033[31mdo not know what you want to do\033[00m\n");
printf ("\tale->p : %p\n", wp->ale->p); printf ("\tale->p : %p\n", (void*) wp->ale->p);
} }
pubsubd_app_list_elm_free (wp->ale); pubsubd_app_list_elm_free (wp->ale);
@ -58,7 +58,7 @@ void * pubsubd_worker_thread (void *params)
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
struct service srv; struct service srv;
bzero (&srv, sizeof (struct service)); memset (&srv, 0, sizeof (struct service));
srv_init (&srv, PUBSUB_SERVICE_NAME); srv_init (&srv, PUBSUB_SERVICE_NAME);
printf ("Listening on %s.\n", srv.spath); printf ("Listening on %s.\n", srv.spath);
@ -68,13 +68,13 @@ main(int argc, char* argv[])
// init chans list // init chans list
struct channels chans; struct channels chans;
bzero (&chans, sizeof (struct channels)); memset (&chans, 0, sizeof (struct channels));
pubsubd_channels_init (&chans); pubsubd_channels_init (&chans);
for (;;) { for (;;) {
// for each new process // for each new process
struct app_list_elm ale; struct app_list_elm ale;
bzero (&ale, sizeof (struct app_list_elm)); memset (&ale, 0, sizeof (struct app_list_elm));
struct channel *chan = NULL; struct channel *chan = NULL;
pubsubd_get_new_process (&srv, &ale, &chans, &chan); pubsubd_get_new_process (&srv, &ale, &chans, &chan);
pubsubd_channels_print (&chans); pubsubd_channels_print (&chans);