From e4cea62828f00b438568fbd2b3637394f148ced4 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Fri, 27 Nov 2009 21:42:39 +0000 Subject: [PATCH] Automatically generating Probe.h --- Makefile | 2 +- data/Probe.h | 48 ----------------------------------------------- data/project.conf | 2 +- src/Makefile | 11 +++++++---- src/appbroker.sh | 20 ++++++++++++++++++++ src/probe.c | 2 +- src/project.conf | 12 ++++++++---- 7 files changed, 38 insertions(+), 59 deletions(-) delete mode 100644 data/Probe.h create mode 100755 src/appbroker.sh diff --git a/Makefile b/Makefile index 98e9727..d1140c2 100644 --- a/Makefile +++ b/Makefile @@ -23,11 +23,11 @@ dist: @$(TAR) $(PACKAGE)-$(VERSION).tar.gz \ $(PACKAGE)-$(VERSION)/data/Makefile \ $(PACKAGE)-$(VERSION)/data/Probe.interface \ - $(PACKAGE)-$(VERSION)/data/Probe.h \ $(PACKAGE)-$(VERSION)/data/project.conf \ $(PACKAGE)-$(VERSION)/src/probe.c \ $(PACKAGE)-$(VERSION)/src/damon.c \ $(PACKAGE)-$(VERSION)/src/Makefile \ + $(PACKAGE)-$(VERSION)/src/appbroker.sh \ $(PACKAGE)-$(VERSION)/src/project.conf \ $(PACKAGE)-$(VERSION)/tools/Makefile \ $(PACKAGE)-$(VERSION)/tools/create.sh \ diff --git a/data/Probe.h b/data/Probe.h deleted file mode 100644 index cf85b9d..0000000 --- a/data/Probe.h +++ /dev/null @@ -1,48 +0,0 @@ -/* $Id$ */ - - - -#ifndef Probe_H -# define Probe_H - -# include -# include - - -/* types */ -typedef Buffer * BUFFER; -typedef int16_t INT16; -typedef int32_t INT32; -typedef uint16_t UINT16; -typedef uint32_t UINT32; -typedef String const * STRING; - -typedef BUFFER BUFFER_IN; -typedef INT32 INT32_IN; -typedef UINT32 UINT32_IN; -typedef STRING STRING_IN; - -typedef Buffer * BUFFER_OUT; -typedef int32_t * INT32_OUT; -typedef uint32_t * UINT32_OUT; -typedef String ** STRING_OUT; - -typedef Buffer * BUFFER_INOUT; -typedef int32_t * INT32_INOUT; -typedef uint32_t * UINT32_INOUT; -typedef String ** STRING_INOUT; - - -/* functions */ -UINT32 Probe_uptime(); -INT32 Probe_load(UINT32_OUT load_1, UINT32_OUT load_5, UINT32_OUT load_15); -INT32 Probe_ram(UINT32_OUT total, UINT32_OUT free, UINT32_OUT shared, UINT32_OUT buffer); -INT32 Probe_swap(UINT32_OUT total, UINT32_OUT free); -UINT32 Probe_users(); -UINT32 Probe_procs(); -UINT32 Probe_ifrxbytes(STRING interface); -UINT32 Probe_iftxbytes(STRING interface); -UINT32 Probe_voltotal(STRING volume); -UINT32 Probe_volfree(STRING volume); - -#endif /* !Probe_H */ diff --git a/data/project.conf b/data/project.conf index f7ae761..dfe41b8 100644 --- a/data/project.conf +++ b/data/project.conf @@ -1,4 +1,4 @@ -dist=Makefile,Probe.interface,Probe.h +dist=Makefile,Probe.interface [Probe.interface] install=$(PREFIX)/etc/AppInterface diff --git a/src/Makefile b/src/Makefile index 7c837e9..770a6f3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,13 +1,13 @@ -TARGETS = Probe DaMon +TARGETS = ../data/Probe.h Probe DaMon PREFIX = /usr/local DESTDIR = BINDIR = $(PREFIX)/bin CC = cc -CPPFLAGSF= -I ../data -I $(PREFIX)/include +CPPFLAGSF= -I $(PREFIX)/include CPPFLAGS= CFLAGSF = -W CFLAGS = -Wall -g -O2 -pedantic -LDFLAGSF= -lSystem +LDFLAGSF= -lSystem LDFLAGS = -L $(PREFIX)/lib -Wl,-rpath,$(PREFIX)/lib RM = rm -f LN = ln -f @@ -17,6 +17,9 @@ INSTALL = install all: $(TARGETS) +../data/Probe.h: + ./appbroker.sh "../data/Probe.h" + Probe_OBJS = probe.o Probe_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) Probe_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) -Wl,--export-dynamic @@ -38,7 +41,7 @@ damon.o: damon.c ../config.h $(CC) $(DaMon_CFLAGS) -c damon.c clean: - $(RM) $(Probe_OBJS) $(DaMon_OBJS) + $(RM) $(../data/Probe.h_OBJS) $(Probe_OBJS) $(DaMon_OBJS) distclean: clean $(RM) $(TARGETS) diff --git a/src/appbroker.sh b/src/appbroker.sh new file mode 100755 index 0000000..fc375f4 --- /dev/null +++ b/src/appbroker.sh @@ -0,0 +1,20 @@ +#!/bin/sh +#$Id$ + + + +#usage +usage() +{ + echo "Usage: ./appbroker.sh target" 1>&2 + return 1 +} + + +#main +if [ $# -ne 1 ]; then + usage + exit $? +fi +APPINTERFACE="${1%%.h}.interface" +AppBroker -o "$1" "$APPINTERFACE" diff --git a/src/probe.c b/src/probe.c index 1051d8a..db675c3 100644 --- a/src/probe.c +++ b/src/probe.c @@ -25,7 +25,7 @@ #include #include #include -#include "Probe.h" +#include "../data/Probe.h" #include "../config.h" diff --git a/src/project.conf b/src/project.conf index 5086070..d9b17a4 100644 --- a/src/project.conf +++ b/src/project.conf @@ -1,10 +1,14 @@ -targets=Probe,DaMon -cppflags_force=-I ../data -I $(PREFIX)/include +targets=../data/Probe.h,Probe,DaMon +cppflags_force=-I $(PREFIX)/include cflags_force=-W cflags=-Wall -g -O2 -pedantic -ldflags_force=-lSystem -ldl +ldflags_force=-lSystem ldflags=-L $(PREFIX)/lib -Wl,-rpath,$(PREFIX)/lib -dist=Makefile +dist=Makefile,appbroker.sh + +[../data/Probe.h] +type=script +script=./appbroker.sh [Probe] type=binary