333 endif # HAS_FILE_FUNCTION |
333 endif # HAS_FILE_FUNCTION |
334 |
334 |
335 ################################################################################ |
335 ################################################################################ |
336 # The source tips can come from the Mercurial repository, or in the files |
336 # The source tips can come from the Mercurial repository, or in the files |
337 # $(HGTIP_FILENAME) which contains the tip but is also positioned in the same |
337 # $(HGTIP_FILENAME) which contains the tip but is also positioned in the same |
338 # directory as the original $(HGDIR) directory. |
338 # directory as the original .hg directory. The hgtip files are created in |
339 # These should not be := assignments, only used from the root Makefile. |
339 # CreateHgtipFiles.gmk. |
340 HG_VERSION = $(shell $(HG) version 2> /dev/null) |
340 HGTIP_FILENAME := .hgtip |
341 HG_DIRECTORY=.hg |
341 FindAllReposAbs = \ |
342 HGTIP_FILENAME=.hgtip |
342 $(strip $(sort $(dir $(filter-out $(SRC_ROOT)/build/%, $(wildcard \ |
343 HG_SEARCH = ./REPO ./*/REPO ./*/*/REPO ./*/*/*/REPO |
343 $(addprefix $(SRC_ROOT)/, \ |
344 REPO_LIST = $(patsubst ./%,%,$(patsubst %/,%,$(sort $(dir \ |
344 .hg */.hg */*/.hg */*/.hg */*/*/.hg \ |
345 $(shell $(CD) $(SRC_ROOT) ; \ |
345 .hgtip */.hgtip */*/.hgtip */*/.hgtip */*/*/.hgtip \ |
346 $(LS) -d $(HG_SEARCH:%/REPO=%/$(HG_DIRECTORY)) \ |
346 ) \ |
347 $(HG_SEARCH:%/REPO=%/$(HGTIP_FILENAME)) \ |
347 ))))) |
348 2> /dev/null))))) |
348 |
|
349 FindAllReposRel = \ |
|
350 $(strip $(subst $(SRC_ROOT)/,.,$(patsubst $(SRC_ROOT)/%/, %, $(FindAllReposAbs)))) |
349 |
351 |
350 # Emit the repo:tip pairs to $@, but only if they changed since last time |
352 # Emit the repo:tip pairs to $@, but only if they changed since last time |
351 define GetSourceTips |
353 define GetSourceTips |
352 $(CD) $(SRC_ROOT) ; \ |
354 $(CD) $(SRC_ROOT) ; \ |
353 for i in $(REPO_LIST) IGNORE ; do \ |
355 for i in $(FindAllReposRel) IGNORE ; do \ |
354 if [ "$${i}" = "IGNORE" ] ; then \ |
356 if [ "$${i}" = "IGNORE" ] ; then \ |
355 continue; \ |
357 continue; \ |
356 elif [ -d $${i}/$(HG_DIRECTORY) -a "$(HG_VERSION)" != "" ] ; then \ |
358 elif [ -d $${i}/.hg -a "$(HG)" != "" ] ; then \ |
357 $(PRINTF) " %s:%s" \ |
359 $(PRINTF) " %s:%s" \ |
358 "$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \ |
360 "$${i}" `$(HG) tip --repository $${i} --template '{node|short}\n'` ; \ |
359 elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \ |
361 elif [ -f $${i}/$(HGTIP_FILENAME) ] ; then \ |
360 $(PRINTF) " %s:%s" \ |
362 $(PRINTF) " %s:%s" \ |
361 "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \ |
363 "$${i}" `$(CAT) $${i}/$(HGTIP_FILENAME)` ; \ |