* Ensured the bin directory is created [issue #1];

* Fixed all compiler warnings with gcc 5.2.1;
* Fixed version substitution in header file.
This commit is contained in:
simon 2016-03-08 18:46:34 +00:00
parent 5168a633c4
commit 5b5f3f450f
4 changed files with 19 additions and 14 deletions

View file

@ -6,26 +6,30 @@ CFLAGS= -g
LD= gcc
LDFLAGS= -g
HOMEDIR= /usr/local/etc/gild
TARGETS= ../bin/gild
COMPONENTS = gild.o wrapper.o config.o log.o
BINDIR= ../bin
TARGETS= $(BINDIR)/gild
COMPONENTS = gild.h gild.o wrapper.o config.o log.o
VERSION= $(shell git describe)
all: $(TARGETS)
.c.o:
$(CC) $(CFLAGS) -c $<
gild.h: gild.h.src
sed "s?@Revision@?$(VERSION)?" gild.h.src > gild.h
../bin/gild: $(COMPONENTS) gild.h Makefile
$(LD) $(LDFLAGS) -o gild $(COMPONENTS)
mv gild ../bin
test -d $(BINDIR) || mkdir $(BINDIR)
mv gild $(BINDIR)
clean:
rm core $(COMPONENTS) $(TARGETS)
rm -f core $(COMPONENTS) $(TARGETS)
install: $(TARGETS)
install --strip $(TARGETS) $(HOMEDIR)
install gild.conf $(HOMEDIR)
cd handlers; make install
version: $(TARGETS)
cvs commit gild.c wrapper.c config.c log.c Makefile gild.h \
gild.conf handlers

View file

@ -27,7 +27,7 @@ extern handler * handlers;
void error( int severity)
/* log the current contents of errorBuff and then if severity is bad die */
{
log( severity, errorBuff);
log_message( severity, errorBuff);
switch ( severity)
{

View file

@ -14,14 +14,15 @@
/* $Header$ */
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <regex.h>
#include <signal.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>
#include <arpa/inet.h>
/* #include <linux/in.h> */
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
@ -29,8 +30,8 @@
#define GILD_NAME "gild"
#define GILD_VERSION "$Revision$"
#define GILD_ID "gild $Revision$"
#define GILD_VERSION "@Revision@"
#define GILD_ID "gild @Revision@"
#define CONFIG_PATH "/usr/local/etc/gild/gild.conf"
#define DEFAULT_PORT_NO 8421
@ -61,7 +62,7 @@ void error( int severity);
handler * get_handler( char * match);
/* find a handler whose pattern matches match, and return it's command */
int log( int level, char *message);
int log_message( int level, char *message);
/* hand this message over to the syslog daemon for recording */
int parse_config( char * path);

View file

@ -18,14 +18,14 @@
#include "gild.h"
int log( int level, char *message)
int log_message( int level, char *message)
/* hand this message over to the syslog daemon for recording */
{
#ifdef DEBUG
fprintf( stderr, "%s: DEBUG: %s\n", GILD_ID, message);
#else
openlog( GILD_NAME, 0, LOG_DAEMON);
syslog( level, message);
syslog( level, "%s", message);
closelog();
#endif
}