Makefile
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:7k
源码类别:

通讯编程

开发平台:

Visual C++

  1. ########################################################################################################
  2. #
  3. # Makefile wrapper to build tcl on Mac OS X in a way compatible with the tk/macosx Xcode buildsystem
  4. # uses the standard unix build system in tcl/unix (which can be used directly instead of this
  5. # if you are not using the tk/macosx projects).
  6. #
  7. # Copyright (c) 2002-2007 Daniel A. Steffen <das@users.sourceforge.net>
  8. #
  9. # See the file "license.terms" for information on usage and redistribution of
  10. # this file, and for a DISCLAIMER OF ALL WARRANTIES.
  11. #
  12. # RCS: @(#) $Id: Makefile,v 1.5.2.18 2007/09/13 15:28:17 das Exp $
  13. #
  14. ########################################################################################################
  15. #-------------------------------------------------------------------------------------------------------
  16. # customizable settings
  17. DESTDIR ?=
  18. INSTALL_ROOT ?= ${DESTDIR}
  19. BUILD_DIR ?= ${CURDIR}/../../build
  20. SYMROOT ?= ${BUILD_DIR}/${PROJECT}
  21. OBJROOT ?= ${SYMROOT}
  22. EXTRA_CONFIGURE_ARGS ?=
  23. EXTRA_MAKE_ARGS ?=
  24. INSTALL_PATH ?= /Library/Frameworks
  25. PREFIX ?= /usr/local
  26. BINDIR ?= ${PREFIX}/bin
  27. LIBDIR ?= ${INSTALL_PATH}
  28. MANDIR ?= ${PREFIX}/man
  29. # set to non-empty value to install manpages in addition to html help:
  30. INSTALL_MANPAGES ?=
  31. #-------------------------------------------------------------------------------------------------------
  32. # meta targets
  33. meta := all install embedded install-embedded clean distclean test
  34. styles := develop deploy
  35. all := ${styles}
  36. all : ${all}
  37. install := ${styles:%=install-%}
  38. install : ${install}
  39. install-%: action := install-
  40. embedded := ${styles:%=embedded-%}
  41. embedded : embedded-deploy
  42. install-embedded := ${embedded:%=install-%}
  43. install-embedded : install-embedded-deploy
  44. clean := ${styles:%=clean-%}
  45. clean : ${clean}
  46. clean-%: action := clean-
  47. distclean := ${styles:%=distclean-%}
  48. distclean : ${distclean}
  49. distclean-%: action := distclean-
  50. test := ${styles:%=test-%}
  51. test : ${test}
  52. test-%: action := test-
  53. targets := $(foreach v,${meta},${$v})
  54. #-------------------------------------------------------------------------------------------------------
  55. # build styles
  56. BUILD_STYLE =
  57. CONFIGURE_ARGS =
  58. OBJ_DIR = ${OBJROOT}/${BUILD_STYLE}
  59. develop_make_args := BUILD_STYLE=Development CONFIGURE_ARGS=--enable-symbols
  60. deploy_make_args := BUILD_STYLE=Deployment INSTALL_TARGET=install-strip 
  61.    GENERIC_FLAGS=-DNDEBUG
  62. embedded_make_args := EMBEDDED_BUILD=1
  63. install_make_args := INSTALL_BUILD=1
  64. ${targets}:
  65. ${MAKE} ${action}${PROJECT} 
  66. $(foreach s,${styles} embedded install,$(if $(findstring $s,$@),${${s}_make_args}))
  67. #-------------------------------------------------------------------------------------------------------
  68. # project specific settings
  69. PROJECT := tcl
  70. PRODUCT_NAME := Tcl
  71. UNIX_DIR := ${CURDIR}/../unix
  72. VERSION := $(shell awk -F= '/^TCL_VERSION/ {print $$2; nextfile}' ${UNIX_DIR}/configure.in)
  73. TCLSH := tclsh${VERSION}
  74. BUILD_TARGET := all tcltest
  75. INSTALL_TARGET := install
  76. export CPPROG := cp -p
  77. INSTALL_TARGETS = install-binaries install-libraries
  78. ifeq (${EMBEDDED_BUILD},)
  79. INSTALL_TARGETS += install-private-headers
  80. endif
  81. ifeq (${INSTALL_BUILD}_${EMBEDDED_BUILD}_${BUILD_STYLE},1__Deployment)
  82. INSTALL_TARGETS += html-tcl
  83. ifneq (${INSTALL_MANPAGES},)
  84. INSTALL_TARGETS += install-doc
  85. endif
  86. endif
  87. MAKE_VARS := INSTALL_ROOT INSTALL_TARGETS VERSION GENERIC_FLAGS
  88. MAKE_ARGS_V = $(foreach v,${MAKE_VARS},$v='${$v}')
  89. build-${PROJECT}: target = ${BUILD_TARGET}
  90. install-${PROJECT}: target = ${INSTALL_TARGET}
  91. clean-${PROJECT} distclean-${PROJECT} test-${PROJECT}: 
  92. target = $*
  93. DO_MAKE = +${MAKE} -C ${OBJ_DIR} ${target} ${MAKE_ARGS_V} ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
  94. #-------------------------------------------------------------------------------------------------------
  95. # build rules
  96. ${PROJECT}:
  97. ${MAKE} install-${PROJECT} INSTALL_ROOT=${OBJ_DIR}/
  98. ${OBJ_DIR}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure 
  99.      ${UNIX_DIR}/tclConfig.sh.in Tcl-Info.plist.in
  100. mkdir -p ${OBJ_DIR} && cd ${OBJ_DIR} && 
  101. if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure 
  102. --prefix=${PREFIX} --bindir=${BINDIR} --libdir=${LIBDIR} 
  103. --mandir=${MANDIR} --enable-threads --enable-framework --enable-dtrace 
  104. ${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS}; else ./config.status; fi
  105. build-${PROJECT}: ${OBJ_DIR}/Makefile
  106. ${DO_MAKE}
  107. ifeq (${INSTALL_BUILD},)
  108. # symolic link hackery to trick
  109. # 'make install INSTALL_ROOT=${OBJ_DIR}'
  110. # into building Tcl.framework and tclsh in ${SYMROOT}
  111. @cd ${OBJ_DIR} && mkdir -p $(dir ./${LIBDIR}) $(dir ./${BINDIR}) ${SYMROOT} && 
  112. rm -f ./${LIBDIR} ./${BINDIR} && ln -fs ${SYMROOT} ./${LIBDIR} && 
  113. ln -fs ${SYMROOT} ./${BINDIR} && ln -fs ${OBJ_DIR}/tcltest ${SYMROOT}
  114. endif
  115. install-${PROJECT}: build-${PROJECT}
  116. ifeq (${EMBEDDED_BUILD}_${INSTALL_ROOT},1_)
  117. @echo "Cannot install-embedded with empty INSTALL_ROOT !" && false
  118. endif
  119. ifeq (${EMBEDDED_BUILD},1)
  120. @rm -rf "${INSTALL_ROOT}/${LIBDIR}/Tcl.framework"
  121. endif
  122. ${DO_MAKE}
  123. ifeq (${INSTALL_BUILD},1)
  124. ifeq (${EMBEDDED_BUILD},1)
  125. # if we are embedding frameworks, don't install tclsh
  126. @rm -f "${INSTALL_ROOT}${BINDIR}/${TCLSH}" && 
  127. rmdir -p "${INSTALL_ROOT}${BINDIR}" 2>&- || true
  128. else
  129. # redo prebinding (when not building for Mac OS X 10.4 or later only)
  130. @if [ "`echo "$${MACOSX_DEPLOYMENT_TARGET}" | 
  131. awk -F '10\.' '{print int($$2)}'`" -lt 4 -a "`echo "$${CFLAGS}" | 
  132. awk -F '-mmacosx-version-min=10\.' '{print int($$2)}'`" -lt 4 ]; 
  133. then cd ${INSTALL_ROOT}/; 
  134. if [ ! -d usr/lib ]; then mkdir -p usr && ln -fs /usr/lib usr/ && RM_USRLIB=1; fi; 
  135. if [ ! -d System ]; then ln -fs /System . && RM_SYSTEM=1; fi; 
  136. redo_prebinding -r . "./${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}/${PRODUCT_NAME}"; 
  137. redo_prebinding -r . "./${BINDIR}/${TCLSH}"; 
  138. if [ -n "$${RM_USRLIB:-}" ]; then rm -f usr/lib; rmdir -p usr 2>&-; fi; 
  139. if [ -n "$${RM_SYSTEM:-}" ]; then rm -f System; fi; fi
  140. # install tclsh symbolic link
  141. @ln -fs ${TCLSH} ${INSTALL_ROOT}${BINDIR}/tclsh
  142. endif
  143. endif
  144. ifeq (${BUILD_STYLE}_${EMBEDDED_BUILD},Development_)
  145. # keep copy of debug library around, so that
  146. # Deployment build can be installed on top
  147. # of Development build without overwriting
  148. # the debug library
  149. @cd ${INSTALL_ROOT}${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION} && 
  150. ln -f "${PRODUCT_NAME}" "${PRODUCT_NAME}_debug"
  151. endif
  152. clean-${PROJECT}: %-${PROJECT}:
  153. ${DO_MAKE}
  154. rm -rf ${SYMROOT}/{${PRODUCT_NAME}.framework,${TCLSH},tcltest}
  155. rm -f ${OBJ_DIR}{${LIBDIR},${BINDIR}} && 
  156. rmdir -p ${OBJ_DIR}$(dir ${LIBDIR}) 2>&- || true && 
  157. rmdir -p ${OBJ_DIR}$(dir ${BINDIR}) 2>&- || true
  158. distclean-${PROJECT}: %-${PROJECT}: clean-${PROJECT}
  159. ${DO_MAKE}
  160. rm -rf ${OBJ_DIR}
  161. test-${PROJECT}: %-${PROJECT}: build-${PROJECT}
  162. ${DO_MAKE}
  163. #-------------------------------------------------------------------------------------------------------
  164. .PHONY: ${meta} ${targets} ${PROJECT} build-${PROJECT} install-${PROJECT} 
  165. clean-${PROJECT} distclean-${PROJECT}
  166. .NOTPARALLEL:
  167. #-------------------------------------------------------------------------------------------------------