#include "macrotab.h"
#include "output.h"
#include "scanner.h"
-#include "standard.h"
#include "segments.h"
+#include "standard.h"
+#include "svnversion.h"
/* Print the compiler version */
{
fprintf (stderr,
- "cc65 V%u.%u.%u\n",
- VER_MAJOR, VER_MINOR, VER_PATCH);
+ "cc65 V%u.%u.%u\n"
+ "SVN version: %s\n",
+ VER_MAJOR, VER_MINOR, VER_PATCH, SVNVersion);
}
+
# ------------------------------------------------------------------------------
# The executable to build
EBIND=emxbind
LDFLAGS=-lm
+# Determine the svn version number if possible
+ifneq "$(shell which svnversion 2>/dev/null)" ""
+ifneq "$(wildcard .svn)" ""
+SVNVERSION=$(shell svnversion)
+else
+SVNVERSION=unknown
+endif
+else
+SVNVERSION=unknown
+endif
+
# ------------------------------------------------------------------------------
# Object files and libraries to link
stdfunc.o \
stdnames.o \
stmt.o \
+ svnversion.o \
swstmt.o \
symentry.o \
symtab.o \
# Main target - must be first
.PHONY: all
ifeq (.depend,$(wildcard .depend))
-all: $(EXE)
+all: svnversion $(EXE)
include .depend
else
all: depend
endif
$(EXE): $(OBJS) $(LIBS)
- $(CC) $^ $(LDFLAGS) -o $@
+ $(CC) $(OBJS) $(LIBS) $(LDFLAGS) -o $@
@if [ $(OS2_SHELL) ] ; then $(EBIND) $(EXE) ; fi
+.PHONY: svnversion
+svnversion:
+ @$(RM) svnversion.c
+ @echo "/* This file is auto-generated - do not modify! */" >> svnversion.c
+ @echo "" >> svnversion.c
+ @echo "const char SVNVersion[] = \"$(SVNVERSION)\";" >> svnversion.c
+
+svnversion.c: svnversion
+
clean:
$(RM) *~ core.* *.map
zap: clean
- $(RM) *.o $(EXE) .depend
+ $(RM) $(OBJS) $(EXE) .depend svnversion.c
# ------------------------------------------------------------------------------
# Make the dependencies
# Target files
EXE = cc65.exe
+# Determine the svn version number if possible
+ifneq "$(shell which svnversion 2>/dev/null)" ""
+ifneq "$(wildcard .svn)" ""
+SVNVERSION=$(shell svnversion)
+else
+SVNVERSION=unknown
+endif
+else
+SVNVERSION=unknown
+endif
+
# Create NT programs by default
ifndef TARGET
TARGET = NT
stdfunc.obj \
stdnames.obj \
stmt.obj \
+ svnversion.obj \
swstmt.obj \
symentry.obj \
symtab.obj \
# ------------------------------------------------------------------------------
# Main targets
-all: $(EXE)
+all: svnversion $(EXE)
# ------------------------------------------------------------------------------
@$(LD) system $(SYSTEM) @$(LNKCFG)
@rm $(LNKCFG)
+.PHONY: svnversion
+svnversion:
+ @$(RM) svnversion.c
+ @echo "/* This file is auto-generated - do not modify! */" >> svnversion.c
+ @echo "" >> svnversion.c
+ @echo "const char SVNVersion[] = \"$(SVNVERSION)\";" >> svnversion.c
+
+svnversion.c: svnversion
+
clean:
@rm -f *~ core
zap: clean
- @rm -f *.obj $(EXE)
+ @rm -f $(OBJS) $(EXE) svnversion.c
strip:
@-$(WSTRIP) $(EXE)
--- /dev/null
+/*****************************************************************************/
+/* */
+/* svnversion.h */
+/* */
+/* Keep track of the svn version */
+/* */
+/* */
+/* */
+/* (C) 1998-2008 Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
+/* */
+/* */
+/* This software is provided 'as-is', without any expressed or implied */
+/* warranty. In no event will the authors be held liable for any damages */
+/* arising from the use of this software. */
+/* */
+/* Permission is granted to anyone to use this software for any purpose, */
+/* including commercial applications, and to alter it and redistribute it */
+/* freely, subject to the following restrictions: */
+/* */
+/* 1. The origin of this software must not be misrepresented; you must not */
+/* claim that you wrote the original software. If you use this software */
+/* in a product, an acknowledgment in the product documentation would be */
+/* appreciated but is not required. */
+/* 2. Altered source versions must be plainly marked as such, and must not */
+/* be misrepresented as being the original software. */
+/* 3. This notice may not be removed or altered from any source */
+/* distribution. */
+/* */
+/*****************************************************************************/
+
+
+
+#ifndef SVNVERSION_H
+#define SVNVERSION_H
+
+
+
+/*****************************************************************************/
+/* Data */
+/*****************************************************************************/
+
+
+
+/* This variable contains the SVN version string */
+extern const char SVNVersion[];
+
+
+
+/* End of svnversion.h */
+
+#endif
+
+
+