09 Jul, 2013, arholly wrote in the 1st comment:
Votes: 0
Hello:
I'm using Centos6.4 (final) and I'm getting an error message when I go to compile. I just moved to this OS and I'm not real familiar with it.
+ 1")syntax error: invalid arithmetic operator (error token is "
make: *** [version] Error 127



@echo $$(($$(cat $(VERSION_FILE)) + 1)) > $(VERSION_FILE)
@echo "#ifndef __Version_Hpp" > version.h
@echo "#define __Version_hpp" >> version.h
@echo "const unsigned long mudVersion = $(shell cat $(VERSION_FILE))+1;" >> version.h


What am I doing wrong?
09 Jul, 2013, plamzi wrote in the 2nd comment:
Votes: 0
This doesn't look like anything essential. Did you try commenting it out and getting back to it when everything else you wanted to do was done (and the bottle was not yet empty)?
09 Jul, 2013, arholly wrote in the 3rd comment:
Votes: 0
When I comment out, it works fine. But it is the versioning for the mud, so I kind of wanted it. :) But I can live without it for the time being.
09 Jul, 2013, Runter wrote in the 4th comment:
Votes: 0
so what, every time you run it the version is incremented?
09 Jul, 2013, plamzi wrote in the 5th comment:
Votes: 0
You could mark your build with the current timestamp in one line. I find that a bit more useful.
09 Jul, 2013, Tyche wrote in the 6th comment:
Votes: 0
arholly said:
What am I doing wrong?

Not enough information. You need to post the entire make command entered and complete makefile as is.
09 Jul, 2013, arholly wrote in the 7th comment:
Votes: 0
Here is the entire Makefile.

#####################################################################################################
## Updated Makefile by David Simmerson (Omega)
## Fundamental changes: now supports automated revision
## automated backup of SUCCESSFUL compiles, so you can restore back to older builds if necessary (success ones that is)
##
#####################################################################################################
## Now use wildcards, all .c files will be compiled if located within the source directory
## further futureproofing of the Entity known as DungeonWorld
#####################################################################################################

CC = gcc
PROF = -O -ggdb
NOCRYPT =
C_FLAGS = -Wall $(PROF) $(NOCRYPT)
L_FLAGS = $(PROF) -DASSERT
INCLUDE_FLAGS =
LIBRARIES = -lcrypt

#####################################################################################################
# VERSION SUPPORT: allow us to control our revisions of the executable being built.
# name of our version file
VERSION_FILE = .version

# Ensure we are built properly with the correct data
BUILD_DATE = $(shell date +'%Y%m%d')
BUILD_NUM = $(shell cat $(VERSION_FILE))

# define our version (within the compiler flags)
C_FLAGS += -DBUILD_DATE=$(BUILD_DATE) -DBUILD_NUM=$(BUILD_NUM)

# define our backup filename : this is broken down into multiple blocks as there was an issue with
# using long names / groups : this error may of been compiler specific, but this was the fix.
# so to retain functionality of the backup, this is our goal
BACKUP_NAME_PT1 = "backup-$(BUILD_DATE)"
BACKUP_NAME_PT2 = "-$(BUILD_NUM).tgz"
# put both groups together in our final attempt to create a unified backup
BACKUP_NAME = "$(BACKUP_NAME_PT1)$(BACKUP_NAME_PT2)"

C_FILES = ${wildcard *.c}
OBJECT_FILES = $(patsubst %.c, %.o, ${C_FILES})

ENGINE = rom
BINDIR = ../area/

all: version ${ENGINE}

#####################################################################################################
#Generate our engine for execution, this will build, and force the system into the next steps listed
#below in the .c.o section. Note that this is epic build state.
.PHONY: $(ENGINE)
${ENGINE}: $(OBJECT_FILES)
rm -f ${ENGINE}
$(CC) $(L_FLAGS) -o ${ENGINE} $(OBJECT_FILES) ${LIBRARIES}
@rm $(BINDIR)/$(ENGINE)
@cp $(ENGINE) $(BINDIR)
@make backup # force the Makefile to backup ALL successfully completed builds (failed ones don't backup)
@echo "Compiling Completed for build $(BUILD_NUM) at `date +"%y-%m-%d @ %X"` and copied $(ENGINE) to $(BINDIR)."

######################################################################################################
#Generate our .o (object) files based off of our .cpp files (dependant upon Core.hpp) this will allow
#us to actually compile our executable
.PHONY: .c.o
%.o: %.c
@echo "`date +"%X"` >> Building $<…"
@$(CC) ${INCLUDE_FLAGS} -c $(C_FLAGS) $<

######################################################################################################
# Generate a backup of the source code for today's date and move it to the backup folder!
.PHONY: backup
backup:
@tar -czf $(BACKUP_NAME) *.c *.h Makefile .version
@mv *.tgz ../
@echo "Backup completed."

#####################################################################################################
#Generate our version file (generates a .version file, and a .hpp file)
.PHONY: version
version:
@if ! test -f $(VERSION_FILE); then echo 0 > $(VERSION_FILE); fi
@echo $$(($$(cat $(VERSION_FILE)) + 1)) > $(VERSION_FILE)
@echo "#ifndef __Version_Hpp" > version.h
@echo "#define __Version_hpp" >> version.h
@echo "const unsigned long mudVersion = $(shell cat $(VERSION_FILE))+1;" >> version.h
@echo "#endif" >> version.h
@echo "Revision control completed!"

####################################################################################################
# clean out our folder of any/all un-necessary files allowing us to ensure our directory is clean.
clean:
@rm -f *.o
@echo ".o files removed from directory."
make
####################################################################################################

####################################################################################################
# Wipes the directory clean of .o files and the executibles. Helps ensure a clean directory.
wipe:
@rm -f *.o rom
@rm -f rom.exe
@echo "Dungeon World is wiped."
####################################################################################################


####################################################################################################
# Grab our u-name for giggles; used later on to detect possible support
# for the game engine
UNAME = $(shell uname -s)
####################################################################################################
09 Jul, 2013, plamzi wrote in the 8th comment:
Votes: 0
You can step through the version-building command lines, find the one that generates the error, then rewrite it to please your new shell with some help from Google. It's probably a minor syntactical difference in the way you do closures.

Or, you can simplify your life. Because something like this is likely to break every time you change shells.
09 Jul, 2013, quixadhal wrote in the 9th comment:
Votes: 0
How often do you change shells? I've used bash for the last 20 years or so… I used tcsh for a few years before that, and DCL before that.

What my own horrible makefile does for auto-updating version informaton:

DATESTAMP       = $(shell /bin/date "+%y.%m.%d")
VER = $(addprefix include/, version.h)
OLDV = $(shell perl -ne '$$i = $$1 if /Version\s+\d\.(\d+)w3-beta/i; END { $$i = 0 if !defined $$i; print "$$i\n";}' < $(VER))
VERSION = $(shell echo $(OLDV) + 1 | bc)

.PHONY : version

version :
@echo '/* Auto-generated – DO NOT EDIT */' > $(VER)
@echo '#ifndef _VERSION_H' >> $(VER)
@echo '#define _VERSION_H' >> $(VER)
@echo '' >> $(VER)
@echo "#define VERSION_STR \\\\" >> $(VER)
@echo "\"\\\\r\\\\n*** Welcome to WileyMUD III, Quixadhal's Version 1.$(VERSION)w3-beta ($(DATESTAMP)) ***\\\\r\\\\n\"" >> $(VER)
@echo "#define VERSION_BASE \"WileyMUD III\"" >> $(VER)
@echo "#define VERSION_BUILD \"1.$(VERSION)b\"" >> $(VER)
@echo '#endif /* _VERSION_H */' >> $(VER)
@echo New version file generated.
10 Jul, 2013, Tyche wrote in the 10th comment:
Votes: 0
Sorry, I can't find anything wrong with it.
12 Jul, 2013, Omega wrote in the 11th comment:
Votes: 0
There isn't anything wrong with it, I've been using this revision system in my makefile for years, I gave it to Arholly for his mud and it worked until he changed to CentOS. I suspect it has something to do with his OS change, because I haven't had a single problem with it in my system. I've used it with Fedora, Redhat Enterprise, Ubuntu, and a variety of other OS's, best bet, it is the OS and not the makefile.
13 Jul, 2013, Tyche wrote in the 12th comment:
Votes: 0
It's not the OS. It works fine under CentOS 5.4 and 6.3.
More than likely the Makefile has been modified and tabs and/or line feeds have been fungled.
14 Jul, 2013, Omega wrote in the 13th comment:
Votes: 0
Ahh, that seems like a logical reason as well.
0.0/13