utilbuild.mk 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #
  2. # Copyright (c) 2006-2011 Nokia Corporation and/or its subsidiary(-ies).
  3. # All rights reserved.
  4. # This component and the accompanying materials are made available
  5. # under the terms of the License "Eclipse Public License v1.0"
  6. # which accompanies this distribution, and is available
  7. # at the URL "http://www.eclipse.org/legal/epl-v10.html".
  8. #
  9. # Initial Contributors:
  10. # Nokia Corporation - initial contribution.
  11. #
  12. # Contributors:
  13. #
  14. # Description:
  15. # Utility makefile
  16. #
  17. CHAR_BLANK:=
  18. CHAR_SPACE:=$(CHAR_BLANK) $(CHAR_BLANK)
  19. HOSTPLATFORM:=$(shell $(SBS_HOME)/bin/gethost.sh)
  20. HOSTPLATFORM_DIR:=$(shell $(SBS_HOME)/bin/gethost.sh -d)
  21. ifeq ($(filter $(HOSTPLATFORM),win),win)
  22. PROGRAMEXT:=.exe
  23. HOSTMACROS:=-DHOST_WIN -DHOST_DIR=$(HOSTPLATFORM_DIR)
  24. else
  25. PROGRAMEXT:=
  26. HOSTMACROS:=-DHOST_LINUX -DHOST_DIR=$(HOSTPLATFORM_DIR)
  27. endif
  28. GCCTUNE:=
  29. ifeq ($(filter $(HOSTPLATFORM),x86_64),x86_64)
  30. else
  31. GCCTUNE:=-mtune=i686
  32. endif
  33. BUILDDIR:=$(subst \,/,$(SBS_HOME))/util/build
  34. INSTALLROOT:=$(subst \,/,$(SBS_HOME))/$(HOSTPLATFORM_DIR)
  35. BINDIR:=$(INSTALLROOT)/bin
  36. OUTPUTPATH:=$(BUILDDIR)/$(HOSTPLATFORM_DIR)
  37. define cleanlog
  38. ifneq ($(CLEANMODE),)
  39. $$(info <clean>)
  40. $$(foreach O,$$(CLEANFILES),$$(info <file>$$(O)</file>))
  41. $$(info </clean>)
  42. endif
  43. endef
  44. # fetch_gbzip - fetch a gzip/bzipped file using a list of alternate
  45. # URLS. If the result is corrupt or incomplete then remove it.
  46. # $1 - The ultimate location and filename in which to store the file
  47. # Must end in "bz2" or "gz"
  48. # $2 - urls separated by spaces for alternate download locations
  49. define fetch_gbzip
  50. $1:
  51. -for url in $2; do \
  52. wget $$$$url -O $1; \
  53. if [ $$$$? -eq 0 ]; then \
  54. filetype="$1"; \
  55. if [ "$$$${filetype##*bz2}" == "" ]; then \
  56. bzip2 -t $1; \
  57. else \
  58. gzip -t $1;\
  59. fi; \
  60. if [ $$$$? -eq 0 ]; then \
  61. break;\
  62. else \
  63. echo "Error - $1 could not be decompressed hence it is invalid - deleting it." 1>&2 ; \
  64. rm $1; \
  65. fi ; \
  66. else \
  67. echo "Error - $1 could not be fetched" 1>&2 ;\
  68. rm $1; \
  69. fi ; \
  70. done ; \
  71. test -f $1
  72. endef