if HAVE_SVNVERSION
IPPTOPSPS_VERSION=`$(SVNVERSION) ..`
else
IPPTOPSPS_VERSION="UNKNOWN"
endif

if HAVE_SVN
IPPTOPSPS_BRANCH=`$(SVN) info .. | $(SED) -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'`
IPPTOPSPS_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
else
IPPTOPSPS_BRANCH="UNKNOWN"
IPPTOPSPS_SOURCE="UNKNOWN"
endif

# Force recompilation of ippToPspsVersion.c, since it gets the version information
ippToPspsVersion.c: ippToPspsVersionDefinitions.h
ippToPspsVersionDefinitions.h: ippToPspsVersionDefinitions.h.in FORCE
	-$(RM) ippToPspsVersionDefinitions.h
	$(SED) -e "s|@IPPTOPSPS_VERSION@|\"$(IPPTOPSPS_VERSION)\"|" -e "s|@IPPTOPSPS_BRANCH@|\"$(IPPTOPSPS_BRANCH)\"|" -e "s|@IPPTOPSPS_SOURCE@|\"$(IPPTOPSPS_SOURCE)\"|" ippToPspsVersionDefinitions.h.in > ippToPspsVersionDefinitions.h
FORCE: ;

bin_PROGRAMS = ippToPsps

ippToPsps_CFLAGS = $(IPPTOPSPS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS) -I/usr/include/libxml2
ippToPsps_LDFLAGS = $(IPPTOPSPS_LIBS) $(PSMODULE_LIBS) $(PSLIB_LIBS) -lxml2

ippToPsps_SOURCES = \
	main.c \
        ippToPsps.c \
	ippToPspsVersion.c \
	ippToPspsConfig.c \
	ippToPspsBatchInit.c \
	ippToPspsBatchDetection.c \
	ippToPspsBatchStack.c \
	ippToPspsBatchDifference.c   

include_HEADERS = \
	ippToPsps.h \
	ippToPspsConfig.h \
	ippToPspsDetEnums.h \
	ippToPspsDiffEnums.h \
	ippToPspsStackEnums.h 

clean-local:
	-rm -f TAGS

# Tags for emacs
tags:
	etags `find . -name \*.[ch] -print`

