version 2.3 and some changes to Makefile

This commit is contained in:
Sude 2013-03-19 19:29:58 +02:00
parent fab2ab5b94
commit d2566de2f4
3 changed files with 17 additions and 6 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
*.[oa]
bin/*
obj/*
version.h

View File

@ -48,6 +48,9 @@ all: debug release
clean: clean_debug clean_release
gen_version:
echo "#define VERSION_STRING \"LGOGDownloader $(shell grep VERSION_NUMBER < main.cpp | head -n 1 | sed -e 's/.*\([0-9]\+\.[0-9]\+\).*/\1/')$(shell if [ -e .git/HEAD ]; then if git status | grep -q 'modified:'; then echo -n 'M'; fi && echo -n ' git ' && git rev-parse --short HEAD; fi)\"" > version.h
before_debug:
test -d bin/Debug || mkdir -p bin/Debug
test -d $(OBJDIR_DEBUG) || mkdir -p $(OBJDIR_DEBUG)
@ -55,7 +58,7 @@ before_debug:
after_debug:
debug: before_debug out_debug after_debug
debug: before_debug gen_version out_debug after_debug
out_debug: $(OBJ_DEBUG) $(DEP_DEBUG)
$(LD) $(LDFLAGS_DEBUG) $(LIBDIR_DEBUG) $(OBJ_DEBUG) $(LIB_DEBUG) -o $(OUT_DEBUG)
@ -80,6 +83,7 @@ clean_debug:
rm -rf bin/Debug
rm -rf $(OBJDIR_DEBUG)
rm -rf $(OBJDIR_DEBUG)/src
rm -f version.h
before_release:
test -d bin/Release || mkdir -p bin/Release
@ -88,7 +92,7 @@ before_release:
after_release:
release: before_release out_release after_release
release: before_release gen_version out_release after_release
out_release: $(OBJ_RELEASE) $(DEP_RELEASE)
$(LD) $(LDFLAGS_RELEASE) $(LIBDIR_RELEASE) $(OBJ_RELEASE) $(LIB_RELEASE) -o $(OUT_RELEASE)
@ -113,6 +117,7 @@ clean_release:
rm -rf bin/Release
rm -rf $(OBJDIR_RELEASE)
rm -rf $(OBJDIR_RELEASE)/src
rm -f version.h
install:
install $(OUT_RELEASE) /usr/bin
@ -120,5 +125,5 @@ install:
uninstall:
rm /usr/bin/lgogdownloader
.PHONY: before_debug after_debug clean_debug before_release after_release clean_release
.PHONY: gen_version before_debug after_debug clean_debug before_release after_release clean_release

View File

@ -7,12 +7,11 @@
#include "downloader.h"
#include "config.h"
#include "util.h"
#include "version.h" // generated by Makefile
#include <unistd.h> // getpass
#include <fstream>
#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include <tinyxml.h>
#if __GNUC__
# if __x86_64__ || __ppc64__ || __LP64__
@ -22,12 +21,18 @@
# endif
#endif
#define VERSION_NUMBER "2.3"
#ifndef VERSION_STRING
# define VERSION_STRING "LGOGDownloader " VERSION_NUMBER
#endif
namespace bpo = boost::program_options;
int main(int argc, char *argv[])
{
Config config;
config.sVersionString = "LGOGDownloader 2.2+git";
config.sVersionString = VERSION_STRING;
config.sHome = (std::string)getenv("HOME");
config.sCookiePath = config.sHome + "/.gogdownloader/cookies.txt";
config.sConfigFilePath = config.sHome + "/.gogdownloader/config.cfg";