Automatically generating Probe.h

This commit is contained in:
Pierre Pronchery 2009-11-27 21:42:39 +00:00
parent c3b9648cc8
commit e4cea62828
7 changed files with 38 additions and 59 deletions

View File

@ -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 \

View File

@ -1,48 +0,0 @@
/* $Id$ */
#ifndef Probe_H
# define Probe_H
# include <stdint.h>
# include <System.h>
/* 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 */

View File

@ -1,4 +1,4 @@
dist=Makefile,Probe.interface,Probe.h
dist=Makefile,Probe.interface
[Probe.interface]
install=$(PREFIX)/etc/AppInterface

View File

@ -1,9 +1,9 @@
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
@ -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)

20
src/appbroker.sh Executable file
View File

@ -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"

View File

@ -25,7 +25,7 @@
#include <string.h>
#include <errno.h>
#include <System.h>
#include "Probe.h"
#include "../data/Probe.h"
#include "../config.h"

View File

@ -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