Makefile.src.in
changeset 10824 1a34ba6f338a
parent 8412 11f4d198145d
equal deleted inserted replaced
10823:4fc397f84007 10824:1a34ba6f338a
    87 	$(MAKE) -C $(LANG_OBJS_DIR) $(STRGEN)
    87 	$(MAKE) -C $(LANG_OBJS_DIR) $(STRGEN)
    88 
    88 
    89 $(LANG_OBJS_DIR)/table/strings.h: $(LANG_DIR)/english.txt $(LANG_OBJS_DIR)/$(STRGEN)
    89 $(LANG_OBJS_DIR)/table/strings.h: $(LANG_DIR)/english.txt $(LANG_OBJS_DIR)/$(STRGEN)
    90 	$(MAKE) -C $(LANG_OBJS_DIR) table/strings.h
    90 	$(MAKE) -C $(LANG_OBJS_DIR) table/strings.h
    91 
    91 
       
    92 
       
    93 # Determine if we are using a modified version
       
    94 ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1)
       
    95 REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
       
    96 else
       
    97 # Are we a git dir?
       
    98 ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1)
       
    99 REV_MODIFIED := $(shell if cd "$(SRC_DIR)/.." && git diff-index HEAD src | read dummy; then echo M; fi)
       
   100 else
       
   101 # Are we a hg (Mercurial) dir?
       
   102 ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1)
       
   103 REV_MODIFIED := $(shell if hg status $(SRC_DIR) | grep -v '^?' | read dummy; then echo M; fi)
       
   104 else
       
   105 MODIFIED="1"
       
   106 endif
       
   107 endif
       
   108 endif
       
   109 
       
   110 ifneq ($(MODIFIED),"1")
       
   111 ifeq ($(REV_MODIFIED),)
       
   112 MODIFIED="0"
       
   113 else
       
   114 MODIFIED="2"
       
   115 endif
       
   116 endif
       
   117 
    92 # Make the revision number
   118 # Make the revision number
    93 ifdef REVISION
   119 ifdef REVISION
    94 REV := $(REVISION)
   120 REV := $(REVISION)
    95 REV_NR := $(shell echo $(REVISION) | sed "s/[^0-9]//g")
   121 REV_NR := $(shell echo $(REVISION) | sed "s/[^0-9]//g")
    96 else
   122 else
    97 # Are we a SVN dir?
   123 # Are we a SVN dir?
    98 ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1)
   124 ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1)
    99 # Find if the local source if modified
   125 # Find if the local source if modified
   100 REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
       
   101 # Find the revision like: rXXXX-branch
   126 # Find the revision like: rXXXX-branch
   102 REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branch/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
   127 REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branch/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
   103 REV_NR := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^Last Changed Rev:/ { print $$4 }')
   128 REV_NR := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^Last Changed Rev:/ { print $$4 }')
   104 else
   129 else
   105 # Are we a git dir?
   130 # Are we a git dir?
   106 ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1)
   131 ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1)
   107 # Find the revision like: gXXXXM-branch
   132 # Find the revision like: gXXXXM-branch
   108 REV := g$(shell if head=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(shell if cd "$(SRC_DIR)/.." && git diff-index HEAD src | read dummy; then echo M; fi)$(shell git branch|grep '[*]' | sed 's/\* /-/;s/^-master$$//')
   133 REV := g$(shell if head=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(REV_MODIFIED)$(shell git branch|grep '[*]' | sed 's/\* /-/;s/^-master$$//')
   109 REV_NR := $(shell LC_ALL=C cd "$(SRC_DIR)/.." && git log --pretty=format:%s src | grep -m 1 "^(svn r[0-9]*)" | sed "s/.*(svn r\([0-9]*\)).*/\1/" )
   134 REV_NR := $(shell LC_ALL=C cd "$(SRC_DIR)/.." && git log --pretty=format:%s src | grep -m 1 "^(svn r[0-9]*)" | sed "s/.*(svn r\([0-9]*\)).*/\1/" )
   110 else
   135 else
   111 # Are we a hg (Mercurial) dir?
   136 # Are we a hg (Mercurial) dir?
   112 ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1)
   137 ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1)
   113 # Find the revision like: hXXXXM-branch
   138 # Find the revision like: hXXXXM-branch
   114 REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -c19-26; fi)$(shell if hg status $(SRC_DIR) | grep -v '^?' | read dummy; then echo M; fi)$(shell hg branch | sed 's/^/-/;s/^-default$$//')
   139 REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -c19-26; fi)$(REV_MODIFIED)$(shell hg branch | sed 's/^/-/;s/^-default$$//')
   115 REV_NR := $(shell LC_ALL=C hg log -k "svn" -l 1 --template "{desc}\n" $(SRC_DIR) | grep -m 1 "^(svn r[0-9]*)" | sed "s/.*(svn r\([0-9]*\)).*/\1/" )
   140 REV_NR := $(shell LC_ALL=C hg log -k "svn" -l 1 --template "{desc}\n" $(SRC_DIR) | grep -m 1 "^(svn r[0-9]*)" | sed "s/.*(svn r\([0-9]*\)).*/\1/" )
   116 endif
   141 endif
   117 endif
   142 endif
   118 endif
   143 endif
   119 endif
   144 endif
   285 	$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $< -o $@
   310 	$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $< -o $@
   286 
   311 
   287 # Revision files
   312 # Revision files
   288 
   313 
   289 $(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
   314 $(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
   290 	$(Q)cat $(SRC_DIR)/rev.cpp.in      | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/rev.cpp
   315 	$(Q)cat $(SRC_DIR)/rev.cpp.in      | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@MODIFIED@@#$(MODIFIED)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/rev.cpp
   291 
   316 
   292 $(SRC_DIR)/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/ottdres.rc.in
   317 $(SRC_DIR)/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/ottdres.rc.in
   293 	$(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/ottdres.rc
   318 	$(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/ottdres.rc
   294 
   319 
   295 FORCE:
   320 FORCE: