Merge branch 'master' of ssh://git.karchnu.fr:2202/Karchnu/perfectos-junk
This commit is contained in:
commit
c064288ac4
288
Makefile
288
Makefile
@ -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 '[01;32m [LD] [01;37minit-connection[00m'
|
@echo '[01;32m [LD] [01;37mpingpong/pingpong[00m'
|
||||||
$(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 '[01;31m [IN] [01;37m$(BINDIR)/init-connection[00m'
|
@echo '[01;31m [IN] [01;37m$(BINDIR)/pingpong[00m'
|
||||||
$(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 '[01;37m [RM] [01;37minit-connection[00m'
|
@echo '[01;37m [RM] [01;37mpingpong/pingpong[00m'
|
||||||
$(Q)rm -f init-connection
|
$(Q)rm -f pingpong/pingpong
|
||||||
|
|
||||||
init-connection.uninstall:
|
pingpong/pingpong.uninstall:
|
||||||
@echo '[01;37m [RM] [01;37m$(BINDIR)/init-connection[00m'
|
@echo '[01;37m [RM] [01;37m$(BINDIR)/pingpong[00m'
|
||||||
$(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 '[01;32m [LD] [01;37mopen-read-close-fifo[00m'
|
@echo '[01;32m [LD] [01;37mpubsub/pubsub[00m'
|
||||||
$(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 '[01;31m [IN] [01;37m$(BINDIR)/open-read-close-fifo[00m'
|
@echo '[01;31m [IN] [01;37m$(BINDIR)/pubsub[00m'
|
||||||
$(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 '[01;37m [RM] [01;37mopen-read-close-fifo[00m'
|
@echo '[01;37m [RM] [01;37mpubsub/pubsub[00m'
|
||||||
$(Q)rm -f open-read-close-fifo
|
$(Q)rm -f pubsub/pubsub
|
||||||
|
|
||||||
open-read-close-fifo.uninstall:
|
pubsub/pubsub.uninstall:
|
||||||
@echo '[01;37m [RM] [01;37m$(BINDIR)/open-read-close-fifo[00m'
|
@echo '[01;37m [RM] [01;37m$(BINDIR)/pubsub[00m'
|
||||||
$(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 '[01;32m [LD] [01;37mopen-write-close-fifo[00m'
|
@echo '[01;32m [LD] [01;37mpubsub/pubsub-test-send[00m'
|
||||||
$(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 '[01;31m [IN] [01;37m$(BINDIR)/open-write-close-fifo[00m'
|
@echo '[01;31m [IN] [01;37m$(BINDIR)/pubsub-test-send[00m'
|
||||||
$(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 '[01;37m [RM] [01;37mopen-write-close-fifo[00m'
|
@echo '[01;37m [RM] [01;37mpubsub/pubsub-test-send[00m'
|
||||||
$(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 '[01;37m [RM] [01;37m$(BINDIR)/open-write-close-fifo[00m'
|
@echo '[01;37m [RM] [01;37m$(BINDIR)/pubsub-test-send[00m'
|
||||||
$(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 '[01;32m [LD] [01;37mservice-test[00m'
|
|
||||||
$(Q)$(CC) -o service-test $(LDFLAGS) service-test.o lib/communication.o libposj.a
|
|
||||||
|
|
||||||
service-test.install: service-test
|
|
||||||
@echo '[01;31m [IN] [01;37m$(BINDIR)/service-test[00m'
|
|
||||||
$(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 '[01;37m [RM] [01;37mservice-test[00m'
|
|
||||||
$(Q)rm -f service-test
|
|
||||||
|
|
||||||
service-test.uninstall:
|
|
||||||
@echo '[01;37m [RM] [01;37m$(BINDIR)/service-test[00m'
|
|
||||||
$(Q)rm -f '$(DESTDIR)$(BINDIR)/service-test'
|
|
||||||
|
|
||||||
pubsub/pubsubd: pubsub/list.o pubsub/pubsubd.o
|
|
||||||
@echo '[01;32m [LD] [01;37mpubsub/pubsubd[00m'
|
|
||||||
$(Q)$(CC) -o pubsub/pubsubd $(LDFLAGS) pubsub/list.o pubsub/pubsubd.o libposj.a
|
|
||||||
|
|
||||||
pubsub/pubsubd.install: pubsub/pubsubd
|
|
||||||
@echo '[01;31m [IN] [01;37m$(BINDIR)/pubsubd[00m'
|
|
||||||
$(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 '[01;37m [RM] [01;37mpubsub/pubsubd[00m'
|
|
||||||
$(Q)rm -f pubsub/pubsubd
|
|
||||||
|
|
||||||
pubsub/pubsubd.uninstall:
|
|
||||||
@echo '[01;37m [RM] [01;37m$(BINDIR)/pubsubd[00m'
|
|
||||||
$(Q)rm -f '$(DESTDIR)$(BINDIR)/pubsubd'
|
|
||||||
|
|
||||||
libposj.so: lib/communication.o
|
|
||||||
@echo '[01;32m [LD] [01;37mlibposj.so[00m'
|
@echo '[01;32m [LD] [01;37mlibposj.so[00m'
|
||||||
$(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 '[01;31m [IN] [01;37m$(LIBDIR)/libposj.so.0.0.1[00m'
|
@echo '[01;31m [IN] [01;37m$(LIBDIR)/libposj.so.0.0.1[00m'
|
||||||
@ -139,9 +105,9 @@ libposj.so.uninstall:
|
|||||||
@echo '[01;37m [RM] [01;37m$(LIBDIR)/libposj.so[00m'
|
@echo '[01;37m [RM] [01;37m$(LIBDIR)/libposj.so[00m'
|
||||||
$(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 '[01;32m [LD] [01;37mlibposj.a[00m'
|
@echo '[01;32m [LD] [01;37mlibposj.a[00m'
|
||||||
$(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 '[01;31m [IN] [01;37m$(LIBDIR)/libposj.a[00m'
|
@echo '[01;31m [IN] [01;37m$(LIBDIR)/libposj.a[00m'
|
||||||
@ -156,17 +122,41 @@ libposj.a.uninstall:
|
|||||||
@echo '[01;37m [RM] [01;37m$(LIBDIR)/libposj.a[00m'
|
@echo '[01;37m [RM] [01;37m$(LIBDIR)/libposj.a[00m'
|
||||||
$(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 '[01;34m [CC] [01;37minit-connection.o[00m'
|
@echo '[01;34m [CC] [01;37mpingpong/pingpong.o[00m'
|
||||||
$(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 '[01;37m [RM] [01;37minit-connection.o[00m'
|
@echo '[01;37m [RM] [01;37mpingpong/pingpong.o[00m'
|
||||||
$(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 '[01;34m [CC] [01;37mpubsub/pubsubd.o[00m'
|
||||||
|
$(Q)$(CC) $(CFLAGS) -c pubsub/pubsubd.c -o pubsub/pubsubd.o
|
||||||
|
|
||||||
|
pubsub/pubsubd.o.install:
|
||||||
|
|
||||||
|
pubsub/pubsubd.o.clean:
|
||||||
|
@echo '[01;37m [RM] [01;37mpubsub/pubsubd.o[00m'
|
||||||
|
$(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 '[01;34m [CC] [01;37mpubsub/pubsub-test-send.o[00m'
|
||||||
|
$(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 '[01;37m [RM] [01;37mpubsub/pubsub-test-send.o[00m'
|
||||||
|
$(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 '[01;34m [CC] [01;37mlib/communication.o[00m'
|
@echo '[01;34m [CC] [01;37mlib/communication.o[00m'
|
||||||
@ -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 '[01;34m [CC] [01;37mopen-read-close-fifo.o[00m'
|
@echo '[01;34m [CC] [01;37mlib/process.o[00m'
|
||||||
$(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 '[01;37m [RM] [01;37mopen-read-close-fifo.o[00m'
|
@echo '[01;37m [RM] [01;37mlib/process.o[00m'
|
||||||
$(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 '[01;34m [CC] [01;37mopen-write-close-fifo.o[00m'
|
@echo '[01;34m [CC] [01;37mlib/pubsubd.o[00m'
|
||||||
$(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 '[01;37m [RM] [01;37mopen-write-close-fifo.o[00m'
|
@echo '[01;37m [RM] [01;37mlib/pubsubd.o[00m'
|
||||||
$(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 '[01;34m [CC] [01;37mservice-test.o[00m'
|
|
||||||
$(Q)$(CC) $(CFLAGS) -c service-test.c -o service-test.o
|
|
||||||
|
|
||||||
service-test.o.install:
|
|
||||||
|
|
||||||
service-test.o.clean:
|
|
||||||
@echo '[01;37m [RM] [01;37mservice-test.o[00m'
|
|
||||||
$(Q)rm -f service-test.o
|
|
||||||
|
|
||||||
service-test.o.uninstall:
|
|
||||||
|
|
||||||
pubsub/list.o: pubsub/list.c pubsub/list.h
|
|
||||||
@echo '[01;34m [CC] [01;37mpubsub/list.o[00m'
|
|
||||||
$(Q)$(CC) $(CFLAGS) -I lib -c pubsub/list.c -I lib -o pubsub/list.o
|
|
||||||
|
|
||||||
pubsub/list.o.install:
|
|
||||||
|
|
||||||
pubsub/list.o.clean:
|
|
||||||
@echo '[01;37m [RM] [01;37mpubsub/list.o[00m'
|
|
||||||
$(Q)rm -f pubsub/list.o
|
|
||||||
|
|
||||||
pubsub/list.o.uninstall:
|
|
||||||
|
|
||||||
pubsub/pubsubd.o: pubsub/pubsubd.c
|
|
||||||
@echo '[01;34m [CC] [01;37mpubsub/pubsubd.o[00m'
|
|
||||||
$(Q)$(CC) $(CFLAGS) -I lib -c pubsub/pubsubd.c -I lib -o pubsub/pubsubd.o
|
|
||||||
|
|
||||||
pubsub/pubsubd.o.install:
|
|
||||||
|
|
||||||
pubsub/pubsubd.o.clean:
|
|
||||||
@echo '[01;37m [RM] [01;37mpubsub/pubsubd.o[00m'
|
|
||||||
$(Q)rm -f pubsub/pubsubd.o
|
|
||||||
|
|
||||||
pubsub/pubsubd.o.uninstall:
|
|
||||||
|
|
||||||
$(DESTDIR)$(PREFIX):
|
$(DESTDIR)$(PREFIX):
|
||||||
@echo '[01;35m [DIR] [01;37m$(PREFIX)[00m'
|
@echo '[01;35m [DIR] [01;37m$(PREFIX)[00m'
|
||||||
@ -255,12 +209,12 @@ $(DESTDIR)$(SHAREDIR):
|
|||||||
$(DESTDIR)$(INCLUDEDIR):
|
$(DESTDIR)$(INCLUDEDIR):
|
||||||
@echo '[01;35m [DIR] [01;37m$(INCLUDEDIR)[00m'
|
@echo '[01;35m [DIR] [01;37m$(INCLUDEDIR)[00m'
|
||||||
$(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 '[01;33m [TAR] [01;37m$(PACKAGE)-$(VERSION).tar.gz[00m'
|
@echo '[01;33m [TAR] [01;37m$(PACKAGE)-$(VERSION).tar.gz[00m'
|
||||||
$(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 '[01;33m [TAR] [01;37m$(PACKAGE)-$(VERSION).tar.xz[00m'
|
@echo '[01;33m [TAR] [01;37m$(PACKAGE)-$(VERSION).tar.xz[00m'
|
||||||
$(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 '[01;33m [TAR] [01;37m$(PACKAGE)-$(VERSION).tar.bz2[00m'
|
@echo '[01;33m [TAR] [01;37m$(PACKAGE)-$(VERSION).tar.bz2[00m'
|
||||||
$(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 '[01;37m :: perfect-os-junk-0.0.1[00m'
|
@echo '[01;37m :: perfect-os-junk-0.0.1[00m'
|
||||||
@ -350,11 +304,9 @@ help:
|
|||||||
@echo ''
|
@echo ''
|
||||||
@echo '[01;37mProject targets: [00m'
|
@echo '[01;37mProject targets: [00m'
|
||||||
@echo ' - [01;33mlibposj [37mlibrary[00m'
|
@echo ' - [01;33mlibposj [37mlibrary[00m'
|
||||||
@echo ' - [01;33minit-connection[37mbinary[00m'
|
@echo ' - [01;33mpingpong/pingpong[37mbinary[00m'
|
||||||
@echo ' - [01;33mopen-read-close-fifo[37mbinary[00m'
|
@echo ' - [01;33mpubsub/pubsub [37mbinary[00m'
|
||||||
@echo ' - [01;33mopen-write-close-fifo[37mbinary[00m'
|
@echo ' - [01;33mpubsub/pubsub-test-send[37mbinary[00m'
|
||||||
@echo ' - [01;33mservice-test [37mbinary[00m'
|
|
||||||
@echo ' - [01;33mpubsub/pubsubd[37mbinary[00m'
|
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo '[01;37mMakefile options:[00m'
|
@echo '[01;37mMakefile options:[00m'
|
||||||
@echo ' - gnu: true'
|
@echo ' - gnu: true'
|
||||||
|
@ -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 };
|
||||||
|
@ -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;
|
||||||
|
@ -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)
|
||||||
|
33
project.zsh
33
project.zsh
@ -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"
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
@ -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);
|
||||||
|
Reference in New Issue
Block a user